Gnash  0.8.11dev
AudioDecoderSimple.h
Go to the documentation of this file.
1 // AudioDecoderSimple.h: Audio decoding using "simple" internal decoders.
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_AUDIODECODERSIMPLE_H
22 #define GNASH_AUDIODECODERSIMPLE_H
23 
24 #include "AudioDecoder.h" // for inheritance
25 #include "MediaParser.h" // for audioCodecType enum (composition)
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 
40 
41 public:
42 
50  AudioDecoderSimple(const AudioInfo& info);
51 
59  AudioDecoderSimple(const SoundInfo& info);
60 
62 
63  // See dox in AudioDecoder.h
64  std::uint8_t* decode(const std::uint8_t* input, std::uint32_t inputSize, std::uint32_t& outputSize, std::uint32_t& decodedBytes);
65 
66 private:
67 
68  // throws MediaException on failure
69  void setup(const AudioInfo& info);
70 
71  // throws MediaException on failure
72  void setup(const SoundInfo& info);
73 
74  // codec
75  audioCodecType _codec;
76 
77  // samplerate
78  std::uint16_t _sampleRate;
79 
80  // sampleCount
81  std::uint32_t _sampleCount;
82 
83  // stereo
84  bool _stereo;
85 
86  // samplesize: 8 or 16 bit
87  bool _is16bit;
88 
89 
90  //
91 };
92 
93 } // gnash.media namespace
94 } // gnash namespace
95 
96 #endif // __AUDIODECODERSIMPLE_H__
97 
gnash::media::AudioDecoderSimple
Audio decoding using "simple" internal decoders.
Definition: AudioDecoderSimple.h:39
AudioDecoder.h
SoundInfo.h
gnash::log_swferror
void log_swferror(StringType msg, Args... args)
Definition: log.h:325
gnash::media::SoundInfo::getSampleCount
unsigned long getSampleCount() const
Returns the samplecount of the sound.
Definition: SoundInfo.h:103
gnash::media::AUDIO_CODEC_ADPCM
@ AUDIO_CODEC_ADPCM
ADPCM format.
Definition: MediaParser.h:148
gnash::media::SoundInfo
Class containing information about an embedded sound definition.
Definition: SoundInfo.h:34
gnash::log_debug
void log_debug(StringType msg, Args... args)
Definition: log.h:301
gnash::key::i
@ i
Definition: GnashKey.h:155
_
#define _(String)
Definition: log.h:44
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
AudioDecoderSimple.h
AudioResampler.h
gnash::key::s
@ s
Definition: GnashKey.h:165
gnash::media::SoundInfo::getSampleRate
unsigned long getSampleRate() const
Returns the samplerate of the sound.
Definition: SoundInfo.h:94
gnash::BitsReader
BitsReader is used to encapsulate bit-packed buffer reads.
Definition: BitsReader.h:39
gnash::media::AudioDecoderSimple::~AudioDecoderSimple
~AudioDecoderSimple()
Definition: AudioDecoderSimple.cpp:308
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::media::AudioDecoder
Audio decoding base class.
Definition: AudioDecoder.h:36
gnash::media::AudioDecoderSimple::AudioDecoderSimple
AudioDecoderSimple(const AudioInfo &info)
Definition: AudioDecoderSimple.cpp:281
gnash::media::AUDIO_CODEC_UNCOMPRESSED
@ AUDIO_CODEC_UNCOMPRESSED
Linear PCM, strictly little-endian.
Definition: MediaParser.h:167
IF_VERBOSE_MALFORMED_SWF
#define IF_VERBOSE_MALFORMED_SWF(x)
Definition: log.h:404
gnash::media::AUDIO_CODEC_RAW
@ AUDIO_CODEC_RAW
Signed Linear PCM, unspecified byte order.
Definition: MediaParser.h:135
gnash::media::AudioResampler::convert_raw_data
static void convert_raw_data(std::int16_t **adjusted_data, int *adjusted_size, void *data, int sample_count, int sample_size, int sample_rate, bool stereo, int m_sample_rate, bool m_stereo)
VERY crude sample-rate and stereo conversion.
Definition: AudioResampler.cpp:29
gnash::media::audioCodecType
audioCodecType
Audio codec ids as defined in flash.
Definition: MediaParser.h:123
BitsReader.h
gnash::media::SoundInfo::isStereo
bool isStereo() const
Returns the stereo status of the sound.
Definition: SoundInfo.h:89
MediaParser.h
gnash::media::CODEC_TYPE_FLASH
@ CODEC_TYPE_FLASH
The internal flash codec ids.
Definition: MediaParser.h:68
GnashNumeric.h
gnash::media::AudioInfo
Information about an audio stream.
Definition: MediaParser.h:237
log.h
gnash::key::c
@ c
Definition: GnashKey.h:149
gnash::log_unimpl
void log_unimpl(StringType msg, Args... args)
Definition: log.h:289
gnash::media::SoundInfo::getFormat
audioCodecType getFormat() const
Returns the format of the sound.
Definition: SoundInfo.h:84
gnash::media::AudioDecoderSimple::decode
std::uint8_t * decode(const std::uint8_t *input, std::uint32_t inputSize, std::uint32_t &outputSize, std::uint32_t &decodedBytes)
Decodes a frame and returns a pointer to the data.
Definition: AudioDecoderSimple.cpp:367
gnash::key::u
@ u
Definition: GnashKey.h:167
gnash::MediaException
An exception from MediaHandler subsystem.
Definition: GnashException.h:50
data
SimpleBuffer data
Definition: LocalConnection_as.cpp:151
gnash::media::SoundInfo::is16bit
bool is16bit() const
Returns the 16bit status of the sound.
Definition: SoundInfo.h:114