17a115dc7Sbeveloper#ifndef _DECODER_PLUGIN_H
27a115dc7Sbeveloper#define _DECODER_PLUGIN_H
37a115dc7Sbeveloper
4ca16f5cbSbeveloper#include <MediaTrack.h>
5bce1ab5eSbeveloper#include <MediaFormats.h>
6ca16f5cbSbeveloper#include "MediaPlugin.h"
7ca16f5cbSbeveloper
8046f31f9Sbeveloper
9218a8c03SAugustin Cavaliernamespace BPrivate { namespace media {
10ca16f5cbSbeveloper
11218a8c03SAugustin Cavalierclass PluginManager;
12bb56a763SStephan Aßmus
13218a8c03SAugustin Cavalierclass ChunkProvider {
14b4057dc9Sshattypublic:
15218a8c03SAugustin Cavalier	virtual						~ChunkProvider() {};
16bb56a763SStephan Aßmus	virtual	status_t			GetNextChunk(const void** chunkBuffer,
17bb56a763SStephan Aßmus									size_t* chunkSize,
18bb56a763SStephan Aßmus									media_header* mediaHeader) = 0;
19b4057dc9Sshatty};
20b4057dc9Sshatty
21218a8c03SAugustin Cavalierclass Decoder {
22ca16f5cbSbeveloperpublic:
23218a8c03SAugustin Cavalier								Decoder();
24218a8c03SAugustin Cavalier	virtual						~Decoder();
25218a8c03SAugustin Cavalier
26bb56a763SStephan Aßmus	virtual	void				GetCodecInfo(media_codec_info* codecInfo) = 0;
27c38d73eeSAxel Dörfler
28bb56a763SStephan Aßmus	// Setup get's called with the info data from Reader::GetStreamInfo
29bb56a763SStephan Aßmus	virtual	status_t			Setup(media_format* ioEncodedFormat,
30bb56a763SStephan Aßmus									const void* infoBuffer,
31bb56a763SStephan Aßmus									size_t infoSize) = 0;
3225305239Sbeveloper
33bb56a763SStephan Aßmus	virtual	status_t			NegotiateOutputFormat(
34bb56a763SStephan Aßmus									media_format* ioDecodedFormat) = 0;
35ca16f5cbSbeveloper
362e54e93fSStephan Aßmus	virtual	status_t			SeekedTo(int64 frame, bigtime_t time) = 0;
37ca16f5cbSbeveloper
38bb56a763SStephan Aßmus	virtual status_t			Decode(void* buffer, int64* frameCount,
39bb56a763SStephan Aßmus									media_header* mediaHeader,
40bb56a763SStephan Aßmus									media_decode_info* info = 0) = 0;
41ca16f5cbSbeveloper
42bb56a763SStephan Aßmus			status_t			GetNextChunk(const void** chunkBuffer,
43bb56a763SStephan Aßmus									size_t* chunkSize,
44bb56a763SStephan Aßmus									media_header* mediaHeader);
45bb56a763SStephan Aßmus
46218a8c03SAugustin Cavalier			void				SetChunkProvider(ChunkProvider* provider);
47bb56a763SStephan Aßmus
48121db87fSBarrett	virtual status_t			Perform(perform_code code, void* data);
49121db87fSBarrett
50ca16f5cbSbeveloperprivate:
5142693643SBarrett	virtual void				_ReservedDecoder1();
5242693643SBarrett	virtual void				_ReservedDecoder2();
5342693643SBarrett	virtual void				_ReservedDecoder3();
5442693643SBarrett	virtual void				_ReservedDecoder4();
5542693643SBarrett	virtual void				_ReservedDecoder5();
5642693643SBarrett
57218a8c03SAugustin Cavalier			ChunkProvider*		fChunkProvider;
58218a8c03SAugustin Cavalier
59218a8c03SAugustin Cavalier	// needed for plug-in reference count management
60218a8c03SAugustin Cavalier	friend class PluginManager;
61218a8c03SAugustin Cavalier			MediaPlugin*		fMediaPlugin;
62218a8c03SAugustin Cavalier
63bb56a763SStephan Aßmus			uint32				fReserved[5];
64ca16f5cbSbeveloper};
65ca16f5cbSbeveloper
66ca16f5cbSbeveloper
67218a8c03SAugustin Cavalierclass DecoderPlugin : public virtual MediaPlugin {
68bb56a763SStephan Aßmuspublic:
69218a8c03SAugustin Cavalier								DecoderPlugin();
70bce1ab5eSbeveloper
71218a8c03SAugustin Cavalier	virtual	Decoder*			NewDecoder(uint index) = 0;
72bb56a763SStephan Aßmus	virtual	status_t			GetSupportedFormats(media_format** formats,
733575ad00SStephan Aßmus									size_t* count) = 0;
74ca16f5cbSbeveloper};
75ca16f5cbSbeveloper
76218a8c03SAugustin Cavalier} } // namespace BPrivate::media
77ca16f5cbSbeveloper
78218a8c03SAugustin Cavalierusing namespace BPrivate::media;
797a115dc7Sbeveloper
80bb56a763SStephan Aßmus#endif // _DECODER_PLUGIN_H
81