MediaDecoder.h revision 218a8c03
1#ifndef MEDIADECODER_H
2#define MEDIADECODER_H
3
4#include <MediaDefs.h>
5#include <MediaFormats.h>
6
7namespace BPrivate {
8	class Decoder;
9}
10namespace BPrivate {
11	namespace media {
12		class Decoder;
13		class DecoderPlugin;
14	}
15}
16
17class BMediaDecoder {
18	public:
19		BMediaDecoder();
20		BMediaDecoder(const media_format *in_format,
21		              const void *info = NULL, size_t info_size = 0);
22		BMediaDecoder(const media_codec_info *mci);
23		virtual ~BMediaDecoder();
24		status_t InitCheck() const;
25
26		status_t SetTo(const media_format *in_format,
27		               const void *info = NULL, size_t info_size = 0);
28		status_t SetTo(const media_codec_info *mci);
29		status_t SetInputFormat(const media_format *in_format,
30		                        const void *in_info = NULL, size_t in_size = 0);
31		status_t SetOutputFormat(media_format *output_format);
32			// Set output format to closest acceptable format, returns the
33			// format used.
34		status_t Decode(void *out_buffer, int64 *out_frameCount,
35		                media_header *out_mh, media_decode_info *info);
36		status_t GetDecoderInfo(media_codec_info *out_info) const;
37
38	protected:
39		virtual status_t GetNextChunk(const void **chunkData, size_t *chunkLen,
40		                              media_header *mh) = 0;
41
42	private:
43
44		//	unimplemented
45		BMediaDecoder(const BMediaDecoder &);
46		BMediaDecoder & operator=(const BMediaDecoder &);
47
48		status_t AttachToDecoder();
49
50		BPrivate::media::Decoder	*fDecoder;
51		status_t			fInitStatus;
52
53		/* fbc data and virtuals */
54
55		uint32 _reserved_BMediaDecoder_[33];
56
57		virtual	status_t _Reserved_BMediaDecoder_0(int32 arg, ...);
58		virtual	status_t _Reserved_BMediaDecoder_1(int32 arg, ...);
59		virtual	status_t _Reserved_BMediaDecoder_2(int32 arg, ...);
60		virtual	status_t _Reserved_BMediaDecoder_3(int32 arg, ...);
61		virtual	status_t _Reserved_BMediaDecoder_4(int32 arg, ...);
62		virtual	status_t _Reserved_BMediaDecoder_5(int32 arg, ...);
63		virtual	status_t _Reserved_BMediaDecoder_6(int32 arg, ...);
64		virtual	status_t _Reserved_BMediaDecoder_7(int32 arg, ...);
65		virtual	status_t _Reserved_BMediaDecoder_8(int32 arg, ...);
66		virtual	status_t _Reserved_BMediaDecoder_9(int32 arg, ...);
67		virtual	status_t _Reserved_BMediaDecoder_10(int32 arg, ...);
68		virtual	status_t _Reserved_BMediaDecoder_11(int32 arg, ...);
69		virtual	status_t _Reserved_BMediaDecoder_12(int32 arg, ...);
70		virtual	status_t _Reserved_BMediaDecoder_13(int32 arg, ...);
71		virtual	status_t _Reserved_BMediaDecoder_14(int32 arg, ...);
72		virtual	status_t _Reserved_BMediaDecoder_15(int32 arg, ...);
73};
74
75class BMediaBufferDecoder : public BMediaDecoder {
76	public:
77		BMediaBufferDecoder();
78		BMediaBufferDecoder(const media_format *in_format,
79		                    const void *info = NULL, size_t info_size = 0);
80		BMediaBufferDecoder(const media_codec_info *mci);
81		status_t DecodeBuffer(const void *input_buffer, size_t input_size,
82		                      void *out_buffer, int64 *out_frameCount,
83		                      media_header *out_mh,
84		                      media_decode_info *info = NULL);
85	protected:
86		virtual status_t GetNextChunk(const void **chunkData, size_t *chunkLen,
87		                              media_header *mh);
88		const void *fBuffer;
89		int32 fBufferSize;
90};
91
92#endif
93
94