Gnash  0.8.10
Public Types | Public Member Functions | Protected Member Functions
gnash::movie_definition Class Reference

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

List of all members.

Public Types

typedef std::vector
< boost::intrusive_ptr
< SWF::ControlTag > > 
PlayList
typedef std::pair< int,
std::string > 
ImportSpec
typedef std::vector< ImportSpecImports

Public Member Functions

virtual int get_version () const =0
virtual size_t get_width_pixels () const =0
 Frame width in pixels.
virtual size_t get_height_pixels () const =0
 Frame height in pixels.
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.
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.
virtual MoviecreateMovie (Global_as &, DisplayObject *=0)
 Create a movie instance from a def.
virtual void incrementLoadedFrames ()
virtual const PlayListgetPlaylist (size_t) const
 Return the list of execute tags for given frame number.
virtual void importResources (boost::intrusive_ptr< movie_definition >, const Imports &)
 Import resources.
virtual DefinitionTag * getDefinitionTag (boost::uint16_t) const
 Get a DisplayObject from the dictionary.
virtual bool get_labeled_frame (const std::string &, size_t &) const
 Get 0-based index of the frame with given label.
virtual size_t get_loading_frame () const =0
 Returns 1 based index. Ex: if 1 then 1st frame as been fully loaded.
virtual void addDisplayObject (boost::uint16_t, DefinitionTag *)
 Add a DefinitionTag with given ID to the CharactersDictionary.
virtual void add_font (int, boost::intrusive_ptr< Font >)
 Add a font DisplayObject with given ID to the CharacterDictionary.
virtual Fontget_font (int) const
 Return the font with given DisplayObject id.
virtual Fontget_font (const std::string &, bool, bool) const
 Find a font from the movie (not shared) lib.
virtual void addControlTag (boost::intrusive_ptr< SWF::ControlTag >)
 Add an ControlTag to this movie_definition's playlist.
virtual void add_frame_name (const std::string &)
 Labels the frame currently being loaded with the given name.
virtual void set_jpeg_loader (std::auto_ptr< image::JpegInput >)
virtual image::JpegInputget_jpeg_loader () const
 Get the jpeg input loader, to load a DefineBits image (one without table info).
virtual CachedBitmapgetBitmap (int) const
 Get a bitmap from the bitmap dictionary.
virtual void addBitmap (int, boost::intrusive_ptr< CachedBitmap >)
 Add a bitmap DisplayObject in the dictionary, with the specified DisplayObject id.
virtual sound_sampleget_sound_sample (int) const
 Get the sound sample with given ID.
virtual void add_sound_sample (int, sound_sample *)
 Add a sound sample DisplayObject in the dictionary, with the specified DisplayObject id.
virtual void set_loading_sound_stream_id (int)
 Set the currently being loaded sound stream.
virtual int get_loading_sound_stream_id () const
 Get the currently being loaded sound stream, if any.
virtual void registerExport (const std::string &, boost::uint16_t)
 Register a symbol to refer to a character id.
virtual boost::uint16_t exportID (const std::string &) const
 Get the id that corresponds to a symbol.
virtual void setAS3 ()
 Set whether the SWFMovie should use AVM2 or AVM1.
virtual bool isAS3 () const
 True if the SWFMovie should use AVM2.
virtual const std::string & get_url () const =0
 Return the URL of the SWF stream this definition has been read from.
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).

Protected Member Functions

 movie_definition (boost::uint16_t id=0)
virtual ~movie_definition ()

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

typedef std::pair<int, std::string> gnash::movie_definition::ImportSpec
typedef std::vector<boost::intrusive_ptr<SWF::ControlTag> > gnash::movie_definition::PlayList

Constructor & Destructor Documentation

gnash::movie_definition::movie_definition ( boost::uint16_t  id = 0) [inline, protected]
virtual gnash::movie_definition::~movie_definition ( ) [inline, protected, virtual]

Member Function Documentation

virtual void gnash::movie_definition::add_font ( int  ,
boost::intrusive_ptr< Font  
) [inline, virtual]

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().

virtual void gnash::movie_definition::add_frame_name ( const std::string &  ) [inline, virtual]

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().

virtual void gnash::movie_definition::add_sound_sample ( int  ,
sound_sample  
) [inline, virtual]

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().

virtual void gnash::movie_definition::addBitmap ( int  ,
boost::intrusive_ptr< CachedBitmap  
) [inline, virtual]

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().

virtual void gnash::movie_definition::addControlTag ( boost::intrusive_ptr< SWF::ControlTag ) [inline, virtual]
virtual void gnash::movie_definition::addDisplayObject ( boost::uint16_t  ,
DefinitionTag *   
) [inline, virtual]

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::SWF::DefineButtonTag::loader(), gnash::SWF::DefineButton2Tag::loader(), gnash::SWF::DefineEditTextTag::loader(), gnash::SWF::DefineMorphShapeTag::loader(), gnash::SWF::DefineShapeTag::loader(), gnash::SWF::DefineTextTag::loader(), gnash::SWF::DefineText2Tag::loader(), gnash::SWF::DefineVideoStreamTag::loader(), gnash::sprite_definition::addDisplayObject(), and gnash::SWF::sprite_loader().

