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