Gnash  0.8.11dev
Public Types | Public Member Functions | Protected Member Functions | List of all members
gnash::movie_definition Class Referenceabstract

Client program's interface to the definition of a movie or sprite. More...

#include <movie_definition.h>

Inheritance diagram for gnash::movie_definition:
gnash::SWF::DefinitionTag gnash::SWF::ControlTag gnash::ref_counted gnash::BitmapMovieDefinition gnash::sprite_definition gnash::SWFMovieDefinition

Public Types

typedef std::vector< boost::intrusive_ptr< SWF::ControlTag > > PlayList
 
typedef std::pair< int, std::string > ImportSpec
 
typedef std::vector< ImportSpecImports
 
- Public Types inherited from gnash::SWF::ControlTag
enum  Type { TAG_ACTION = 1 << 0, TAG_DLIST = 1 << 1 }
 Type of ControlTag. More...
 

Public Member Functions

virtual int get_version () const =0
 
virtual size_t get_width_pixels () const =0
 Frame width in pixels. More...
 
virtual size_t get_height_pixels () const =0
 Frame height in pixels. More...
 
virtual size_t get_frame_count () const =0
 
virtual float get_frame_rate () const =0
 
virtual const SWFRectget_frame_size () const =0
 Return size of frame, in TWIPS. More...
 
virtual size_t get_bytes_loaded () const =0
 
virtual size_t get_bytes_total () const =0
 Get total number of bytes in (uncompressed for SWF) input stream. More...
 
virtual MoviecreateMovie (Global_as &, DisplayObject *=nullptr)
 Create a movie instance from a def. More...
 
virtual void incrementLoadedFrames ()
 
virtual const PlayListgetPlaylist (size_t) const
 Return the list of execute tags for given frame number. More...
 
virtual void importResources (boost::intrusive_ptr< movie_definition >, const Imports &)
 Import resources. More...
 
virtual DefinitionTaggetDefinitionTag (std::uint16_t) const
 Get a DisplayObject from the dictionary. More...
 
virtual bool get_labeled_frame (const std::string &, size_t &) const
 Get 0-based index of the frame with given label. More...
 
virtual size_t get_loading_frame () const =0
 Returns 1 based index. Ex: if 1 then 1st frame as been fully loaded. More...
 
virtual void addDisplayObject (std::uint16_t, DefinitionTag *)
 Add a DefinitionTag with given ID to the CharactersDictionary. More...
 
virtual void add_font (int, boost::intrusive_ptr< Font >)
 Add a font DisplayObject with given ID to the CharacterDictionary. More...
 
virtual Fontget_font (int) const
 Return the font with given DisplayObject id. More...
 
virtual Fontget_font (const std::string &, bool, bool) const
 Find a font from the movie (not shared) lib. More...
 
virtual void addControlTag (boost::intrusive_ptr< SWF::ControlTag >)
 Add an ControlTag to this movie_definition's playlist. More...
 
virtual void add_frame_name (const std::string &)
 Labels the frame currently being loaded with the given name. More...
 
virtual void set_jpeg_loader (std::unique_ptr< image::JpegInput >)
 
virtual image::JpegInputget_jpeg_loader () const
 Get the jpeg input loader, to load a DefineBits image (one without table info). More...
 
virtual CachedBitmapgetBitmap (int) const
 Get a bitmap from the bitmap dictionary. More...
 
virtual void addBitmap (int, boost::intrusive_ptr< CachedBitmap >)
 Add a bitmap DisplayObject in the dictionary, with the specified DisplayObject id. More...
 
virtual sound_sampleget_sound_sample (int) const
 Get the sound sample with given ID. More...
 
virtual void add_sound_sample (int, sound_sample *)
 Add a sound sample DisplayObject in the dictionary, with the specified DisplayObject id. More...
 
virtual void set_loading_sound_stream_id (int)
 Set the currently being loaded sound stream. More...
 
virtual int get_loading_sound_stream_id () const
 Get the currently being loaded sound stream, if any. More...
 
virtual void registerExport (const std::string &, std::uint16_t)
 Register a symbol to refer to a character id. More...
 
virtual std::uint16_t exportID (const std::string &) const
 Get the id that corresponds to a symbol. More...
 
virtual void setAS3 ()
 Set whether the SWFMovie should use AVM2 or AVM1. More...
 
virtual bool isAS3 () const
 True if the SWFMovie should use AVM2. More...
 
