2003-11-24 02:50:27 +03:00
|
|
|
#ifndef _DECODER_PLUGIN_H
|
|
|
|
#define _DECODER_PLUGIN_H
|
|
|
|
|
2018-10-28 17:45:44 +03:00
|
|
|
|
2003-10-18 03:55:19 +04:00
|
|
|
#include <MediaTrack.h>
|
2003-11-23 21:17:35 +03:00
|
|
|
#include <MediaFormats.h>
|
2018-10-29 11:41:21 +03:00
|
|
|
|
2003-10-18 03:55:19 +04:00
|
|
|
#include "MediaPlugin.h"
|
|
|
|
|
2003-12-14 22:23:16 +03:00
|
|
|
|
2003-10-18 03:55:19 +04:00
|
|
|
namespace BPrivate { namespace media {
|
|
|
|
|
2009-06-07 22:11:05 +04:00
|
|
|
class PluginManager;
|
|
|
|
|
2004-01-18 10:37:21 +03:00
|
|
|
class ChunkProvider {
|
|
|
|
public:
|
2009-06-07 22:11:05 +04:00
|
|
|
virtual ~ChunkProvider() {};
|
|
|
|
virtual status_t GetNextChunk(const void** chunkBuffer,
|
|
|
|
size_t* chunkSize,
|
|
|
|
media_header* mediaHeader) = 0;
|
2004-01-18 10:37:21 +03:00
|
|
|
};
|
|
|
|
|
2018-10-28 18:14:25 +03:00
|
|
|
|
2009-06-07 22:11:05 +04:00
|
|
|
class Decoder {
|
2003-10-18 03:55:19 +04:00
|
|
|
public:
|
2009-06-07 22:11:05 +04:00
|
|
|
Decoder();
|
|
|
|
virtual ~Decoder();
|
2004-01-23 10:24:51 +03:00
|
|
|
|
2009-06-07 22:11:05 +04:00
|
|
|
virtual void GetCodecInfo(media_codec_info* codecInfo) = 0;
|
2004-01-23 10:24:51 +03:00
|
|
|
|
2009-06-07 22:11:05 +04:00
|
|
|
// Setup get's called with the info data from Reader::GetStreamInfo
|
|
|
|
virtual status_t Setup(media_format* ioEncodedFormat,
|
|
|
|
const void* infoBuffer,
|
|
|
|
size_t infoSize) = 0;
|
2003-12-07 02:21:23 +03:00
|
|
|
|
2009-06-07 22:11:05 +04:00
|
|
|
virtual status_t NegotiateOutputFormat(
|
|
|
|
media_format* ioDecodedFormat) = 0;
|
2003-10-18 03:55:19 +04:00
|
|
|
|
2010-09-18 18:44:22 +04:00
|
|
|
virtual status_t SeekedTo(int64 frame, bigtime_t time) = 0;
|
2003-10-18 03:55:19 +04:00
|
|
|
|
2009-06-07 22:11:05 +04:00
|
|
|
virtual status_t Decode(void* buffer, int64* frameCount,
|
|
|
|
media_header* mediaHeader,
|
|
|
|
media_decode_info* info = 0) = 0;
|
2003-10-18 03:55:19 +04:00
|
|
|
|
2009-06-07 22:11:05 +04:00
|
|
|
status_t GetNextChunk(const void** chunkBuffer,
|
|
|
|
size_t* chunkSize,
|
|
|
|
media_header* mediaHeader);
|
|
|
|
|
|
|
|
void SetChunkProvider(ChunkProvider* provider);
|
|
|
|
|
2018-11-18 14:05:48 +03:00
|
|
|
virtual status_t Perform(perform_code code, void* data);
|
|
|
|
|
2003-10-18 03:55:19 +04:00
|
|
|
private:
|
2009-06-07 22:11:05 +04:00
|
|
|
ChunkProvider* fChunkProvider;
|
|
|
|
|
2018-10-29 11:41:21 +03:00
|
|
|
MediaPlugin* fMediaPlugin;
|
|
|
|
|
2009-06-07 22:11:05 +04:00
|
|
|
// needed for plug-in reference count management
|
|
|
|
friend class PluginManager;
|
|
|
|
|
2018-10-28 17:45:44 +03:00
|
|
|
virtual void _ReservedDecoder1();
|
|
|
|
virtual void _ReservedDecoder2();
|
|
|
|
virtual void _ReservedDecoder3();
|
|
|
|
virtual void _ReservedDecoder4();
|
|
|
|
virtual void _ReservedDecoder5();
|
|
|
|
|
2009-06-07 22:11:05 +04:00
|
|
|
uint32 fReserved[5];
|
2003-10-18 03:55:19 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-06-07 22:11:05 +04:00
|
|
|
class DecoderPlugin : public virtual MediaPlugin {
|
|
|
|
public:
|
|
|
|
DecoderPlugin();
|
2003-11-23 21:17:35 +03:00
|
|
|
|
2009-06-07 22:11:05 +04:00
|
|
|
virtual Decoder* NewDecoder(uint index) = 0;
|
|
|
|
virtual status_t GetSupportedFormats(media_format** formats,
|
2009-07-29 20:24:00 +04:00
|
|
|
size_t* count) = 0;
|
2003-10-18 03:55:19 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} } // namespace BPrivate::media
|
|
|
|
|
|
|
|
using namespace BPrivate::media;
|
2003-11-24 02:50:27 +03:00
|
|
|
|
2009-06-07 22:11:05 +04:00
|
|
|
#endif // _DECODER_PLUGIN_H
|