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 "Movie.h" // for inheritance
26 #include "SWFMovieDefinition.h" // for dtor visibility by smart ptr
27 
28 #include <boost/intrusive_ptr.hpp>
29 #include <string>
30 #include <map>
31 
32 // Forward declarations
33 namespace gnash {
34  class DisplayObject;
35 }
36 
37 namespace gnash
38 {
39 
41 //
43 //
49 class SWFMovie : public Movie
50 {
51 
53  typedef std::map<boost::uint16_t, bool> Characters;
54 
55 public:
56 
57  SWFMovie(as_object* object, const SWFMovieDefinition* def,
59 
60  virtual ~SWFMovie() {}
61 
62  virtual void advance();
63 
64  virtual float frameRate() const {
65  return _def->get_frame_rate();
66  }
67 
68  virtual size_t widthPixels() const {
69  return _def->get_width_pixels();
70  }
71 
72  virtual size_t heightPixels() const {
73  return _def->get_height_pixels();
74  }
75 
76  virtual bool ensureFrameLoaded(size_t frameNo) const {
77  return _def->ensure_frame_loaded(frameNo);
78  }
79 
81  //
86  void construct(as_object* init = 0);
87 
89  const std::string& url() const {
90  return _def->get_url();
91  }
92 
94  //
96  int version() const {
97  return _def->get_version();
98  }
99 
101  //
104  //
108  virtual SWF::DefinitionTag* exportedCharacter(const std::string& symbol);
109 
111  //
115  //
119  void addCharacter(boost::uint16_t id);
120 
122  //
125  //
132  bool initializeCharacter(boost::uint16_t id);
133 
134  const movie_definition* definition() const {
135  return _def.get();
136  }
137 
138 private:
139 
141  Characters _characters;
142 
144  const boost::intrusive_ptr<const SWFMovieDefinition> _def;
145 };
146 
147 
148 } // end of namespace gnash
149 
150 #endif // GNASH_MOVIE_INSTANCE_H