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

DefineVideoStreamTag.h

Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
00003 //   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_SWF_DEFINEVIDEOSTREAMTAG_H
00020 #define GNASH_SWF_DEFINEVIDEOSTREAMTAG_H
00021 
00022 #include "DefinitionTag.h"
00023 #include "SWF.h"
00024 #include "SWFRect.h" // for composition
00025 #include "MediaParser.h" // for videoFrameType and videoCodecType enums
00026 
00027 #include <boost/shared_array.hpp>
00028 #include <boost/thread/mutex.hpp>
00029 
00030 #include <memory> // for composition (auto_ptr)
00031 #include <vector> // for composition
00032 
00033 // Forward declarations
00034 namespace gnash {
00035     class movie_definition;
00036     class SWFStream;
00037     class RunResources;
00038 }
00039 
00040 namespace gnash {
00041 
00044 class VideoData
00045 {
00046 public:
00047         VideoData(boost::shared_array<boost::uint8_t> data, boost::uint32_t size,
00048             media::videoFrameType ft)
00049                 :
00050                 videoData(data),
00051                 dataSize(size),
00052                 frameType(ft)
00053         {
00054         }
00055 
00056         ~VideoData()
00057         {
00058         }
00059 
00060         boost::shared_array<boost::uint8_t> videoData;
00061         boost::uint32_t dataSize;
00062         media::videoFrameType frameType;
00063 };
00064 
00065 namespace SWF {
00066 
00067 class DefineVideoStreamTag : public DefinitionTag
00068 {
00069 public:
00070         
00073         //
00077         typedef std::vector<media::EncodedVideoFrame*> EmbeddedFrames;
00078 
00079         ~DefineVideoStreamTag();
00080 
00081         DisplayObject* createDisplayObject(Global_as& gl, DisplayObject* parent)
00082         const;
00083 
00085         //
00091         static void loader(SWFStream& in, SWF::TagType tag, movie_definition& m,
00092             const RunResources& r);
00093 
00094 
00096         //
00102         void readDefineVideoFrame(SWFStream& in, SWF::TagType tag,
00103             movie_definition& m);
00104 
00106         const SWFRect&  bounds() const
00107         {
00108                 return m_bound;
00109         }
00110 
00112         //
00116         media::VideoInfo* getVideoInfo() const { return _videoInfo.get(); }
00117 
00119         //
00134         void getEncodedFrameSlice(boost::uint32_t from, boost::uint32_t to,
00135                 std::vector<media::EncodedVideoFrame*>& ret) const;
00136 
00137     
00138     void addVideoFrameTag(std::auto_ptr<media::EncodedVideoFrame> frame);
00139 
00140 private:
00141 
00143         //
00149         DefineVideoStreamTag(SWFStream& in, boost::uint16_t id);
00150 
00151         void read(SWFStream& in);
00152 
00154         boost::uint8_t m_reserved_flags;
00155 
00157         boost::uint8_t m_deblocking_flags;
00158 
00160         bool m_smoothing_flags;
00161 
00163         //boost::uint16_t m_start_frame;
00164 
00168         boost::uint16_t m_num_frames;
00169 
00171         //
00178         media::videoCodecType m_codec_id;
00179 
00181         SWFRect m_bound;
00182 
00183     // Mutable for locking in const member functions.
00184         mutable boost::mutex _video_mutex;
00185         
00186         EmbeddedFrames _video_frames;
00187 
00189         boost::uint32_t _width;
00190 
00192         boost::uint32_t _height;
00193 
00195         //
00198         std::auto_ptr<media::VideoInfo> _videoInfo;
00199 
00200 };
00201 
00202 } // namespace SWF
00203 } // namespace gnash
00204 
00205 
00206 #endif // GNASH_VIDEO_STREAM_DEF_H

Generated on Thu Sep 30 2010 14:34:57 for Gnash by  doxygen 1.7.1