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
virtual SWF::DefinitionTag * exportedCharacter(const std::string &symbol)
Get an exported character definition by its symbol name.
Definition: SWFMovie.cpp:86
virtual size_t widthPixels() const
Definition: SWFMovie.h:69
DSOTEXPORT SWFMovie(as_object *object, const SWFMovieDefinition *def, DisplayObject *parent)
Definition: SWFMovie.cpp:34
Client program&#39;s interface to the definition of a movie or sprite.
Definition: movie_definition.h:95
const movie_definition * definition() const
Definition: SWFMovie.h:135
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:168
virtual float frameRate() const
Definition: SWFMovie.h:65
DisplayObject * parent() const
Return the parent of this DisplayObject, or NULL if the DisplayObject has no parent.
Definition: DisplayObject.h:252
virtual ~SWFMovie()
Definition: SWFMovie.h:61
void construct(as_object *init=nullptr)
Handle a top-level movie on stage placement.
Definition: SWFMovie.cpp:44
A top-level, standalone Movie that can be loaded and played.
Definition: Movie.h:46
virtual bool ensureFrameLoaded(size_t frameNo) const
Definition: SWFMovie.h:77
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
Immutable data representing the definition of a movie display element.
Definition: DefinitionTag.h:47
The base class for all ActionScript objects.
Definition: as_object.h:161
Immutable definition of a SWF movie&#39;s contents.
Definition: SWFMovieDefinition.h:158
bool initializeCharacter(std::uint16_t id)
Attempt to mark a character as initialized.
Definition: SWFMovie.cpp:104
const std::string & url() const
Get the URL of the SWFMovie&#39;s definition.
Definition: SWFMovie.h:90
virtual void advance()
Advance to the next frame of the MovieClip.
Definition: SWFMovie.cpp:65
Stateful Movie object (a special kind of sprite)
Definition: SWFMovie.h:50
int version() const
Get the version of the SWFMovie.
Definition: SWFMovie.h:97
virtual size_t heightPixels() const
Definition: SWFMovie.h:73
#define DSOTEXPORT
Definition: dsodefs.h:63
void addCharacter(std::uint16_t id)
Add a character to the list of known characters.
Definition: SWFMovie.cpp:96