Gnash  0.8.10
SWFMovie.h
Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
00003 //   Free Software Foundation, Inc
00004 // 
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 // Stateful live Movie instance 
00020 
00021 
00022 #ifndef GNASH_SWF_MOVIE_H
00023 #define GNASH_SWF_MOVIE_H
00024 
00025 #include "Movie.h" // for inheritance
00026 #include "SWFMovieDefinition.h" // for dtor visibility by smart ptr
00027 
00028 #include <boost/intrusive_ptr.hpp>
00029 #include <string>
00030 #include <map>
00031 
00032 // Forward declarations
00033 namespace gnash {
00034         class DisplayObject; 
00035 }
00036 
00037 namespace gnash
00038 {
00039 
00041 //
00043 //
00049 class SWFMovie : public Movie
00050 {
00051 
00053     typedef std::map<boost::uint16_t, bool> Characters;
00054 
00055 public:
00056 
00057         SWFMovie(as_object* object, const SWFMovieDefinition* def,
00058             DisplayObject* parent);
00059 
00060         virtual ~SWFMovie() {}
00061 
00062         virtual void advance();
00063 
00064     virtual float frameRate() const {
00065         return _def->get_frame_rate();
00066     }
00067 
00068     virtual size_t widthPixels() const {
00069         return _def->get_width_pixels();
00070     }
00071 
00072     virtual size_t heightPixels() const {
00073         return _def->get_height_pixels();
00074     }
00075 
00076     virtual bool ensureFrameLoaded(size_t frameNo) const {
00077         return _def->ensure_frame_loaded(frameNo);
00078     }
00079 
00081         //
00086     void construct(as_object* init = 0);
00087 
00089     const std::string& url() const {
00090         return _def->get_url();
00091     }
00092 
00094     //
00096     int version() const {
00097         return _def->get_version();
00098     }
00099     
00101     //
00104     //
00108     virtual SWF::DefinitionTag* exportedCharacter(const std::string& symbol);
00109 
00111     //
00115     //
00119     void addCharacter(boost::uint16_t id);
00120 
00122     //
00125     //
00132         bool initializeCharacter(boost::uint16_t id);
00133 
00134     const movie_definition* definition() const {
00135         return _def.get();
00136     }
00137 
00138 private:
00139 
00141         Characters _characters;
00142 
00144         const boost::intrusive_ptr<const SWFMovieDefinition> _def;
00145 };
00146 
00147 
00148 } // end of namespace gnash
00149 
00150 #endif // GNASH_MOVIE_INSTANCE_H