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

movie_definition.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 
00046 
00047 
00048 #ifndef GNASH_MOVIE_DEFINITION_H
00049 #define GNASH_MOVIE_DEFINITION_H
00050 
00051 #ifdef HAVE_CONFIG_H
00052 #include "gnashconfig.h" // for USE_SWFTREE
00053 #endif
00054 
00055 #include <string>
00056 #include <memory> // for auto_ptr
00057 #include <vector> // for PlayList typedef
00058 #include <set>
00059 #include <boost/intrusive_ptr.hpp>
00060 #include <boost/cstdint.hpp>
00061 
00062 #include "DefinitionTag.h"
00063 #include "log.h"
00064 
00065 // Forward declarations
00066 namespace gnash {
00067         class CachedBitmap;
00068         class Movie;
00069         class MovieClip;
00070         namespace SWF {
00071         class ControlTag;
00072     }
00073     class Font;
00074     class sound_sample;
00075     class JpegImageInput;
00076 }
00077 
00078 namespace gnash
00079 {
00080 
00082 //
00101 class movie_definition : public SWF::DefinitionTag
00102 {
00103 public:
00104         typedef std::vector<boost::intrusive_ptr<SWF::ControlTag> > PlayList;
00105 
00106         virtual int     get_version() const = 0;
00107 
00109     //
00111         virtual size_t get_width_pixels() const = 0;
00112     
00114     //
00116         virtual size_t get_height_pixels() const = 0;
00117 
00118         virtual size_t get_frame_count() const = 0;
00119         virtual float get_frame_rate() const = 0;
00120 
00122         virtual const SWFRect& get_frame_size() const = 0;
00123 
00124         virtual size_t get_bytes_loaded() const = 0;
00125 
00127         //
00133         virtual size_t get_bytes_total() const = 0;
00134 
00136         //
00149         virtual Movie* createMovie(Global_as& /*gl*/, DisplayObject* /*parent*/=0)
00150         {
00151                 return NULL;
00152         }
00153 
00154     virtual void incrementLoadedFrames() {}
00155 
00157         //
00165         virtual const PlayList* getPlaylist(size_t /*frame_number*/) const
00166         {
00167                 return 0;
00168         }
00169 
00170 
00171         typedef std::pair<int, std::string> ImportSpec;
00172         typedef std::vector< ImportSpec > Imports;
00173 
00175         //
00182         virtual void importResources(
00183             boost::intrusive_ptr<movie_definition> /*source*/, 
00184             const Imports& /*imports*/)
00185         {
00186                 IF_VERBOSE_MALFORMED_SWF(
00187             log_swferror(_("IMPORT tag appears outside SWF definition"));
00188                 );
00189         }
00190 
00191 
00194         //
00202         virtual DefinitionTag* getDefinitionTag(boost::uint16_t /*id*/) const
00203         {
00204                 return NULL;
00205         }
00206 
00208         //
00222         virtual bool get_labeled_frame(const std::string& /*label*/,
00223             size_t& /*frame_number*/) const
00224         {
00225                 return false;
00226         }
00227 
00228         //
00229         // For use during creation.
00230         //
00231 
00233         virtual size_t  get_loading_frame() const = 0;
00234 
00236         //
00240     //
00243         virtual void addDisplayObject(boost::uint16_t /*id*/, DefinitionTag* /*c*/)
00244         {
00245         }
00246 
00248         //
00252         virtual void add_font(int /*id*/, Font* /*ch*/)
00253         {
00254         }
00255 
00257         //
00263         virtual Font* get_font(int /*id*/) const
00264         {
00265                 return NULL;
00266         }
00267 
00269         virtual Font* get_font(const std::string& /*name*/,
00270             bool /*bold*/, bool /*italic*/) const
00271         {
00272                 return 0;
00273         }
00274 
00276         //
00287         virtual void addControlTag(SWF::ControlTag* /*c*/)
00288         {
00289         }
00290 
00292         //
00299         virtual void add_frame_name(const std::string& /*name*/)
00300         {
00301         }
00302 
00310         virtual void set_jpeg_loader(std::auto_ptr<JpegImageInput> /*j_in*/)
00311         {
00312         }
00313 
00325         virtual JpegImageInput* get_jpeg_loader() const
00326         {
00327                 return NULL;
00328         }
00329 
00332         //
00343         virtual CachedBitmap* getBitmap(int /*DisplayObject_id*/) const
00344         {
00345                 return 0;
00346         }
00347 
00351         //
00354         virtual void addBitmap(int /*id*/, boost::intrusive_ptr<CachedBitmap> /*im*/)
00355         {
00356         }
00357 
00359         //
00365         virtual sound_sample* get_sound_sample(int /*DisplayObject_id*/) const
00366         {
00367                 return NULL;
00368         }
00369 
00373         //
00376         virtual void add_sound_sample(int /*DisplayObject_id*/, sound_sample* /*sam*/)
00377         {
00378         }
00379 
00381         //
00384         virtual void set_loading_sound_stream_id(int /*id*/)
00385         {
00386         }
00387 
00389         //
00396         virtual int get_loading_sound_stream_id() const
00397         {
00398                 return -1;
00399         }
00400 
00402     //
00404     virtual void registerExport(const std::string&, boost::uint16_t) {}
00405     
00407     //
00410     virtual boost::uint16_t exportID(const std::string& /*symbol*/) const {
00411         return 0;
00412     }
00413 
00415     //
00417     virtual void setAS3() {
00418     }
00419 
00421     //
00424     virtual bool isAS3() const {
00425         return false;
00426     }
00427 
00431         virtual const std::string& get_url() const = 0;
00432 
00433         // Start the loader thread. By default no loader thread is engaged
00434         // so this function is a no-op.
00435         virtual bool completeLoad() {
00436                 return true;
00437         }
00438 
00442         //
00451         virtual bool ensure_frame_loaded(size_t /*framenum*/) const {
00452                 return true;
00453         }
00454 
00455 #ifdef USE_SWFTREE
00456 
00457         // These methods attach the contents of the METADATA tag
00458         // to a movie_definition. They are not used by the player
00459         // at all, but are stored for display in Movie Properties.
00460         // To save memory and parsing time, this won't happen
00461         // when the swf tree view is disabled.
00462         virtual void storeDescriptiveMetadata(const std::string& /*data*/)
00463         {
00464         }
00465 
00466         virtual const std::string& getDescriptiveMetadata() const
00467         {
00468             static const std::string s;
00469             return s;
00470         }
00471 
00472 #endif
00473 protected:
00474     movie_definition(boost::uint16_t id = 0)
00475         :
00476         DefinitionTag(id)
00477     {}
00478 };
00479 
00480 } // namespace gnash
00481 
00482 #endif // GNASH_MOVIE_DEFINITION_H

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