start of media kit codec plugin API
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5078 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#include <MediaTrack.h>
|
||||
#include "MediaPlugin.h"
|
||||
|
||||
namespace BPrivate { namespace media {
|
||||
|
||||
class Decoder
|
||||
{
|
||||
public:
|
||||
Decoder();
|
||||
virtual ~Decoder();
|
||||
|
||||
// Sniff get's called with the data from Reader::GetStreamInfo
|
||||
virtual status_t Sniff(media_format *format, void **infoBuffer, int32 *infoSize) = 0;
|
||||
|
||||
virtual status_t GetOutputFormat(media_format *format) = 0;
|
||||
|
||||
virtual status_t Seek(media_seek_type seekTo,
|
||||
int64 *frame, bigtime_t *time) = 0;
|
||||
|
||||
virtual status_t Decode(void *buffer, int64 *frameCount,
|
||||
media_header *mediaHeader, media_decode_info *info) = 0;
|
||||
|
||||
status_t GetNextChunk(void **chunkBuffer, int32 *chunkSize,
|
||||
media_header *mediaHeader);
|
||||
|
||||
private:
|
||||
void Setup(BMediaTrack *reader);
|
||||
BMediaTrack * fReader;
|
||||
};
|
||||
|
||||
|
||||
class DecoderPlugin : public MediaPlugin
|
||||
{
|
||||
public:
|
||||
virtual Decoder *NewDecoder() = 0;
|
||||
};
|
||||
|
||||
MediaPlugin *instantiate_plugin();
|
||||
|
||||
} } // namespace BPrivate::media
|
||||
|
||||
using namespace BPrivate::media;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#include <MediaTrack.h>
|
||||
|
||||
namespace BPrivate { namespace media {
|
||||
|
||||
class MediaPlugin
|
||||
{
|
||||
public:
|
||||
MediaPlugin();
|
||||
virtual ~MediaPlugin();
|
||||
};
|
||||
|
||||
class Decoder;
|
||||
class Reader;
|
||||
|
||||
} } // namespace BPrivate::media
|
||||
|
||||
using namespace BPrivate::media;
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#include <MediaTrack.h>
|
||||
#include "MediaPlugin.h"
|
||||
|
||||
namespace BPrivate { namespace media {
|
||||
|
||||
class Reader
|
||||
{
|
||||
public:
|
||||
Reader();
|
||||
virtual ~Reader();
|
||||
|
||||
virtual const char *Copyright() = 0;
|
||||
|
||||
virtual status_t Sniff(int32 *streamCount) = 0;
|
||||
|
||||
virtual status_t AllocateCookie(int32 streamNumber, void **cookie) = 0;
|
||||
virtual status_t FreeCookie(void *cookie) = 0;
|
||||
|
||||
virtual status_t GetStreamInfo(void *cookie, int64 *frameCount, bigtime_t *duration,
|
||||
media_format *format, void **infoBuffer, int32 *infoSize) = 0;
|
||||
|
||||
virtual status_t Seek(void *cookie,
|
||||
media_seek_type seekTo,
|
||||
int64 *frame, bigtime_t *time) = 0;
|
||||
|
||||
virtual status_t GetNextChunk(void *cookie,
|
||||
void **chunkBuffer, int32 *chunkSize,
|
||||
media_header *mediaHeader) = 0;
|
||||
|
||||
BDataIO * Source();
|
||||
|
||||
private:
|
||||
void Setup(BDataIO *source);
|
||||
|
||||
BDataIO * fSource;
|
||||
};
|
||||
|
||||
|
||||
class ReaderPlugin : public MediaPlugin
|
||||
{
|
||||
public:
|
||||
virtual Reader *NewReader() = 0;
|
||||
};
|
||||
|
||||
MediaPlugin *instantiate_plugin();
|
||||
|
||||
} } // namespace BPrivate::media
|
||||
|
||||
using namespace BPrivate::media;
|
||||
|
||||
Reference in New Issue
Block a user