virtual const std::string & get_url () const =0
 Return the URL of the SWF stream this definition has been read from. More...
 
virtual bool completeLoad ()
 
virtual bool ensure_frame_loaded (size_t) const
 Ensure that frame number 'framenum' (1-based offset) has been loaded (load on demand). More...
 
- Public Member Functions inherited from gnash::SWF::DefinitionTag
virtual ~DefinitionTag ()
 
virtual DisplayObjectcreateDisplayObject (Global_as &gl, DisplayObject *parent) const =0
 Create a DisplayObject with the given parent. More...
 
virtual DSOTEXPORT void executeState (MovieClip *m, DisplayList &) const
 Executing a DefinitionTag adds its id to list of known characters. More...
 
std::uint16_t id () const
 The immutable id of the DefinitionTag. More...
 
- Public Member Functions inherited from gnash::SWF::ControlTag
virtual ~ControlTag ()
 
virtual void executeActions (MovieClip *, DisplayList &) const
 Execute Action tags. More...
 
- Public Member Functions inherited from gnash::ref_counted
 ref_counted ()
 
 ref_counted (const ref_counted &)
 
void add_ref () const
 
void drop_ref () const
 
long get_ref_count () const
 

Protected Member Functions

 movie_definition (std::uint16_t id=0)
 
virtual ~movie_definition ()
 
- Protected Member Functions inherited from gnash::SWF::DefinitionTag
 DefinitionTag (std::uint16_t id)
 
- Protected Member Functions inherited from gnash::ref_counted
virtual ~ref_counted ()
 

Detailed Description

Client program's interface to the definition of a movie or sprite.

This is the shared constant source info, the one that cannot be changed by ActionScript code.

The class derives from DefinitionTag to allow a movie to be put in the CharacterDictionary. This is probably unneeded for top-level movies, because they don't need to be put in any CharacterDictionary... anyway the current design requires both sprite_definition (a sprite) and SWFMovieDefinition (a top-level movie) to derive from a common class to allow tag_loaders to take a pointer to the base class to act on (consider PLACEOBJECT tags...).

Member Typedef Documentation

§ Imports

§ ImportSpec

typedef std::pair<int, std::string> gnash::movie_definition::ImportSpec

§ PlayList

typedef std::vector<boost::intrusive_ptr<SWF::ControlTag> > gnash::movie_definition::PlayList

Constructor & Destructor Documentation

§ movie_definition()

gnash::movie_definition::movie_definition ( std::uint16_t  id = 0)
inlineprotected

§ ~movie_definition()

virtual gnash::movie_definition::~movie_definition ( )
inlineprotectedvirtual

Member Function Documentation

§ add_font()

virtual void gnash::movie_definition::add_font ( int  ,
boost::intrusive_ptr< Font  
)
inlinevirtual

Add a font DisplayObject with given ID to the CharacterDictionary.

This method is here to be called by DEFINEFONT tags loaders. The default implementation does nothing.

Reimplemented in gnash::SWFMovieDefinition, and gnash::sprite_definition.

Referenced by gnash::SWF::DefineFontTag::loader().

§ add_frame_name()

virtual void gnash::movie_definition::add_frame_name ( const std::string &  )
inlinevirtual

Labels the frame currently being loaded with the given name.

A copy of the name string is made and kept in this object. In case of multiple frames with the same name, the last added will be the one referenced by that name.

The default implementation is a no-op.

Reimplemented in gnash::SWFMovieDefinition.

Referenced by gnash::SWF::frame_label_loader().

§ add_sound_sample()

virtual void gnash::movie_definition::add_sound_sample ( int  ,
sound_sample  
)
inlinevirtual

Add a sound sample DisplayObject in the dictionary, with the specified DisplayObject id.

The default implementation is a no-op

Reimplemented in gnash::SWFMovieDefinition, and gnash::sprite_definition.

Referenced by gnash::sprite_definition::add_sound_sample(), and gnash::SWF::define_sound_loader().

§ addBitmap()

virtual void gnash::movie_definition::addBitmap ( int  ,
boost::intrusive_ptr< CachedBitmap  
)
inlinevirtual

Add a bitmap DisplayObject in the dictionary, with the specified DisplayObject id.

The default implementation is a no-op (deletes the image data).

Reimplemented in gnash::SWFMovieDefinition, and gnash::sprite_definition.

