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(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
gnash::geometry::SnappingRanges2d< std::int32_t >
gnash::Video::add_invalidated_bounds
void add_invalidated_bounds(InvalidatedRanges &ranges, bool force)
Add the DisplayObject's invalidated bounds to the given ranges list.
Definition: Video.cpp:206
gnash::SWF::DefineVideoStreamTag
Definition: DefineVideoStreamTag.h:44
gnash::as_object
The base class for all ActionScript objects.
Definition: as_object.h:162
as_object.h
gnash::DisplayObject::MaskRenderer
Render a dynamic mask for a specified DisplayObject.
Definition: DisplayObject.h:969
gnash::SWFRect::getRange
geometry::Range2d< std::int32_t > getRange() const
Construct and return a Range2d object.
Definition: SWFRect.h:222
gnash::NetStream_as::playbackState
PlayHead::PlaybackStatus playbackState() const
Definition: NetStream_as.h:196
gnash::log_debug
void log_debug(StringType msg, Args... args)
Definition: log.h:301
y
std::int32_t y
Definition: BitmapData_as.cpp:435
gnash::DisplayObject::pointInBounds
bool pointInBounds(std::int32_t x, std::int32_t y) const
Return true if the given point falls in this DisplayObject's bounds.
Definition: DisplayObject.h:488
LOG_ONCE
#define LOG_ONCE(x)
Definition: log.h:49
Video.h
_
#define _(String)
Definition: log.h:44
Renderer.h
MediaHandler.h
Transform.h
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::NetStream_as::setInvalidatedVideo
void setInvalidatedVideo(DisplayObject *ch)
Register the DisplayObject to invalidate on video updates.
Definition: NetStream_as.h:309
gnash::image::GnashImage
Base class for different types of bitmaps.
Definition: GnashImage.h:78
gnash::getWorldMatrix
SWFMatrix getWorldMatrix(const DisplayObject &d, bool includeRoot=true)
Get concatenated SWFMatrix (all ancestor transforms and our SWFMatrix)
Definition: DisplayObject.h:1131
gnash::Renderer
Base class for render handlers.
Definition: Renderer.h:189
gnash::media::VideoInfo
Information about a video stream.
Definition: MediaParser.h:323
gnash::DisplayObject::m_old_invalidated_ranges
InvalidatedRanges m_old_invalidated_ranges
Bounds of this DisplayObject instance before first invalidation since last call to clear_invalidated(...
Definition: DisplayObject.h:1029
gnash::Video::getBounds
virtual SWFRect getBounds() const
Definition: Video.cpp:228
gnash::DisplayObject::saveOriginalTarget
void saveOriginalTarget()
Definition: DisplayObject.h:991
gnash::Video::width
int width() const
Get the width of the video.
Definition: Video.cpp:78
gnash::Video::smoothing
bool smoothing() const
Whether this Video object should request smoothing when scaled.
Definition: Video.h:95
gnash::DisplayObject::transform
const Transform & transform() const
Definition: DisplayObject.h:292
gnash::DisplayObject::getTarget
std::string DSOEXPORT getTarget() const
Return full path to this object, in dot notation.
Definition: DisplayObject.cpp:621
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::Video::markOwnResources
virtual void markOwnResources() const
Mark video-specific reachable resources.
Definition: Video.cpp:238
NetStream_as.h
gnash::media::MediaHandler
The MediaHandler class acts as a factory to provide parser and decoders.
Definition: MediaHandler.h:70
gnash::Video::~Video
~Video()
Definition: Video.cpp:73
gnash::SWFRect
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:45
gnash::NetStream_as::videoWidth
int videoWidth() const
Get the real width of the video in pixels if the decoder exists.
Definition: NetStream_as.cpp:1200
gnash::Video::pointInShape
virtual bool pointInShape(std::int32_t x, std::int32_t y) const
Return true if the given point falls in this DisplayObject's shape.
Definition: Video.h:58
gnash::getRunResources
const RunResources & getRunResources(const as_object &o)
Get the RunResources from an as_object.
Definition: as_object.cpp:1142
gnash::Video::display
virtual void display(Renderer &renderer, const Transform &xform)
Render the DisplayObject.
Definition: Video.cpp:103
gnash::Video
VideoStream ActionScript object.
Definition: Video.h:50
gnash::Video::setSmoothing
void setSmoothing(bool b)
Set whether smoothing is required.
Definition: Video.h:98
gnash::Renderer::drawVideoFrame
virtual void drawVideoFrame(image::GnashImage *frame, const Transform &xform, const SWFRect *bounds, bool smooth)=0
Draws a video frame.
gnash::key::_1
@ _1
Definition: GnashKey.h:95
VideoDecoder.h
gnash::DisplayObject::set_invalidated
void set_invalidated()
This function marks the DisplayObject as being modified in aspect and keeps track of current invalida...
Definition: DisplayObject.cpp:183
gnash::RunResources::mediaHandler
media::MediaHandler * mediaHandler() const
Definition: RunResources.h:104
gnash::NetStream_as
NetStream_as ActionScript class.
Definition: NetStream_as.h:182
gnash::Video::setStream
void setStream(NetStream_as *ns)
Set the input stream for this video.
Definition: Video.cpp:221
VM.h
gnash::NetStream_as::get_video
std::unique_ptr< image::GnashImage > get_video()
Returns the video frame closest to current cursor. See time().
Definition: NetStream_as.cpp:203
gnash::Video::height
int height() const
Get the height of the video.
Definition: Video.cpp:85
DisplayObject.h
gnash::DisplayObject::clear_invalidated
void clear_invalidated()
Definition: DisplayObject.h:720
gnash::DisplayObject::parent
DisplayObject * parent() const
Return the parent of this DisplayObject, or NULL if the DisplayObject has no parent.
Definition: DisplayObject.h:252
gnash::geometry::SnappingRanges2d::add
void add(const RangeType &range)
Add a Range to the set, merging when possible and appropriate.
Definition: snappingrange.h:250
gnash::getRoot
movie_root & getRoot(const as_environment &env)
Definition: as_environment.cpp:645
gnash::media::MediaHandler::createVideoDecoder
virtual std::unique_ptr< VideoDecoder > createVideoDecoder(const VideoInfo &info)=0
Create a VideoDecoder for decoding what's specified in the VideoInfo.
gnash::NetStream_as::videoHeight
int videoHeight() const
Get the real height of the video in pixels if the decoder exists.
Definition: NetStream_as.cpp:1193
RunResources.h
gnash::Video::construct
virtual void construct(as_object *init=nullptr)
Register this video instance as a live DisplayObject.
Definition: Video.cpp:199
gnash::ActiveRelay::setReachable
virtual void setReachable()
Mark any other reachable resources, and finally mark our owner.
Definition: Relay.cpp:36
DefineVideoStreamTag.h
gnash::Video::Video
Video(as_object *object, const SWF::DefineVideoStreamTag *def, DisplayObject *parent)
Definition: Video.cpp:41
gnash::PlayHead::PLAY_PAUSED
@ PLAY_PAUSED
Definition: PlayHead.h:41
gnash::Video::clear
void clear()
Definition: Video.cpp:92
gnash::DisplayObject
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:169
gnash::DisplayObject::get_ratio
std::uint16_t get_ratio() const
Definition: DisplayObject.h:360
gnash::Transform
The Transform class expresses a stage in a cumulative transformation.
Definition: Transform.h:34
gnash::key::SWF
@ SWF
Definition: GnashKey.h:331
gnash::media::VideoDecoder::push
virtual void push(const EncodedVideoFrame &buffer)=0
Push an encoded video frame into the decoder.
gnash::DisplayObject::invalidated
bool invalidated() const
Return whether this DisplayObject has been invalidated or not.
Definition: DisplayObject.h:657
x
std::int32_t x
Definition: BitmapData_as.cpp:434
gnash::MediaException
An exception from MediaHandler subsystem.
Definition: GnashException.h:50
gnash::key::b
@ b
Definition: GnashKey.h:148
gnash::SWFRect::expand_to_transformed_rect
DSOEXPORT void expand_to_transformed_rect(const SWFMatrix &m, const SWFRect &r)
Definition: SWFRect.cpp:74
gnash::key::e
@ e
Definition: GnashKey.h:151