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,
54  DisplayObject* parent);
55 
56  ~Video();
57 
58  virtual bool pointInShape(std::int32_t x, std::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 = nullptr);
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  std::int32_t _lastDecodedVideoFrameNum;
124 
126  std::unique_ptr<image::GnashImage> _lastDecodedVideoFrame;
127 
129  //
133  std::unique_ptr<media::VideoDecoder> _decoder;
134 
136  bool _smoothing;
137 };
138 
139 } // namespace gnash
140 
141 #endif
NetStream_as ActionScript class.
Definition: NetStream_as.h:181
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:168
bool smoothing() const
Whether this Video object should request smoothing when scaled.
Definition: Video.h:95
virtual bool pointInShape(std::int32_t x, std::int32_t y) const
Return true if the given point falls in this DisplayObject&#39;s shape.
Definition: Video.h:58
void clear()
Clean up the font library.
Definition: fontlib.cpp:36
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
Definition: klash_part.cpp:329
The base class for all ActionScript objects.
Definition: as_object.h:161
Base class for render handlers.
Definition: Renderer.h:188
Definition: klash_part.cpp:329
std::int32_t x
Definition: BitmapData_as.cpp:434
Definition: GnashKey.h:148
Definition: DefineVideoStreamTag.h:43
VideoStream ActionScript object.
Definition: Video.h:49
std::int32_t y
Definition: BitmapData_as.cpp:435
Base class for different types of bitmaps.
Definition: GnashImage.h:77
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:44
Definition: GnashKey.h:331
void setSmoothing(bool b)
Set whether smoothing is required.
Definition: Video.h:98
The Transform class expresses a stage in a cumulative transformation.
Definition: Transform.h:33