1 #ifndef MEDIADECODER_H 2 #define MEDIADECODER_H 3 4 5 #include <MediaFormats.h> 6 7 8 namespace BCodecKit { 9 class BDecoder; 10 } 11 12 13 class BMediaDecoder { 14 public: 15 BMediaDecoder(); 16 BMediaDecoder(const media_format *in_format, 17 const void *info = NULL, size_t info_size = 0); 18 BMediaDecoder(const media_codec_info *mci); 19 virtual ~BMediaDecoder(); 20 status_t InitCheck() const; 21 22 status_t SetTo(const media_format *in_format, 23 const void *info = NULL, size_t info_size = 0); 24 status_t SetTo(const media_codec_info *mci); 25 status_t SetInputFormat(const media_format *in_format, 26 const void *in_info = NULL, size_t in_size = 0); 27 status_t SetOutputFormat(media_format *output_format); 28 // Set output format to closest acceptable format, returns the 29 // format used. 30 status_t Decode(void *out_buffer, int64 *out_frameCount, 31 media_header *out_mh, media_decode_info *info); 32 status_t GetDecoderInfo(media_codec_info *out_info) const; 33 34 protected: 35 virtual status_t GetNextChunk(const void **chunkData, size_t *chunkLen, 36 media_header *mh) = 0; 37 38 private: 39 40 // unimplemented 41 BMediaDecoder(const BMediaDecoder &); 42 BMediaDecoder & operator=(const BMediaDecoder &); 43 44 status_t AttachToDecoder(); 45 46 BCodecKit::BDecoder* fDecoder; 47 status_t fInitStatus; 48 49 /* fbc data and virtuals */ 50 51 uint32 _reserved_BMediaDecoder_[33]; 52 53 virtual status_t _Reserved_BMediaDecoder_0(int32 arg, ...); 54 virtual status_t _Reserved_BMediaDecoder_1(int32 arg, ...); 55 virtual status_t _Reserved_BMediaDecoder_2(int32 arg, ...); 56 virtual status_t _Reserved_BMediaDecoder_3(int32 arg, ...); 57 virtual status_t _Reserved_BMediaDecoder_4(int32 arg, ...); 58 virtual status_t _Reserved_BMediaDecoder_5(int32 arg, ...); 59 virtual status_t _Reserved_BMediaDecoder_6(int32 arg, ...); 60 virtual status_t _Reserved_BMediaDecoder_7(int32 arg, ...); 61 virtual status_t _Reserved_BMediaDecoder_8(int32 arg, ...); 62 virtual status_t _Reserved_BMediaDecoder_9(int32 arg, ...); 63 virtual status_t _Reserved_BMediaDecoder_10(int32 arg, ...); 64 virtual status_t _Reserved_BMediaDecoder_11(int32 arg, ...); 65 virtual status_t _Reserved_BMediaDecoder_12(int32 arg, ...); 66 virtual status_t _Reserved_BMediaDecoder_13(int32 arg, ...); 67 virtual status_t _Reserved_BMediaDecoder_14(int32 arg, ...); 68 virtual status_t _Reserved_BMediaDecoder_15(int32 arg, ...); 69 }; 70 71 class BMediaBufferDecoder : public BMediaDecoder { 72 public: 73 BMediaBufferDecoder(); 74 BMediaBufferDecoder(const media_format *in_format, 75 const void *info = NULL, size_t info_size = 0); 76 BMediaBufferDecoder(const media_codec_info *mci); 77 status_t DecodeBuffer(const void *input_buffer, size_t input_size, 78 void *out_buffer, int64 *out_frameCount, 79 media_header *out_mh, 80 media_decode_info *info = NULL); 81 protected: 82 virtual status_t GetNextChunk(const void **chunkData, size_t *chunkLen, 83 media_header *mh); 84 const void *fBuffer; 85 int32 fBufferSize; 86 }; 87 88 #endif 89 90