Gnash  0.8.10
Video.h
Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
00003 //   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_VIDEO_H
00020 #define GNASH_VIDEO_H
00021 
00022 #include <boost/intrusive_ptr.hpp>
00023 #include "DisplayObject.h"
00024 
00025 // Forward declarations
00026 namespace gnash {
00027         class NetStream_as;
00028     class as_object;
00029     namespace image {
00030         class GnashImage;
00031     }
00032     struct ObjectURI;
00033     namespace SWF {
00034         class DefineVideoStreamTag;
00035     }
00036     namespace media {
00037         class VideoDecoder;
00038     }
00039 }
00040 
00041 namespace gnash {
00042 
00044 //
00049 class Video : public DisplayObject
00050 {
00051 public:
00052         
00053         Video(as_object* object, const SWF::DefineVideoStreamTag* def,
00054             DisplayObject* parent);
00055 
00056         ~Video();
00057 
00058         virtual bool pointInShape(boost::int32_t x, boost::int32_t y) const
00059         {
00060                 // video DisplayObject shape is always a rectangle..
00061                 return pointInBounds(x, y);
00062         }
00063 
00064         virtual SWFRect getBounds() const;
00065 
00067         virtual void construct(as_object* init = 0);
00068 
00069         virtual void display(Renderer& renderer, const Transform& xform);
00070 
00071         void add_invalidated_bounds(InvalidatedRanges& ranges, bool force);
00072 
00074         void setStream(NetStream_as* ns);
00075 
00076     void clear();
00077 
00079     //
00084     int height() const;
00085 
00087     //
00092     int width() const;
00093 
00095     bool smoothing() const { return _smoothing; }
00096 
00098     void setSmoothing(bool b) { _smoothing = b; }
00099 
00100 protected:
00101     
00103         //
00107         virtual void markOwnResources() const;
00108 
00109 private:
00110 
00112     image::GnashImage* getVideoFrame();
00113 
00114         const boost::intrusive_ptr<const SWF::DefineVideoStreamTag> m_def;
00115 
00116     // Who owns this ? Should it be an intrusive ptr ?
00117         NetStream_as* _ns;
00118 
00120         bool _embeddedStream;
00121 
00123         boost::int32_t _lastDecodedVideoFrameNum;
00124 
00126         std::auto_ptr<image::GnashImage> _lastDecodedVideoFrame;
00127 
00129     //
00133     std::auto_ptr<media::VideoDecoder> _decoder;
00134 
00136     bool _smoothing;
00137 };
00138 
00139 } // namespace gnash
00140 
00141 #endif