1*218a8c03SAugustin Cavalier #ifndef _DECODER_PLUGIN_H 2*218a8c03SAugustin Cavalier #define _DECODER_PLUGIN_H 3*218a8c03SAugustin Cavalier 4*218a8c03SAugustin Cavalier #include <MediaTrack.h> 5*218a8c03SAugustin Cavalier #include <MediaFormats.h> 6*218a8c03SAugustin Cavalier #include "MediaPlugin.h" 7*218a8c03SAugustin Cavalier 8*218a8c03SAugustin Cavalier 9*218a8c03SAugustin Cavalier namespace BPrivate { namespace media { 10*218a8c03SAugustin Cavalier 11*218a8c03SAugustin Cavalier class PluginManager; 12*218a8c03SAugustin Cavalier 13*218a8c03SAugustin Cavalier class ChunkProvider { 14*218a8c03SAugustin Cavalier public: ~ChunkProvider()15*218a8c03SAugustin Cavalier virtual ~ChunkProvider() {}; 16*218a8c03SAugustin Cavalier virtual status_t GetNextChunk(const void** chunkBuffer, 17*218a8c03SAugustin Cavalier size_t* chunkSize, 18*218a8c03SAugustin Cavalier media_header* mediaHeader) = 0; 19*218a8c03SAugustin Cavalier }; 20*218a8c03SAugustin Cavalier 21*218a8c03SAugustin Cavalier class Decoder { 22*218a8c03SAugustin Cavalier public: 23*218a8c03SAugustin Cavalier Decoder(); 24*218a8c03SAugustin Cavalier virtual ~Decoder(); 25*218a8c03SAugustin Cavalier 26*218a8c03SAugustin Cavalier virtual void GetCodecInfo(media_codec_info* codecInfo) = 0; 27*218a8c03SAugustin Cavalier 28*218a8c03SAugustin Cavalier // Setup get's called with the info data from Reader::GetStreamInfo 29*218a8c03SAugustin Cavalier virtual status_t Setup(media_format* ioEncodedFormat, 30*218a8c03SAugustin Cavalier const void* infoBuffer, 31*218a8c03SAugustin Cavalier size_t infoSize) = 0; 32*218a8c03SAugustin Cavalier 33*218a8c03SAugustin Cavalier virtual status_t NegotiateOutputFormat( 34*218a8c03SAugustin Cavalier media_format* ioDecodedFormat) = 0; 35*218a8c03SAugustin Cavalier 36*218a8c03SAugustin Cavalier virtual status_t SeekedTo(int64 frame, bigtime_t time) = 0; 37*218a8c03SAugustin Cavalier 38*218a8c03SAugustin Cavalier virtual status_t Decode(void* buffer, int64* frameCount, 39*218a8c03SAugustin Cavalier media_header* mediaHeader, 40*218a8c03SAugustin Cavalier media_decode_info* info = 0) = 0; 41*218a8c03SAugustin Cavalier 42*218a8c03SAugustin Cavalier status_t GetNextChunk(const void** chunkBuffer, 43*218a8c03SAugustin Cavalier size_t* chunkSize, 44*218a8c03SAugustin Cavalier media_header* mediaHeader); 45*218a8c03SAugustin Cavalier 46*218a8c03SAugustin Cavalier void SetChunkProvider(ChunkProvider* provider); 47*218a8c03SAugustin Cavalier 48*218a8c03SAugustin Cavalier virtual status_t Perform(perform_code code, void* data); 49*218a8c03SAugustin Cavalier 50*218a8c03SAugustin Cavalier private: 51*218a8c03SAugustin Cavalier virtual void _ReservedDecoder1(); 52*218a8c03SAugustin Cavalier virtual void _ReservedDecoder2(); 53*218a8c03SAugustin Cavalier virtual void _ReservedDecoder3(); 54*218a8c03SAugustin Cavalier virtual void _ReservedDecoder4(); 55*218a8c03SAugustin Cavalier virtual void _ReservedDecoder5(); 56*218a8c03SAugustin Cavalier 57*218a8c03SAugustin Cavalier ChunkProvider* fChunkProvider; 58*218a8c03SAugustin Cavalier 59*218a8c03SAugustin Cavalier // needed for plug-in reference count management 60*218a8c03SAugustin Cavalier friend class PluginManager; 61*218a8c03SAugustin Cavalier MediaPlugin* fMediaPlugin; 62*218a8c03SAugustin Cavalier 63*218a8c03SAugustin Cavalier uint32 fReserved[5]; 64*218a8c03SAugustin Cavalier }; 65*218a8c03SAugustin Cavalier 66*218a8c03SAugustin Cavalier 67*218a8c03SAugustin Cavalier class DecoderPlugin : public virtual MediaPlugin { 68*218a8c03SAugustin Cavalier public: 69*218a8c03SAugustin Cavalier DecoderPlugin(); 70*218a8c03SAugustin Cavalier 71*218a8c03SAugustin Cavalier virtual Decoder* NewDecoder(uint index) = 0; 72*218a8c03SAugustin Cavalier virtual status_t GetSupportedFormats(media_format** formats, 73*218a8c03SAugustin Cavalier size_t* count) = 0; 74*218a8c03SAugustin Cavalier }; 75*218a8c03SAugustin Cavalier 76*218a8c03SAugustin Cavalier } } // namespace BPrivate::media 77*218a8c03SAugustin Cavalier 78*218a8c03SAugustin Cavalier using namespace BPrivate::media; 79*218a8c03SAugustin Cavalier 80*218a8c03SAugustin Cavalier #endif // _DECODER_PLUGIN_H 81