AudioDecoderGst.h

Go to the documentation of this file.
00001 // AudioDecoderGst.h: Audio decoding using Gstreamer.
00002 // 
00003 //   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
00004 // 
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 // $Id: AudioDecoderGst_8h-source.html,v 1.1 2008/03/07 02:36:16 bjacques Exp $
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* /*input*/, boost::uint32_t /*inputSize*/, boost::uint32_t& /*outputSize*/, boost::uint32_t& /*decodedData*/, bool /*parse*/);
00050 
00051         static void callback_handoff (GstElement * /*c*/, GstBuffer *buffer, GstPad* /*pad*/, gpointer user_data);
00052         static void callback_output (GstElement * /*c*/, GstBuffer *buffer, GstPad* /*pad*/, gpointer user_data);
00053 private:
00054 
00055         // gstreamer pipeline objects
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 } // media namespace
00092 } // gnash namespace
00093 
00094 #endif // __AUDIODECODERGST_H__
00095 

Generated on Thu Mar 6 18:25:06 2008 for Gnash by  doxygen 1.5.4