• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

VideoDecoderGst.h

Go to the documentation of this file.
00001 // VideoDecoderGst.h: Video decoding using Gstreamer.
00002 // 
00003 //   Copyright (C) 2007, 2008, 2009, 2010 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 #ifndef GNASH_VIDEODECODERGST_H
00020 #define GNASH_VIDEODECODERGST_H
00021 
00022 #include "GnashImage.h"
00023 #include "log.h"
00024 #include "VideoDecoder.h"
00025 #include "dsodefs.h"
00026 #include "MediaParser.h" // for videoCodecType enum
00027 
00028 #include <gst/gst.h>
00029 
00030 
00031 #include "swfdec_codec_gst.h"
00032 
00033 
00034 namespace gnash {
00035 namespace media {
00036 namespace gst {
00037 
00038 // Convenience wrapper for GstBuffer. Intended to be wrapped in an auto_ptr.
00039 class gnashGstBuffer : public ImageRGB
00040 {
00041 public:
00042   gnashGstBuffer(GstBuffer* buf, int width, int height)
00043   : ImageRGB(NULL, width, height),
00044     _buffer(buf)
00045   {}
00046   
00047   ~gnashGstBuffer()
00048   {
00049     gst_buffer_unref(_buffer);
00050   }
00051   
00052   virtual size_t stride() const {
00053       return (width() * channels() + 3) &~ 3;
00054   }
00055 
00056   virtual iterator begin()
00057   {
00058     return GST_BUFFER_DATA(_buffer);
00059   }
00060 
00061   virtual const_iterator begin() const
00062   {
00063     return GST_BUFFER_DATA(_buffer);
00064   }
00065 
00066 private:
00067   GstBuffer* _buffer;
00068 };
00069 
00070 
00072 class DSOEXPORT VideoDecoderGst : public VideoDecoder
00073 {
00074 public:
00075     VideoDecoderGst(videoCodecType codec_type, int width, int height,
00076                     const boost::uint8_t* extradata, size_t extradatasize);
00077     VideoDecoderGst(GstCaps* caps);
00078     ~VideoDecoderGst();
00079 
00080     void push(const EncodedVideoFrame& buffer);
00081 
00082     std::auto_ptr<GnashImage> pop();
00083   
00084     bool peek();
00085 
00087     //
00089     int width() const;
00090 
00092     //
00094     int height() const;
00095 
00096 private:
00097 
00098     int _width;
00099     int _height;
00100 
00101     void setup(GstCaps* caps);
00102 
00103     VideoDecoderGst();
00104     VideoDecoderGst(const VideoDecoderGst&);
00105 
00106     SwfdecGstDecoder _decoder;
00107 };
00108 
00109 
00110 } // gnash.media.gst namespace
00111 } // namespace media
00112 } // namespace gnash
00113 #endif // __VIDEODECODERGST_H__

Generated on Fri Mar 16 2012 15:46:13 for Gnash by  doxygen 1.7.1