00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __AUDIODECODERGST_H__
00022 #define __AUDIODECODERGST_H__
00023
00024 #ifdef HAVE_CONFIG_H
00025 #include "gnashconfig.h"
00026 #endif
00027
00028 #include "log.h"
00029 #include "AudioDecoder.h"
00030
00031 #include <gst/gst.h>
00032 #include "image.h"
00033 #include <boost/thread/thread.hpp>
00034 #include <boost/bind.hpp>
00035 #include <boost/thread/mutex.hpp>
00036
00037 namespace gnash {
00038 namespace media {
00039
00041 class AudioDecoderGst : public AudioDecoder {
00042
00043 public:
00044 AudioDecoderGst();
00045 ~AudioDecoderGst();
00046
00047 bool setup(AudioInfo* info);
00048
00049 boost::uint8_t* decode(boost::uint8_t* , boost::uint32_t , boost::uint32_t& , boost::uint32_t& , bool );
00050
00051 static void callback_handoff (GstElement * , GstBuffer *buffer, GstPad* , gpointer user_data);
00052 static void callback_output (GstElement * , GstBuffer *buffer, GstPad* , gpointer user_data);
00053 private:
00054
00055
00056
00058 GstElement* _pipeline;
00059
00061 GstElement* _input;
00062 GstElement* _inputcaps;
00063 GstElement* _outputcaps;
00064 GstElement* _output;
00065 GstElement* _decoder;
00066 GstElement* _resampler;
00067 GstElement* _converter;
00068
00070 boost::mutex input_mutex;
00071 boost::mutex output_mutex;
00072 boost::mutex::scoped_lock* input_lock;
00073 boost::mutex::scoped_lock* output_lock;
00074
00076 bool _stereo;
00077 boost::uint32_t _sampleRate;
00078 audioCodecType _format;
00079
00081 volatile bool _stop;
00082
00083 boost::uint32_t _undecodedDataSize;
00084 boost::uint8_t* _undecodedData;
00085
00086 boost::uint32_t _decodedDataSize;
00087 boost::uint8_t* _decodedData;
00088
00089 };
00090
00091 }
00092 }
00093
00094 #endif // __AUDIODECODERGST_H__
00095