Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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"
00025 #include "MediaParser.h"
00026
00027 #include <boost/shared_array.hpp>
00028 #include <boost/thread/mutex.hpp>
00029
00030 #include <memory>
00031 #include <vector>
00032
00033
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
00164
00168 boost::uint16_t m_num_frames;
00169
00171
00178 media::videoCodecType m_codec_id;
00179
00181 SWFRect m_bound;
00182
00183
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 }
00203 }
00204
00205
00206 #endif // GNASH_VIDEO_STREAM_DEF_H