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