2003-11-24 01:19:21 +03:00
|
|
|
#ifndef _MEDIA_EXTRACTOR_H
|
|
|
|
#define _MEDIA_EXTRACTOR_H
|
|
|
|
|
|
|
|
#include "ReaderPlugin.h"
|
|
|
|
#include "DecoderPlugin.h"
|
|
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
namespace media {
|
|
|
|
|
2004-11-21 03:11:39 +03:00
|
|
|
class ChunkCache;
|
|
|
|
|
2003-11-24 02:50:27 +03:00
|
|
|
struct stream_info
|
|
|
|
{
|
|
|
|
status_t status;
|
|
|
|
void * cookie;
|
2004-02-29 23:09:42 +03:00
|
|
|
bool hasCookie;
|
2005-06-30 04:24:06 +04:00
|
|
|
const void * infoBuffer;
|
|
|
|
size_t infoBufferSize;
|
2004-10-24 18:21:34 +04:00
|
|
|
ChunkCache * chunkCache;
|
2003-11-24 02:50:27 +03:00
|
|
|
media_format encodedFormat;
|
|
|
|
};
|
|
|
|
|
2003-11-24 01:19:21 +03:00
|
|
|
class MediaExtractor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MediaExtractor(BDataIO * source, int32 flags);
|
|
|
|
~MediaExtractor();
|
|
|
|
|
|
|
|
status_t InitCheck();
|
|
|
|
|
|
|
|
void GetFileFormatInfo(media_file_format *mfi) const;
|
|
|
|
|
|
|
|
int32 StreamCount();
|
|
|
|
|
2003-12-07 02:21:23 +03:00
|
|
|
const media_format * EncodedFormat(int32 stream);
|
2003-11-24 01:19:21 +03:00
|
|
|
int64 CountFrames(int32 stream) const;
|
|
|
|
bigtime_t Duration(int32 stream) const;
|
|
|
|
|
|
|
|
status_t Seek(int32 stream, uint32 seekTo,
|
|
|
|
int64 *frame, bigtime_t *time);
|
|
|
|
|
|
|
|
status_t GetNextChunk(int32 stream,
|
2005-06-30 04:24:06 +04:00
|
|
|
const void **chunkBuffer, size_t *chunkSize,
|
2003-11-24 01:19:21 +03:00
|
|
|
media_header *mediaHeader);
|
|
|
|
|
|
|
|
status_t CreateDecoder(int32 stream, Decoder **decoder, media_codec_info *mci);
|
2003-11-24 02:50:27 +03:00
|
|
|
|
2004-10-24 18:21:34 +04:00
|
|
|
private:
|
|
|
|
static int32 extractor_thread(void *arg);
|
|
|
|
void ExtractorThread();
|
2003-11-24 02:50:27 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
status_t fErr;
|
2004-10-24 18:21:34 +04:00
|
|
|
|
|
|
|
sem_id fExtractorWaitSem;
|
|
|
|
thread_id fExtractorThread;
|
|
|
|
volatile bool fTerminateExtractor;
|
|
|
|
|
2003-11-24 02:50:27 +03:00
|
|
|
BDataIO *fSource;
|
|
|
|
Reader *fReader;
|
2003-11-24 01:19:21 +03:00
|
|
|
|
2003-11-24 02:50:27 +03:00
|
|
|
stream_info * fStreamInfo;
|
|
|
|
int32 fStreamCount;
|
|
|
|
|
|
|
|
media_file_format fMff;
|
2003-11-24 01:19:21 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}; // namespace media
|
|
|
|
}; // namespace BPrivate
|
|
|
|
|
|
|
|
using namespace BPrivate::media;
|
|
|
|
|
|
|
|
#endif
|