Gnash  0.8.11dev
Video.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef GNASH_VIDEO_H
20 #define GNASH_VIDEO_H
21 
22 #include <boost/intrusive_ptr.hpp>
23 #include "DisplayObject.h"
24 
25 // Forward declarations
26 namespace gnash {
27  class NetStream_as;
28  class as_object;
29  namespace image {
30  class GnashImage;
31  }
32  struct ObjectURI;
33  namespace SWF {
34  class DefineVideoStreamTag;
35  }
36  namespace media {
37  class VideoDecoder;
38  }
39 }
40 
41 namespace gnash {
42 
44 //
49 class Video : public DisplayObject
50 {
51 public:
52 
53  Video(as_object* object, const SWF::DefineVideoStreamTag* def,
55 
56  ~Video();
57 
58  virtual bool pointInShape(boost::int32_t x, boost::int32_t y) const
59  {
60  // video DisplayObject shape is always a rectangle..
61  return pointInBounds(x, y);
62  }
63 
64  virtual SWFRect getBounds() const;
65 
67  virtual void construct(as_object* init = 0);
68 
69  virtual void display(Renderer& renderer, const Transform& xform);
70 
71  void add_invalidated_bounds(InvalidatedRanges& ranges, bool force);
72 
74  void setStream(NetStream_as* ns);
75 
76  void clear();
77 
79  //
84  int height() const;
85 
87  //
92  int width() const;
93 
95  bool smoothing() const { return _smoothing; }
96 
98  void setSmoothing(bool b) { _smoothing = b; }
99 
100 protected:
101 
103  //
107  virtual void markOwnResources() const;
108 
109 private:
110 
112  image::GnashImage* getVideoFrame();
113 
114  const boost::intrusive_ptr<const SWF::DefineVideoStreamTag> m_def;
115 
116  // Who owns this ? Should it be an intrusive ptr ?
117  NetStream_as* _ns;
118 
120  bool _embeddedStream;
121 
123  boost::int32_t _lastDecodedVideoFrameNum;
124 
126  std::auto_ptr<image::GnashImage> _lastDecodedVideoFrame;
127 
129  //
133  std::auto_ptr<media::VideoDecoder> _decoder;
134 
136  bool _smoothing;
137 };
138 
139 } // namespace gnash
140 
141 #endif