big merge from master, fix rpm creation, drop fetching swfdec
[gnash.git] / libcore / Movie.h
blob8f1205f35b7317bc07e26cf18310b89d096bc724
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 // 2011 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
19 // Stateful live Movie instance
22 #ifndef GNASH_MOVIE_H
23 #define GNASH_MOVIE_H
25 #include <string>
26 #include <set>
28 #include "MovieClip.h" // for inheritance
30 // Forward declarations
31 namespace gnash {
32 class DisplayObject;
33 class movie_definition;
36 namespace gnash
39 /// A top-level, standalone Movie that can be loaded and played.
41 /// This is an abstract interface for any Movie that can be loaded directly
42 /// into Gnash, including SWFs and Bitmaps.
44 /// The interface is not especially clean because SWFs and Bitmaps are
45 /// treated the same as top-level movies despite having almost nothing
46 /// in common. As this is required by Flash, it seems unavoidable.
47 class Movie : public MovieClip
50 public:
52 Movie(as_object* object, const movie_definition* def,
53 DisplayObject* parent)
55 MovieClip(object, def, this, parent)
58 virtual ~Movie() {}
60 virtual void advance() = 0;
62 virtual float frameRate() const = 0;
64 virtual size_t widthPixels() const = 0;
66 virtual size_t heightPixels() const = 0;
68 virtual bool ensureFrameLoaded(size_t /*frameNo*/) const {
69 return true;
72 /// Get the URL the Movie was loaded from.
73 virtual const std::string& url() const = 0;
75 /// Get the version of the Movie
77 /// @return Either the version of the Movie or -1 if the Movie is of
78 /// a type that has no version.
79 virtual int version() const = 0;
81 /// Get an exported character definition by its symbol name.
83 /// The character is only available after the ExportAssets tag has been
84 /// executed.
86 /// @param symbol The exported symbol of the character to retrieve.
87 /// @return The DefinitionTag of the requested character or 0
88 /// if the character has not yet been exported.
89 virtual SWF::DefinitionTag* exportedCharacter(const std::string& /*s*/) {
90 return 0;
93 /// Add a character to the list of known characters
95 /// This makes the character known to ActionScript for initialization.
96 /// Exported characters must both be in the definition's list of exports
97 /// and added with this function before they are available.
98 virtual void addCharacter(boost::uint16_t /*id*/) {}
100 /// Attempt to mark a character as initialized.
102 /// The default is to return false. Only a SWFMovie can have a list of
103 /// characters.
104 virtual bool initializeCharacter(boost::uint16_t /*id*/) {
105 return false;
108 virtual const movie_definition* definition() const = 0;
113 } // end of namespace gnash
115 #endif