1 // AudioDecoderHaiku.h: Audio decoding using the Haiku media kit.
2 //
3 //   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
4 //   Free Software Foundation, Inc.
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19 
20 
21 #ifndef GNASH_AUDIODECODERHAIKU_H
22 #define GNASH_AUDIODECODERHAIKU_H
23 
24 #include "log.h"
25 #include "AudioDecoder.h" // for inheritance
26 
27 // Forward declarations
28 namespace gnash {
29     namespace media {
30         class SoundInfo;
31         class AudioInfo;
32     }
33 }
34 
35 namespace gnash {
36 namespace media {
37 namespace haiku {
38 
39 /// Haiku media kit based AudioDecoder
40 class AudioDecoderHaiku : public AudioDecoder {
41 
42 public:
43 	/// @param info
44 	/// 	AudioInfo class with all the info needed to decode
45 	///     the sound correctly. Throws a MediaException on fatal
46 	///     error.
47 	AudioDecoderHaiku(const AudioInfo& info);
48 
49 	/// @param info
50 	/// 	SoundInfo class with all the info needed to decode
51 	///     the sound correctly. Throws a MediaException on fatal
52 	///     error.
53 	AudioDecoderHaiku(SoundInfo& info);
54 	~AudioDecoderHaiku();
55 
56     // See dox in AudioDecoder.h
57 	std::uint8_t* decode(const std::uint8_t* input, std::uint32_t inputSize, std::uint32_t& outputSize, std::uint32_t& decodedBytes);
58 
59 	std::uint8_t* decode(const EncodedAudioFrame& af, std::uint32_t& outputSize);
60 
61 private:
62 //
63 //	void setup(const AudioInfo& info);
64 //	void setup(SoundInfo& info);
65 //
66 //	std::uint8_t* decodeFrame(const std::uint8_t* input, std::uint32_t inputSize, std::uint32_t& outputSize);
67 //
68 //	AVCodec* _audioCodec;
69 //	AVCodecContext* _audioCodecCtx;
70 //	AVCodecParserContext* _parser;
71 //
72 //	// Use for resampling audio
73 //	AudioResamplerFfmpeg _resampler;
74 //
75 //    /// True if a parser is required to decode the format
76 //    bool _needsParsing;
77 //
78 //    /// Parse input
79 //    //
80 //    /// @param input
81 //    ///     Pointer to frame we want to start parsing at.
82 //    ///
83 //    /// @param inputSize
84 //    ///     Number of bytes available in input
85 //    ///
86 //    /// @param outFrame
87 //    ///     Output parameter, will be set to the start
88 //    ///     of first frame found in input.
89 //    ///
90 //    /// @param outFrameSize
91 //    ///     Output parameter, will be set to size in bytes
92 //    ///     of the first frame found.
93 //    ///
94 //    /// @return number of input bytes parsed, or -1 on error
95 //    ///
96 //    int parseInput(const std::uint8_t* input, std::uint32_t inputSize,
97 //            std::uint8_t const ** outFrame, int* outFrameSize);
98 };
99 
100 } // gnash.media.haiku namespace
101 } // gnash.media namespace
102 } // gnash namespace
103 
104 #endif // __AUDIODECODERHAIKU_H__
105