Referenced by gnash::SWF::DefineBitsTag::loader().

§ addControlTag()

virtual void gnash::movie_definition::addControlTag ( boost::intrusive_ptr< SWF::ControlTag )
inlinevirtual

§ addDisplayObject()

virtual void gnash::movie_definition::addDisplayObject ( std::uint16_t  ,
DefinitionTag  
)
inlinevirtual

Add a DefinitionTag with given ID to the CharactersDictionary.

Parameters
idThe id of the tag. All tags store their own id, but imported characters receive a new id in the importing movie. This method is here to be called by DEFINE tags loaders. The default implementation does nothing.

Referenced by gnash::sprite_definition::addDisplayObject(), gnash::SWF::DefineShapeTag::loader(), gnash::SWF::DefineTextTag::loader(), gnash::SWF::DefineMorphShapeTag::loader(), gnash::SWF::DefineEditTextTag::loader(), gnash::SWF::DefineVideoStreamTag::loader(), gnash::SWF::DefineText2Tag::loader(), gnash::SWF::DefineButtonTag::loader(), gnash::SWF::DefineButton2Tag::loader(), and gnash::SWF::sprite_loader().

§ completeLoad()

virtual bool gnash::movie_definition::completeLoad ( )
inlinevirtual

Reimplemented in gnash::SWFMovieDefinition.

§ createMovie()

virtual Movie* gnash::movie_definition::createMovie ( Global_as ,
DisplayObject = nullptr 
)
inlinevirtual

Create a movie instance from a def.

Not all movie definitions allow creation of Movie. In particular, sprite_definition can only create MovieClip, so will return NULL from this method.

The default implementation returns NULL.

Override this method for any definition that is able to be instanciated as a Movie. SWFMovieDefinition is one such example, future examples should include jpeg_movie_def and similar..

Reimplemented in gnash::SWFMovieDefinition, and gnash::BitmapMovieDefinition.

Referenced by gnash::movie_root::init().

§ ensure_frame_loaded()

virtual bool gnash::movie_definition::ensure_frame_loaded ( size_t  ) const
inlinevirtual

Ensure that frame number 'framenum' (1-based offset) has been loaded (load on demand).

Parameters
framenum1-based frame index that we want to be fully loaded before this function returns
Returns
false on error (like not enough frames available).

The default implementation is to always return true.

Reimplemented in gnash::SWFMovieDefinition.

References gnash::key::s.

§ exportID()

virtual std::uint16_t gnash::movie_definition::exportID ( const std::string &  ) const
inlinevirtual

Get the id that corresponds to a symbol.

Returns
The id corresponding to the passed symbol. The default implementation returns 0, as it has no export table.

Reimplemented in gnash::SWFMovieDefinition, and gnash::sprite_definition.

Referenced by gnash::SWF::ExportAssetsTag::executeState(), gnash::sprite_definition::exportID(), gnash::initObjectClass(), gnash::registerBitmapDataNative(), gnash::registerSoundNative(), and gnash::textformat_class_init().

§ get_bytes_loaded()

virtual size_t gnash::movie_definition::get_bytes_loaded ( ) const
pure virtual

§ get_bytes_total()

virtual size_t gnash::movie_definition::get_bytes_total ( ) const
pure virtual

Get total number of bytes in (uncompressed for SWF) input stream.

Note that this is different from actual file size if this is a compressed SWF. For other kind of movie definitions (Bitmaps, for example), the returned value should likely match the file size.

Implemented in gnash::SWFMovieDefinition, gnash::BitmapMovieDefinition, and gnash::sprite_definition.

Referenced by gnash::sprite_definition::get_bytes_total().

§ get_font() [1/2]

virtual Font* gnash::movie_definition::get_font ( int  ) const
inlinevirtual

§ get_font() [2/2]

virtual Font* gnash::movie_definition::get_font ( const std::string &  ,
bool  ,
bool   
) const
inlinevirtual

Find a font from the movie (not shared) lib.

Reimplemented in gnash::SWFMovieDefinition.

§ get_frame_count()

virtual size_t gnash::movie_definition::get_frame_count ( ) const
pure virtual

§ get_frame_rate()

virtual float gnash::movie_definition::get_frame_rate ( ) const
pure virtual

§ get_frame_size()

virtual const SWFRect& gnash::movie_definition::get_frame_size ( ) const
pure virtual

Return size of frame, in TWIPS.

