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 void * infoBuffer; 15 int32 infoBufferSize; 16 media_format encodedFormat; 17 }; 18 19 class MediaExtractor 20 { 21 public: 22 MediaExtractor(BDataIO * source, int32 flags); 23 ~MediaExtractor(); 24 25 status_t InitCheck(); 26 27 void GetFileFormatInfo(media_file_format *mfi) const; 28 29 int32 StreamCount(); 30 31 const media_format * EncodedFormat(int32 stream); 32 int64 CountFrames(int32 stream) const; 33 bigtime_t Duration(int32 stream) const; 34 35 status_t Seek(int32 stream, uint32 seekTo, 36 int64 *frame, bigtime_t *time); 37 38 status_t GetNextChunk(int32 stream, 39 void **chunkBuffer, int32 *chunkSize, 40 media_header *mediaHeader); 41 42 status_t CreateDecoder(int32 stream, Decoder **decoder, media_codec_info *mci); 43 44 45 private: 46 status_t fErr; 47 48 BDataIO *fSource; 49 Reader *fReader; 50 51 stream_info * fStreamInfo; 52 int32 fStreamCount; 53 54 media_file_format fMff; 55 }; 56 57 }; // namespace media 58 }; // namespace BPrivate 59 60 using namespace BPrivate::media; 61 62 #endif 63