Gnash  0.8.11dev
AudioDecoderGst.h
Go to the documentation of this file.
1 // AudioDecoderGst.h: Audio decoding using Gstreamer.
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 #ifndef GNASH_AUDIODECODERGST_H
21 #define GNASH_AUDIODECODERGST_H
22 
23 #include "log.h"
24 #include "AudioDecoder.h"
25 
26 #include <gst/gst.h>
27 #include "GnashImage.h"
28 
29 #include "swfdec_codec_gst.h"
30 
31 // Forward declarations
32 namespace gnash {
33  namespace media {
34  class AudioInfo;
35  class SoundInfo;
36  }
37 }
38 
39 namespace gnash {
40 namespace media {
41 namespace gst {
42 
45 
46 public:
47  AudioDecoderGst(const AudioInfo& info);
49 
50  ~AudioDecoderGst();
51 
52  std::uint8_t* decode(const std::uint8_t* input, std::uint32_t inputSize,
53  std::uint32_t& outputSize, std::uint32_t& decodedData);
54  std::uint8_t* decode(const EncodedAudioFrame& ef, std::uint32_t& outputSize);
55 
56 private:
57 
58  std::uint8_t* pullBuffers(std::uint32_t& outputSize);
59 
60  void setup(GstCaps* caps);
61 
62  SwfdecGstDecoder _decoder;
63 
64 };
65 
66 } // gnash.media.gst namespace
67 } // media namespace
68 } // gnash namespace
69 
70 #endif // __AUDIODECODERGST_H__
71 
AudioDecoder.h
SoundInfo.h
gnash::media::gst::EncodedExtraGstData::buffer
GstBuffer * buffer
Definition: MediaParserGst.h:75
gnash::media::gst::ExtraInfoGst::caps
GstCaps * caps
Definition: MediaParserGst.h:59
gnash::media::AUDIO_CODEC_ADPCM
@ AUDIO_CODEC_ADPCM
ADPCM format.
Definition: MediaParser.h:148
gnash::media::AudioInfo::sampleRate
std::uint16_t sampleRate
Definition: MediaParser.h:288
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
_
#define _(String)
Definition: log.h:44
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::media::AudioInfo::codec
int codec
Codec identifier.
Definition: MediaParser.h:286
gnash::media::AudioInfo::stereo
bool stereo
Definition: MediaParser.h:293
gnash::media::EncodedAudioFrame::extradata
std::unique_ptr< EncodedExtraData > extradata
Definition: MediaParser.h:461
gnash::media::SoundInfo::getSampleRate
unsigned long getSampleRate() const
Returns the samplerate of the sound.
Definition: SoundInfo.h:94
gnash::media::ExtraAudioInfoFlv
Extra audoi info found in some FLV embedded streams.
Definition: FLVParser.h:76
gnash::media::EncodedAudioFrame
An encoded audio frame.
Definition: MediaParser.h:454
swfdec_gst_decoder_pull
GstBuffer * swfdec_gst_decoder_pull(SwfdecGstDecoder *dec)
Definition: swfdec_codec_gst.c:399
GnashImage.h
gnash::media::ExtraAudioInfoFlv::data
std::unique_ptr< std::uint8_t[]> data
Audio stream header.
Definition: FLVParser.h:97
SwfdecGstDecoder
Definition: swfdec_codec_gst.h:29
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::media::AUDIO_CODEC_MP3
@ AUDIO_CODEC_MP3
MP3 format.
Definition: MediaParser.h:164
gnash::media::AudioDecoder
Audio decoding base class.
Definition: AudioDecoder.h:36
gnash::media::gst::AudioDecoderGst::decode
std::uint8_t * decode(const std::uint8_t *input, std::uint32_t inputSize, std::uint32_t &outputSize, std::uint32_t &decodedData)
Decodes a frame and returns a pointer to the data.
Definition: AudioDecoderGst.cpp:252
swfdec_gst_decoder_push_eos
void swfdec_gst_decoder_push_eos(SwfdecGstDecoder *dec)
Definition: swfdec_codec_gst.c:393
swfdec_gst_decoder_init
gboolean swfdec_gst_decoder_init(SwfdecGstDecoder *dec, GstCaps *srccaps, GstCaps *sinkcaps,...)
Definition: swfdec_codec_gst.c:280
gnash::media::gst::EncodedExtraGstData
Class to hold GstBuffer. Takes ownership.
Definition: MediaParserGst.h:64
gnash::media::gst::AudioDecoderGst::AudioDecoderGst
AudioDecoderGst(const AudioInfo &info)
Definition: AudioDecoderGst.cpp:48
FLVParser.h
gnash::key::type
type
Definition: GnashKey.h:330
gnash::media::gst::ExtraInfoGst
Class to hold extra info found in any stream by the parser.
Definition: MediaParserGst.h:46
MediaParserGst.h
gnash::media::audioCodecType
audioCodecType
Audio codec ids as defined in flash.
Definition: MediaParser.h:123
gnash::media::AUDIO_CODEC_NELLYMOSER
@ AUDIO_CODEC_NELLYMOSER
Proprietary simple format.
Definition: MediaParser.h:181
gnash::media::SoundInfo::isStereo
bool isStereo() const
Returns the stereo status of the sound.
Definition: SoundInfo.h:89
gnash::media::AUDIO_CODEC_AAC
@ AUDIO_CODEC_AAC
Advanced Audio Coding.
Definition: MediaParser.h:184
swfdec_gst_decoder_push
gboolean swfdec_gst_decoder_push(SwfdecGstDecoder *dec, GstBuffer *buffer)
Definition: swfdec_codec_gst.c:365
MediaParser.h
gnash::media::CODEC_TYPE_FLASH
@ CODEC_TYPE_FLASH
The internal flash codec ids.
Definition: MediaParser.h:68
gnash::media::AudioInfo::extra
std::unique_ptr< ExtraInfo > extra
Extra info about audio stream, if when needed.
Definition: MediaParser.h:313
gnash::media::AudioInfo
Information about an audio stream.
Definition: MediaParser.h:237
gst
log.h
AudioDecoderGst.h
gnash::media::ExtraAudioInfoFlv::size
size_t size
Audio stream header size.
Definition: FLVParser.h:100
gnash::media::EncodedAudioFrame::dataSize
std::uint32_t dataSize
Definition: MediaParser.h:456
gnash::media::gst::AudioDecoderGst::~AudioDecoderGst
~AudioDecoderGst()
Definition: AudioDecoderGst.cpp:130
gnash::media::EncodedAudioFrame::data
std::unique_ptr< std::uint8_t[]> data
Definition: MediaParser.h:457
DSOEXPORT
#define DSOEXPORT
Definition: dsodefs.h:55
SwfdecGstDecoder::queue
GQueue * queue
Definition: swfdec_codec_gst.h:33
gnash::media::gst::AudioDecoderGst
GST based AudioDecoder.
Definition: AudioDecoderGst.h:44
swfdec_codec_gst.h
GstUtil.h
gnash::MediaException
An exception from MediaHandler subsystem.
Definition: GnashException.h:50
data
SimpleBuffer data
Definition: LocalConnection_as.cpp:151
gnash::media::AudioInfo::type
codecType type
Definition: MediaParser.h:297
swfdec_gst_decoder_finish
void swfdec_gst_decoder_finish(SwfdecGstDecoder *dec)
Definition: swfdec_codec_gst.c:337
gnash::media::gst::GstUtil::check_missing_plugins
static bool check_missing_plugins(GstCaps *caps)
Check for missing plugins and try to install them if necessary.
Definition: GstUtil.cpp:102