1 #ifndef _MEDIA_EXTRACTOR_H 2 #define _MEDIA_EXTRACTOR_H 3 4 #include "ReaderPlugin.h" 5 #include "DecoderPlugin.h" 6 7 namespace BPrivate { 8 namespace media { 9 10 struct stream_info 11 { 12 status_t status; 13 void * cookie; 14 bool hasCookie; 15 void * infoBuffer; 16 int32 infoBufferSize; 17 media_format encodedFormat; 18 }; 19 20 class MediaExtractor 21 { 22 public: 23 MediaExtractor(BDataIO * source, int32 flags); 24 ~MediaExtractor(); 25 26 status_t InitCheck(); 27 28 void GetFileFormatInfo(media_file_format *mfi) const; 29 30 int32 StreamCount(); 31 32 const media_format * EncodedFormat(int32 stream); 33 int64 CountFrames(int32 stream) const; 34 bigtime_t Duration(int32 stream) const; 35 36 status_t Seek(int32 stream, uint32 seekTo, 37 int64 *frame, bigtime_t *time); 38 39 status_t GetNextChunk(int32 stream, 40 void **chunkBuffer, int32 *chunkSize, 41 media_header *mediaHeader); 42 43 status_t CreateDecoder(int32 stream, Decoder **decoder, media_codec_info *mci); 44 45 46 private: 47 status_t fErr; 48 49 BDataIO *fSource; 50 Reader *fReader; 51 52 stream_info * fStreamInfo; 53 int32 fStreamCount; 54 55 media_file_format fMff; 56 }; 57 58 }; // namespace media 59 }; // namespace BPrivate 60 61 using namespace BPrivate::media; 62 63 #endif 64