haiku/headers/private/media/MediaExtractor.h
Stephan Aßmus d830aa92ce * Added FindKeyFrame() method to MediaExtractor, it is similar to Seek(),
but operates "read-only".
* Added FindKeyFrame() method to ReaderPlugin, see above.
* Reformated ReaderPlugin header. Added const qualifier to Source() method.
* Small cleanups in BMediaTrack::SeekToTime() and SeekToFrame(). Added TODOs
  with regards to "seeking" in decoders, wich should IMHO be revised. (Codecs
  cannot seek in the stream, they only get fed chunk data. The only thing they
  can do is reset themselves in preparation for a discontinuity of the chunk
  data...)
* Implemented BMediaTrack::FindKeyframeByXX() methods via the new
  MediaExtractor::FindKeyFrame() method.
* Implemented Seek() and FindKeyFrame() methods in the Reader base class,
  returning B_NOT_SUPPORTED. I think this makes sense and also I don't have
  to adapt all existing Reader plugins for the new FindKeyFrame() call. :-)
* Implemeneted FindKeyFrame() in the avi_reader. The OpenDMLFile class
  gets Seek() extended for a "read-only" mode. Currently the implementation
  is broken (as before) with regards to keyframes. These were ignored before
  and I have not changed them to actually support the seek flags with regards
  to keyframes. That's the interesting TODO...
* Some reformatting here and there in avi_reader code, sorry for the mixup.
  The only actual change is the support for the read-only flag to Seek().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24495 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-20 23:36:14 +00:00

76 lines
1.5 KiB
C++

#ifndef _MEDIA_EXTRACTOR_H
#define _MEDIA_EXTRACTOR_H
#include "ReaderPlugin.h"
#include "DecoderPlugin.h"
namespace BPrivate {
namespace media {
class ChunkCache;
struct stream_info
{
status_t status;
void * cookie;
bool hasCookie;
const void * infoBuffer;
size_t infoBufferSize;
ChunkCache * chunkCache;
media_format encodedFormat;
};
class MediaExtractor
{
public:
MediaExtractor(BDataIO * source, int32 flags);
~MediaExtractor();
status_t InitCheck();
void GetFileFormatInfo(media_file_format *mfi) const;
int32 StreamCount();
const media_format * EncodedFormat(int32 stream);
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 FindKeyFrame(int32 stream, uint32 seekTo,
int64 *frame, bigtime_t *time) const;
status_t GetNextChunk(int32 stream,
const void **chunkBuffer, size_t *chunkSize,
media_header *mediaHeader);
status_t CreateDecoder(int32 stream, Decoder **decoder, media_codec_info *mci);
private:
static int32 extractor_thread(void *arg);
void ExtractorThread();
private:
status_t fErr;
sem_id fExtractorWaitSem;
thread_id fExtractorThread;
volatile bool fTerminateExtractor;
BDataIO *fSource;
Reader *fReader;
stream_info * fStreamInfo;
int32 fStreamCount;
media_file_format fMff;
};
}; // namespace media
}; // namespace BPrivate
using namespace BPrivate::media;
#endif