Implemented in gnash::SWFMovieDefinition, gnash::sprite_definition, and gnash::BitmapMovieDefinition.

§ get_height_pixels()

virtual size_t gnash::movie_definition::get_height_pixels ( ) const
pure virtual

Frame height in pixels.

The frame size is in twips and may be rounded up.

Implemented in gnash::SWFMovieDefinition, gnash::sprite_definition, and gnash::BitmapMovieDefinition.

Referenced by gnash::movie_root::init(), gnash::movie_root::setScriptLimits(), and gnash::movie_root::setStageScaleMode().

§ get_jpeg_loader()

virtual image::JpegInput* gnash::movie_definition::get_jpeg_loader ( ) const
inlinevirtual

Get the jpeg input loader, to load a DefineBits image (one without table info).

This method should probably not be there but in some higher-level class, like a Parser class..

The default implementation returns NULL

NOTE: ownership of the returned object is NOT transferred

Reimplemented in gnash::SWFMovieDefinition.

Referenced by gnash::SWF::DefineBitsTag::loader().

§ get_labeled_frame()

virtual bool gnash::movie_definition::get_labeled_frame ( const std::string &  ,
size_t &   
) const
inlinevirtual

Get 0-based index of the frame with given label.

The default implementation is to always return false, as if NO frame with given label was found.

Parameters
labelLabel of the frame we're looking for.
frame_numberWhere to write frame number to (if a match is found). A 0-based index will be written there.
Returns
true if a frame with that label was found, false otherwise

Reimplemented in gnash::SWFMovieDefinition.

§ get_loading_frame()

virtual size_t gnash::movie_definition::get_loading_frame ( ) const
pure virtual

Returns 1 based index. Ex: if 1 then 1st frame as been fully loaded.

Implemented in gnash::SWFMovieDefinition, gnash::BitmapMovieDefinition, and gnash::sprite_definition.

Referenced by gnash::SWF::DoActionTag::loader(), and gnash::SWF::DoABCTag::loader().

§ get_loading_sound_stream_id()

virtual int gnash::movie_definition::get_loading_sound_stream_id ( ) const
inlinevirtual

Get the currently being loaded sound stream, if any.

See also
set_loading_sound_stream_id

The default implementation returns -1

Returns
-1 if no sound stream is being currently loading

Reimplemented in gnash::SWFMovieDefinition, and gnash::sprite_definition.

Referenced by gnash::SWF::StreamSoundBlockTag::loader().

§ get_sound_sample()

virtual sound_sample* gnash::movie_definition::get_sound_sample ( int  ) const
inlinevirtual

Get the sound sample with given ID.

Returns
NULL if the given DisplayObject ID isn't found in the dictionary or it is not a sound sample.

The default implementation always returns NULL

Reimplemented in gnash::SWFMovieDefinition, and gnash::sprite_definition.

Referenced by gnash::sprite_definition::get_sound_sample(), gnash::SWF::DefineButtonSoundTag::loader(), gnash::SWF::StartSoundTag::loader(), and gnash::registerSoundNative().

§ get_url()

virtual const std::string& gnash::movie_definition::get_url ( ) const
pure virtual

§ get_version()

virtual int gnash::movie_definition::get_version ( ) const
pure virtual

§ get_width_pixels()

virtual size_t gnash::movie_definition::get_width_pixels ( ) const
pure virtual

Frame width in pixels.

The frame size is in twips and may be rounded up.

Implemented in gnash::SWFMovieDefinition, gnash::sprite_definition, and gnash::BitmapMovieDefinition.

Referenced by gnash::movie_root::init(), gnash::movie_root::setScriptLimits(), and gnash::movie_root::setStageScaleMode().

§ getBitmap()

virtual CachedBitmap* gnash::movie_definition::getBitmap ( int  ) const
inlinevirtual

Get a bitmap from the bitmap dictionary.

Note that only top-level movies (those belonging to a single SWF stream) have a bitmap dictionary, thus our SWFMovieDefinition. The other derived class, sprite_definition will seek for DisplayObjects in its base SWFMovieDefinition.

Returns
0 if no DisplayObject with the given ID is found, or if the corresponding DisplayObject is not a bitmap.

The default implementation returns 0.

Reimplemented in gnash::SWFMovieDefinition, and gnash::sprite_definition.

