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

VideoDecoderFfmpeg.h

Go to the documentation of this file.
00001 // VideoDecoderFfmpeg.h: Video decoding using the FFMPEG library.
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_VIDEODECODERFFMPEG_H
00020 #define GNASH_VIDEODECODERFFMPEG_H
00021 
00022 #ifdef HAVE_CONFIG_H
00023 #include "gnashconfig.h"
00024 #endif
00025 
00026 #include <vector>
00027 #include <memory>
00028 #include "dsodefs.h" //For DSOEXPORT
00029 #include "log.h"
00030 #include "VideoDecoder.h"
00031 #include "MediaParser.h" // for videoCodecType enum
00032 #include "ffmpegHeaders.h"
00033 
00034 namespace gnash {
00035 namespace media {
00036 namespace ffmpeg {
00037 
00038 // Forward declarations
00039 class CodecContextWrapper;
00040 #ifdef HAVE_SWSCALE_H
00041 class SwsContextWrapper;
00042 #endif
00043 
00044 
00046 class VideoDecoderFfmpeg : public VideoDecoder {
00047     
00048 public:
00049 
00050     DSOEXPORT VideoDecoderFfmpeg(videoCodecType format, int width, int height);
00051 
00052     DSOEXPORT VideoDecoderFfmpeg(const VideoInfo& info);
00053 
00054     DSOEXPORT ~VideoDecoderFfmpeg();
00055     
00056     void push(const EncodedVideoFrame& buffer);
00057 
00058     std::auto_ptr<GnashImage> pop();
00059     
00060     bool peek();
00061 
00062     int width() const;
00063 
00064     int height() const;
00065     
00066 private:
00067     
00069     //
00072     static CodecID flashToFfmpegCodec(videoCodecType format);
00073 
00083     std::auto_ptr<GnashImage> frameToImage(AVCodecContext* srcCtx,
00084             const AVFrame& srcFrame);
00085 
00086     void init(enum CodecID format, int width, int height,
00087             boost::uint8_t* extradata=0, int extradataSize=0);
00088 
00089     std::auto_ptr<GnashImage> decode(const boost::uint8_t* input,
00090             boost::uint32_t input_size);
00091 
00092     std::auto_ptr<GnashImage> decode(const EncodedVideoFrame* vf)
00093     {
00094         return decode(vf->data(), vf->dataSize());
00095     }
00096 
00097     AVCodec* _videoCodec;
00098     std::auto_ptr<CodecContextWrapper> _videoCodecCtx;
00099 
00100 #if HAVE_SWSCALE_H
00101 
00102     //
00107     std::auto_ptr<SwsContextWrapper> _swsContext;
00108 #endif
00109 
00110     std::vector<const EncodedVideoFrame*> _video_frames;
00111 };
00112     
00113 } // gnash.media.ffmpeg namespace 
00114 } // gnash.media namespace 
00115 } // gnash namespace
00116 
00117 #endif // __VIDEODECODERFFMPEG_H__

Generated on Thu Sep 30 2010 14:35:04 for Gnash by  doxygen 1.7.1