2
// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
4
// This program is free software; you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation; either version 3 of the License, or
7
// (at your option) any later version.
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
14
// You should have received a copy of the GNU General Public License
15
// along with this program; if not, write to the Free Software
16
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef GNASH_VIDEO_STREAM_INSTANCE_H
21
#define GNASH_VIDEO_STREAM_INSTANCE_H
23
#include "character.h" // for inheritance
24
#include "video_stream_def.h"
25
#include "snappingrange.h"
27
// Forward declarations
34
/// VideoStream ActionScript object
36
/// A VideoStream provides audio/video frames either
37
/// embedded into the SWF itself or loaded from the
38
/// network using an associated NetStream object.
40
class video_stream_instance : public character
45
boost::intrusive_ptr<video_stream_definition> m_def;
47
video_stream_instance(video_stream_definition* def,
48
character* parent, int id);
50
~video_stream_instance();
52
virtual bool pointInShape(boost::int32_t x, boost::int32_t y) const
54
// video character shape is always a rectangle..
55
return pointInBounds(x, y);
58
rect getBounds() const;
60
/// We use the call to ::advance to properly set invalidated status
61
virtual void advance();
63
/// Register this video instance as a live character
64
virtual void stagePlacementCallback();
68
// For sure isActionScriptReferenceable...
69
bool wantsInstanceName() const
71
return true; // text fields can be referenced
74
void add_invalidated_bounds(InvalidatedRanges& ranges, bool force);
76
/// Set the input stream for this video
77
void setStream(boost::intrusive_ptr<NetStream> ns);
82
/// Mark video-specific reachable resources and invoke
83
/// the parent's class version (markCharacterReachable)
85
/// video-specific reachable resources are:
86
/// - Associated NetStream if any (_ns)
88
virtual void markReachableResources() const;
89
#endif // GNASH_USE_GC
93
/// Initialize decoder for embedded video
95
/// Call only if given a non-null video definition.
97
void initializeDecoder();
99
/// Get video frame to be displayed
100
image::ImageBase* getVideoFrame();
102
// m_video_source - A Camera object that is capturing video data or a NetStream object.
103
// To drop the connection to the Video object, pass null for source.
104
// FIXME: don't use as_object, but a more meaningful type
105
//as_object* m_video_source;
107
// Who owns this ? Should it be an intrusive ptr ?
108
boost::intrusive_ptr<NetStream> _ns;
110
/// Playing an embbeded video stream ?
111
bool _embeddedStream;
113
/// Last decoded frame number
114
boost::int32_t _lastDecodedVideoFrameNum;
116
/// Last decoded frame
117
std::auto_ptr<image::ImageBase> _lastDecodedVideoFrame;
119
/// The decoder used to decode the video frames
120
std::auto_ptr<media::VideoDecoder> _decoder;
123
void video_class_init(as_object& global);
125
} // end namespace gnash
128
#endif // GNASH_VIDEO_STREAM_INSTANCE_H