Referenced by gnash::BitmapFill::bitmap(), gnash::sprite_definition::getBitmap(), gnash::SWF::DefineBitsTag::loader(), and gnash::registerBitmapDataNative().

§ getDefinitionTag()

virtual DefinitionTag* gnash::movie_definition::getDefinitionTag ( std::uint16_t  ) const
inlinevirtual

Get a DisplayObject from the dictionary.

Note that only top-level movies (those belonging to a single SWF stream) have a DisplayObjects dictionary, thus our SWFMovieDefinition. The other derived class, sprite_definition will seek for DisplayObjects in it's base SWFMovieDefinition.

Returns
NULL if no DisplayObject with the given ID is found (this is the default)

Reimplemented in gnash::SWFMovieDefinition, and gnash::sprite_definition.

Referenced by gnash::sprite_definition::getDefinitionTag(), gnash::initObjectClass(), gnash::SWF::DefineButtonCxformTag::loader(), gnash::SWF::VideoFrameTag::loader(), gnash::SWF::SymbolClassTag::loader(), and gnash::SWF::DefineButtonSoundTag::loader().

§ getPlaylist()

virtual const PlayList* gnash::movie_definition::getPlaylist ( size_t  ) const
inlinevirtual

Return the list of execute tags for given frame number.

Parameters
frame_numberFrame number, 0-based (ie: first frame is 0)
Returns
NULL if no execute tags are defined for the given frame number (the default implementation) or a pointer to the vector of them (PlayList)

Reimplemented in gnash::SWFMovieDefinition.

§ importResources()

virtual void gnash::movie_definition::importResources ( boost::intrusive_ptr< movie_definition ,
const Imports  
)
inlinevirtual

Import resources.

Parameters
sourceMovie containing the resources being imported
importsResources to import, each with the id to use in our dictionary

Reimplemented in gnash::SWFMovieDefinition.

References _, IF_VERBOSE_MALFORMED_SWF, and gnash::log_swferror().

Referenced by gnash::SWF::ImportAssetsTag::executeState().

§ incrementLoadedFrames()

virtual void gnash::movie_definition::incrementLoadedFrames ( )
inlinevirtual

Reimplemented in gnash::sprite_definition.

§ isAS3()

virtual bool gnash::movie_definition::isAS3 ( ) const
inlinevirtual

True if the SWFMovie should use AVM2.

This is only sensible for SWFMovieDefinitions, and shouldn't be here once this inheritance mess is cleaned up.

Reimplemented in gnash::SWFMovieDefinition.

Referenced by gnash::SWF::DefineSceneAndFrameLabelDataTag::loader(), gnash::SWF::SymbolClassTag::loader(), gnash::SWF::DoActionTag::loader(), gnash::SWF::DoInitActionTag::loader(), gnash::SWF::DoABCTag::loader(), and gnash::movie_root::setScriptLimits().

§ registerExport()

virtual void gnash::movie_definition::registerExport ( const std::string &  ,
std::uint16_t   
)
inlinevirtual

Register a symbol to refer to a character id.

The default implementation does nothing.

Reimplemented in gnash::SWFMovieDefinition, and gnash::sprite_definition.

Referenced by gnash::SWF::ExportAssetsTag::executeState(), and gnash::sprite_definition::registerExport().

§ set_jpeg_loader()

virtual void gnash::movie_definition::set_jpeg_loader ( std::unique_ptr< image::JpegInput )
inlinevirtual

This method should probably not be there but in some higher-level class, like a Parser class..

The default implementation is a no-op. Actually, an implicit op is performed, and it is deleting the jpeg::input instance since it is passed in an unique_ptr...

Reimplemented in gnash::SWFMovieDefinition.

§ set_loading_sound_stream_id()

virtual void gnash::movie_definition::set_loading_sound_stream_id ( int  )
inlinevirtual

Set the currently being loaded sound stream.

The default implementation is a no-op

Reimplemented in gnash::SWFMovieDefinition, and gnash::sprite_definition.

Referenced by gnash::SWF::SoundStreamHeadTag::loader().

§ setAS3()

virtual void gnash::movie_definition::setAS3 ( )
inlinevirtual

Set whether the SWFMovie should use AVM2 or AVM1.

This is only sensible for SWFMovieDefinitions, so is a no-op here.

Reimplemented in gnash::SWFMovieDefinition.

Referenced by gnash::SWF::file_attributes_loader().


The documentation for this class was generated from the following file: