xref: /haiku/headers/private/media/DecoderPlugin.h (revision 5115ca085884f7b604a3d607688f0ca20fb7cf57)
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 class AddOnManager;
9 
10 namespace BPrivate { namespace media {
11 
12 class ChunkProvider {
13 public:
14 	virtual			~ChunkProvider() {};
15 	virtual status_t	GetNextChunk(const void **chunkBuffer, size_t *chunkSize,
16 						             media_header *mediaHeader) = 0;
17 };
18 
19 class Decoder
20 {
21 public:
22 						Decoder();
23 	virtual				~Decoder();
24 
25 	virtual void		GetCodecInfo(media_codec_info *codecInfo) = 0;
26 
27 						// Setup get's called with the info data from Reader::GetStreamInfo
28 	virtual status_t	Setup(media_format *ioEncodedFormat, const void *infoBuffer, size_t infoSize) = 0;
29 
30 	virtual status_t	NegotiateOutputFormat(media_format *ioDecodedFormat) = 0;
31 
32 	virtual status_t	Seek(uint32 seekTo,
33 							 int64 seekFrame, int64 *frame,
34 							 bigtime_t seekTime, bigtime_t *time) = 0;
35 
36 	virtual status_t	Decode(void *buffer, int64 *frameCount,
37 							   media_header *mediaHeader, media_decode_info *info = 0) = 0;
38 
39 	status_t			GetNextChunk(const void **chunkBuffer, size_t *chunkSize,
40 									 media_header *mediaHeader);
41 
42 	void				Setup(ChunkProvider *provider);
43 private:
44 	ChunkProvider *		fChunkProvider;
45 };
46 
47 
48 class DecoderPlugin : public virtual MediaPlugin
49 {
50 	public:
51 		DecoderPlugin();
52 
53 		virtual Decoder *NewDecoder(uint index) = 0;
54 		virtual status_t GetSupportedFormats(media_format ** formats, size_t * count) = 0;
55 };
56 
57 } } // namespace BPrivate::media
58 
59 using namespace BPrivate::media;
60 
61 #endif
62