Gnash  0.8.11dev
SWFMovie.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 // Stateful live Movie instance
20 
21 
22 #ifndef GNASH_SWF_MOVIE_H
23 #define GNASH_SWF_MOVIE_H
24 
25 #include <boost/intrusive_ptr.hpp>
26 #include <string>
27 #include <map>
28 
29 #include "Movie.h" // for inheritance
30 #include "SWFMovieDefinition.h" // for dtor visibility by smart ptr
31 #include "dsodefs.h" // for DSOTEXPORT
32 
33 // Forward declarations
34 namespace gnash {
35  class DisplayObject;
36 }
37 
38 namespace gnash
39 {
40 
42 //
44 //
50 class SWFMovie : public Movie
51 {
52 
54  typedef std::map<std::uint16_t, bool> Characters;
55 
56 public:
57 
58  DSOTEXPORT SWFMovie(as_object* object, const SWFMovieDefinition* def,
60 
61  virtual ~SWFMovie() {}
62 
63  virtual void advance();
64 
65  virtual float frameRate() const {
66  return _def->get_frame_rate();
67  }
68 
69  virtual size_t widthPixels() const {
70  return _def->get_width_pixels();
71  }
72 
73  virtual size_t heightPixels() const {
74  return _def->get_height_pixels();
75  }
76 
77  virtual bool ensureFrameLoaded(size_t frameNo) const {
78  return _def->ensure_frame_loaded(frameNo);
79  }
80 
82  //
87  void construct(as_object* init = nullptr);
88 
90  const std::string& url() const {
91  return _def->get_url();
92  }
93 
95  //
97  int version() const {
98  return _def->get_version();
99  }
100 
102  //
105  //
109  virtual SWF::DefinitionTag* exportedCharacter(const std::string& symbol);
110 
112  //
116  //
120  void addCharacter(std::uint16_t id);
121 
123  //
126  //
133  bool initializeCharacter(std::uint16_t id);
134 
135  const movie_definition* definition() const {
136  return _def.get();
137  }
138 
139 private:
140 
142  Characters _characters;
143 
145  const boost::intrusive_ptr<const SWFMovieDefinition> _def;
146 };
147 
148 
149 } // end of namespace gnash
150 
151 #endif // GNASH_MOVIE_INSTANCE_H
gnash::MovieClip::construct
virtual void construct(as_object *initObj=nullptr)
Handle placement event.
Definition: MovieClip.cpp:1711
gnash::MovieClip::get_frame_count
size_t get_frame_count() const
Definition: MovieClip.h:166
Movie.h
movie_root.h
gnash::log_swferror
void log_swferror(StringType msg, Args... args)
Definition: log.h:325
gnash::as_object
The base class for all ActionScript objects.
Definition: as_object.h:162
dsodefs.h
gnash::SWF::DefinitionTag
Immutable data representing the definition of a movie display element.
Definition: DefinitionTag.h:48
gnash::SWFMovie::initializeCharacter
bool initializeCharacter(std::uint16_t id)
Attempt to mark a character as initialized.
Definition: SWFMovie.cpp:104
_
#define _(String)
Definition: log.h:44
gnash::SWFMovieDefinition
Immutable definition of a SWF movie's contents.
Definition: SWFMovieDefinition.h:159
SWFMovie.h
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::SWFMovie::advance
virtual void advance()
Advance to the next frame of the MovieClip.
Definition: SWFMovie.cpp:65
gnash::SWFMovie::url
const std::string & url() const
Get the URL of the SWFMovie's definition.
Definition: SWFMovie.h:90
gnash::DisplayObject::saveOriginalTarget
void saveOriginalTarget()
Definition: DisplayObject.h:991
gnash::SWFMovie::SWFMovie
DSOTEXPORT SWFMovie(as_object *object, const SWFMovieDefinition *def, DisplayObject *parent)
Definition: SWFMovie.cpp:34
gnash::movie_definition
Client program's interface to the definition of a movie or sprite.
Definition: movie_definition.h:96
gnash::SWFMovie::definition
const movie_definition * definition() const
Definition: SWFMovie.h:135
IF_VERBOSE_MALFORMED_SWF
#define IF_VERBOSE_MALFORMED_SWF(x)
Definition: log.h:404
gnash::SWFMovie::~SWFMovie
virtual ~SWFMovie()
Definition: SWFMovie.h:61
gnash::SWFMovie::construct
void construct(as_object *init=nullptr)
Handle a top-level movie on stage placement.
Definition: SWFMovie.cpp:44
gnash::SWFMovie::ensureFrameLoaded
virtual bool ensureFrameLoaded(size_t frameNo) const
Definition: SWFMovie.h:77
gnash::MovieClip::get_current_frame
size_t get_current_frame() const
Return 0-based index to current frame.
Definition: MovieClip.h:161
gnash::Movie
A top-level, standalone Movie that can be loaded and played.
Definition: Movie.h:47
SWFMovieDefinition.h
gnash::SWFMovie::heightPixels
virtual size_t heightPixels() const
Definition: SWFMovie.h:73
log.h
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::SWFMovie
Stateful Movie object (a special kind of sprite)
Definition: SWFMovie.h:51
DSOTEXPORT
#define DSOTEXPORT
Definition: dsodefs.h:63
movie_definition.h
gnash::DisplayObject
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:169
gnash::SWFMovie::version
int version() const
Get the version of the SWFMovie.
Definition: SWFMovie.h:97
gnash::SWFMovie::frameRate
virtual float frameRate() const
Definition: SWFMovie.h:65
gnash::SWFMovie::exportedCharacter
virtual SWF::DefinitionTag * exportedCharacter(const std::string &symbol)
Get an exported character definition by its symbol name.
Definition: SWFMovie.cpp:86
gnash::SWFMovie::widthPixels
virtual size_t widthPixels() const
Definition: SWFMovie.h:69
gnash::MovieClip::advance
virtual void advance()
Advance to the next frame of the MovieClip.
Definition: MovieClip.cpp:869
gnash::SWFMovie::addCharacter
void addCharacter(std::uint16_t id)
Add a character to the list of known characters.
Definition: SWFMovie.cpp:96