• 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     namespace image {
00076         class JpegInput;
00077     }
00078 }
00079 
00080 namespace gnash
00081 {
00082 
00084 //
00103 class movie_definition : public SWF::DefinitionTag
00104 {
00105 public:
00106         typedef std::vector<boost::intrusive_ptr<SWF::ControlTag> > PlayList;
00107 
00108         virtual int     get_version() const = 0;
00109 
00111     //
00113         virtual size_t get_width_pixels() const = 0;
00114     
00116     //
00118         virtual size_t get_height_pixels() const = 0;
00119 
00120         virtual size_t get_frame_count() const = 0;
00121         virtual float get_frame_rate() const = 0;
00122 
00124         virtual const SWFRect& get_frame_size() const = 0;
00125 
00126         virtual size_t get_bytes_loaded() const = 0;
00127 
00129         //
00135         virtual size_t get_bytes_total() const = 0;
00136 
00138         //
00151         virtual Movie* createMovie(Global_as& /*gl*/, DisplayObject* /*parent*/=0)
00152         {
00153                 return NULL;
00154         }
00155 
00156     virtual void incrementLoadedFrames() {}
00157 
00159         //
00167         virtual const PlayList* getPlaylist(size_t /*frame_number*/) const
00168         {
00169                 return 0;
00170         }
00171 
00172 
00173         typedef std::pair<int, std::string> ImportSpec;
00174         typedef std::vector< ImportSpec > Imports;
00175 
00177         //
00184         virtual void importResources(
00185             boost::intrusive_ptr<movie_definition> /*source*/, 
00186             const Imports& /*imports*/)
00187         {
00188                 IF_VERBOSE_MALFORMED_SWF(
00189             log_swferror(_("IMPORT tag appears outside SWF definition"));
00190                 );
00191         }
00192 
00193 
00196         //
00204         virtual DefinitionTag* getDefinitionTag(boost::uint16_t /*id*/) const
00205         {
00206                 return NULL;
00207         }
00208 
00210         //
00224         virtual bool get_labeled_frame(const std::string& /*label*/,
00225             size_t& /*frame_number*/) const
00226         {
00227                 return false;
00228         }
00229 
00230         //
00231         // For use during creation.
00232         //
00233 
00235         virtual size_t  get_loading_frame() const = 0;
00236 
00238         //
00242     //
00245         virtual void addDisplayObject(boost::uint16_t /*id*/, DefinitionTag* /*c*/)
00246         {
00247         }
00248 
00250         //
00254         virtual void add_font(int /*id*/, Font* /*ch*/)
00255         {
00256         }
00257 
00259         //
00265         virtual Font* get_font(int /*id*/) const
00266         {
00267                 return NULL;
00268         }
00269 
00271         virtual Font* get_font(const std::string& /*name*/,
00272             bool /*bold*/, bool /*italic*/) const
00273         {
00274                 return 0;
00275         }
00276 
00278         //
00289         virtual void addControlTag(SWF::ControlTag* /*c*/)
00290         {
00291         }
00292 
00294         //
00301         virtual void add_frame_name(const std::string& /*name*/)
00302         {
00303         }
00304 
00312         virtual void set_jpeg_loader(std::auto_ptr<image::JpegInput> /*j_in*/)
00313         {
00314         }
00315 
00327         virtual image::JpegInput* get_jpeg_loader() const
00328         {
00329                 return NULL;
00330         }
00331 
00334         //
00345         virtual CachedBitmap* getBitmap(int /*DisplayObject_id*/) const
00346         {
00347                 return 0;
00348         }
00349 
00353         //
00356         virtual void addBitmap(int /*id*/, boost::intrusive_ptr<CachedBitmap> /*im*/)
00357         {
00358         }
00359 
00361         //
00367         virtual sound_sample* get_sound_sample(int /*DisplayObject_id*/) const
00368         {
00369                 return NULL;
00370         }
00371 
00375         //
00378         virtual void add_sound_sample(int /*DisplayObject_id*/, sound_sample* /*sam*/)
00379         {
00380         }
00381 
00383         //
00386         virtual void set_loading_sound_stream_id(int /*id*/)
00387         {
00388         }
00389 
00391         //
00398         virtual int get_loading_sound_stream_id() const
00399         {
00400                 return -1;
00401         }
00402 
00404     //
00406     virtual void registerExport(const std::string&, boost::uint16_t) {}
00407     
00409     //
00412     virtual boost::uint16_t exportID(const std::string& /*symbol*/) const {
00413         return 0;
00414     }
00415 
00417     //
00419     virtual void setAS3() {
00420     }
00421 
00423     //
00426     virtual bool isAS3() const {
00427         return false;
00428     }
00429 
00433         virtual const std::string& get_url() const = 0;
00434 
00435         // Start the loader thread. By default no loader thread is engaged
00436         // so this function is a no-op.
00437         virtual bool completeLoad() {
00438                 return true;
00439         }
00440 
00444         //
00453         virtual bool ensure_frame_loaded(size_t /*framenum*/) const {
00454                 return true;
00455         }
00456 
00457 #ifdef USE_SWFTREE
00458 
00459         // These methods attach the contents of the METADATA tag
00460         // to a movie_definition. They are not used by the player
00461         // at all, but are stored for display in Movie Properties.
00462         // To save memory and parsing time, this won't happen
00463         // when the swf tree view is disabled.
00464         virtual void storeDescriptiveMetadata(const std::string& /*data*/)
00465         {
00466         }
00467 
00468         virtual const std::string& getDescriptiveMetadata() const
00469         {
00470             static const std::string s;
00471             return s;
00472         }
00473 
00474 #endif
00475 protected:
00476     movie_definition(boost::uint16_t id = 0)
00477         :
00478         DefinitionTag(id)
00479     {}
00480 };
00481 
00482 } // namespace gnash
00483 
00484 #endif // GNASH_MOVIE_DEFINITION_H

Generated on Thu Sep 2 2010 for Gnash by  doxygen 1.7.1