DecoderPlugin.h revision 218a8c03
1#ifndef _DECODER_PLUGIN_H
2#define _DECODER_PLUGIN_H
3
4#include <MediaTrack.h>
5#include <MediaFormats.h>
6#include "MediaPlugin.h"
7
8
9namespace BPrivate { namespace media {
10
11class PluginManager;
12
13class ChunkProvider {
14public:
15	virtual						~ChunkProvider() {};
16	virtual	status_t			GetNextChunk(const void** chunkBuffer,
17									size_t* chunkSize,
18									media_header* mediaHeader) = 0;
19};
20
21class Decoder {
22public:
23								Decoder();
24	virtual						~Decoder();
25
26	virtual	void				GetCodecInfo(media_codec_info* codecInfo) = 0;
27
28	// Setup get's called with the info data from Reader::GetStreamInfo
29	virtual	status_t			Setup(media_format* ioEncodedFormat,
30									const void* infoBuffer,
31									size_t infoSize) = 0;
32
33	virtual	status_t			NegotiateOutputFormat(
34									media_format* ioDecodedFormat) = 0;
35
36	virtual	status_t			SeekedTo(int64 frame, bigtime_t time) = 0;
37
38	virtual status_t			Decode(void* buffer, int64* frameCount,
39									media_header* mediaHeader,
40									media_decode_info* info = 0) = 0;
41
42			status_t			GetNextChunk(const void** chunkBuffer,
43									size_t* chunkSize,
44									media_header* mediaHeader);
45
46			void				SetChunkProvider(ChunkProvider* provider);
47
48	virtual status_t			Perform(perform_code code, void* data);
49
50private:
51	virtual void				_ReservedDecoder1();
52	virtual void				_ReservedDecoder2();
53	virtual void				_ReservedDecoder3();
54	virtual void				_ReservedDecoder4();
55	virtual void				_ReservedDecoder5();
56
57			ChunkProvider*		fChunkProvider;
58
59	// needed for plug-in reference count management
60	friend class PluginManager;
61			MediaPlugin*		fMediaPlugin;
62
63			uint32				fReserved[5];
64};
65
66
67class DecoderPlugin : public virtual MediaPlugin {
68public:
69								DecoderPlugin();
70
71	virtual	Decoder*			NewDecoder(uint index) = 0;
72	virtual	status_t			GetSupportedFormats(media_format** formats,
73									size_t* count) = 0;
74};
75
76} } // namespace BPrivate::media
77
78using namespace BPrivate::media;
79
80#endif // _DECODER_PLUGIN_H
81