• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

DummyMovieDefinition.h

Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
00003 //   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 #ifndef GNASH_DUMMYMOVIEDEFINITION_H
00020 #define GNASH_DUMMYMOVIEDEFINITION_H
00021 
00022 #include "SWFMovieDefinition.h" // for inheritance
00023 #include "SWFRect.h" // for composition
00024 #include "SWFMovie.h" // for createMovie
00025 #include "Global_as.h"
00026 #include "namedStrings.h"
00027 
00028 #include <vector>
00029 #include <string>
00030 #include <memory> // for auto_ptr
00031 
00032 
00033 namespace gnash
00034 {
00035 
00037 //
00046 class DummyMovieDefinition : public SWFMovieDefinition
00047 {
00048         int _version;
00049         SWFRect _framesize;
00050         size_t _framecount;
00051         std::vector<PlayList> _playlist;
00052         float _framerate;
00053         std::string _url;
00054 
00055 public:
00056 
00057 
00059         //
00069         DummyMovieDefinition(const RunResources& ri)
00070                 :
00071         SWFMovieDefinition(ri),
00072                 _version(6),
00073                 _framesize(0, 0, 640*20, 480*20),
00074                 _framecount(1),
00075                 _playlist(_framecount),
00076                 _framerate(12),
00077                 _url("http://www.gnu.org/software/gnash")
00078         {
00079         }
00080 
00082         //
00087         DummyMovieDefinition(const RunResources& ri, int version)
00088                 :
00089         SWFMovieDefinition(ri),
00090                 _version(version),
00091                 _framesize(0, 0, 640*20, 480*20),
00092                 _framecount(1),
00093                 _playlist(_framecount),
00094                 _framerate(12),
00095                 _url("http://www.gnu.org/software/gnash")
00096         {
00097         }
00098 
00099     virtual bool ensure_frame_loaded(size_t) const {
00100         return true;
00101     }
00102 
00103         virtual int     get_version() const {
00104                 return _version;
00105         }
00106 
00107         virtual size_t get_width_pixels() const {
00108                 return _framesize.width()/20;
00109         }
00110 
00111         virtual size_t get_height_pixels() const {
00112                 return _framesize.height()/20;
00113         }
00114 
00115         virtual size_t  get_frame_count() const {
00116                 return _framecount;
00117         }
00118 
00119         virtual float   get_frame_rate() const {
00120                 return _framerate;
00121         }
00122 
00123         virtual const SWFRect& get_frame_size() const {
00124                 return _framesize;
00125         }
00126 
00127         virtual size_t get_bytes_loaded() const {
00128                 return 0;
00129         }
00130 
00131         virtual size_t get_bytes_total() const {
00132                 return 0;
00133         }
00134         
00136         virtual Movie* createMovie(Global_as& gl, DisplayObject* parent=NULL)
00137         {
00138         as_object* o = getObjectWithPrototype(gl, NSV::CLASS_MOVIE_CLIP);
00139                 return new SWFMovie(o, this, parent);
00140         }
00141         
00142         virtual const PlayList& get_playlist(size_t frame_number) const
00143         {
00144                 assert ( frame_number < _playlist.size() );
00145                 return _playlist[frame_number];
00146         }
00147 
00148         //
00149         // For use during creation.
00150         //
00151 
00153         virtual size_t  get_loading_frame() const  {
00154                 return 1;
00155         }
00156 
00157         virtual const std::string& get_url() const {
00158                 return _url;
00159         }
00160 
00161 };
00162 
00163 } // namespace gnash
00164 
00165 #endif // GNASH_DUMMYMOVIEDEFINITION_H

Generated on Fri Mar 16 2012 15:46:09 for Gnash by  doxygen 1.7.1