virtual bool gnash::movie_definition::completeLoad ( ) [inline, virtual]
virtual Movie* gnash::movie_definition::createMovie ( Global_as ,
DisplayObject = 0 
) [inline, virtual]

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(), and nsPluginInstance::threadMain().

virtual bool gnash::movie_definition::ensure_frame_loaded ( size_t  ) const [inline, virtual]

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.

virtual boost::uint16_t gnash::movie_definition::exportID ( const std::string &  ) const [inline, virtual]

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(), and gnash::sprite_definition::exportID().

virtual size_t gnash::movie_definition::get_bytes_loaded ( ) const [pure virtual]
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().

virtual Font* gnash::movie_definition::get_font ( int  ) const [inline, virtual]

Return the font with given DisplayObject id.

Returns:
NULL if the given id doesn't correspond to any registered font (default).
See also:
add_font

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

Referenced by gnash::SWF::DefineFontAlignZonesTag::loader(), gnash::SWF::DefineFontNameTag::loader(), gnash::SWF::DefineFontInfoTag::loader(), gnash::sprite_definition::get_font(), and gnash::SWF::TextRecord::read().

virtual Font* gnash::movie_definition::get_font ( const std::string &  ,
bool  ,
bool   
) const [inline, virtual]

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

Reimplemented in gnash::SWFMovieDefinition.

virtual size_t gnash::movie_definition::get_frame_count ( ) const [pure virtual]
virtual float gnash::movie_definition::get_frame_rate ( ) const [pure virtual]
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.

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::setStageScaleMode(), and nsPluginInstance::threadMain().

virtual image::JpegInput* gnash::movie_definition::get_jpeg_loader ( ) const [inline, virtual]

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.

virtual bool gnash::movie_definition::get_labeled_frame ( const std::string &  ,
size_t &   
) const [inline, virtual]

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.

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::DoABCTag::loader(), and gnash::SWF::DoActionTag::loader().

virtual int gnash::movie_definition::get_loading_sound_stream_id ( ) const [inline, virtual]

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().

virtual sound_sample* gnash::movie_definition::get_sound_sample ( int  ) const [inline, virtual]

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(), and gnash::SWF::StartSoundTag::loader().

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

Return the URL of the SWF stream this definition has been read from.

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

Referenced by gnash::action_buffer::getDefinitionURL(), gnash::ActionExec::operator()(), and gnash::SWF::metadata_loader().

virtual int gnash::movie_definition::get_version ( ) const [pure virtual]
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::setStageScaleMode(), and nsPluginInstance::threadMain().

virtual CachedBitmap* gnash::movie_definition::getBitmap ( int  ) const [inline, virtual]

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::SWF::DefineBitsTag::loader(), gnash::BitmapFill::bitmap(), and gnash::sprite_definition::getBitmap().

virtual DefinitionTag* gnash::movie_definition::getDefinitionTag ( boost::uint16_t  ) const [inline, virtual]

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::SWF::DefineButtonCxformTag::loader(), gnash::SWF::DefineButtonSoundTag::loader(), gnash::SWF::ButtonRecord::read(), gnash::sprite_definition::getDefinitionTag(), gnash::SWF::SymbolClassTag::loader(), and gnash::SWF::VideoFrameTag::loader().

virtual const PlayList* gnash::movie_definition::getPlaylist ( size_t  ) const [inline, virtual]

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.

virtual void gnash::movie_definition::importResources ( boost::intrusive_ptr< movie_definition ,
const Imports  
) [inline, virtual]

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 _.

virtual void gnash::movie_definition::incrementLoadedFrames ( ) [inline, virtual]

Reimplemented in gnash::sprite_definition.

Referenced by gnash::SWFParser::read().

virtual bool gnash::movie_definition::isAS3 ( ) const [inline, virtual]

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::DoABCTag::loader(), gnash::SWF::DoActionTag::loader(), gnash::SWF::DoInitActionTag::loader(), and gnash::SWF::SymbolClassTag::loader().

virtual void gnash::movie_definition::registerExport ( const std::string &  ,
boost::uint16_t   
) [inline, virtual]

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::sprite_definition::registerExport().

virtual void gnash::movie_definition::set_jpeg_loader ( std::auto_ptr< image::JpegInput ) [inline, virtual]

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 auto_ptr...

Reimplemented in gnash::SWFMovieDefinition.

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

virtual void gnash::movie_definition::set_loading_sound_stream_id ( int  ) [inline, virtual]

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().

virtual void gnash::movie_definition::setAS3 ( ) [inline, virtual]

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: