Gnash
0.8.10
|
Client program's interface to the definition of a movie or sprite. More...
#include <movie_definition.h>
Public Types | |
typedef std::vector < boost::intrusive_ptr < SWF::ControlTag > > | PlayList |
typedef std::pair< int, std::string > | ImportSpec |
typedef std::vector< ImportSpec > | Imports |
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 SWFRect & | get_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 Movie * | createMovie (Global_as &, DisplayObject *=0) |
Create a movie instance from a def. | |
virtual void | incrementLoadedFrames () |
virtual const PlayList * | getPlaylist (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 Font * | get_font (int) const |
Return the font with given DisplayObject id. | |
virtual Font * | get_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::JpegInput * | get_jpeg_loader () const |
Get the jpeg input loader, to load a DefineBits image (one without table info). | |
virtual CachedBitmap * | getBitmap (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_sample * | get_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 () |
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...).
typedef std::vector< ImportSpec > gnash::movie_definition::Imports |
typedef std::pair<int, std::string> gnash::movie_definition::ImportSpec |
typedef std::vector<boost::intrusive_ptr<SWF::ControlTag> > gnash::movie_definition::PlayList |
gnash::movie_definition::movie_definition | ( | boost::uint16_t | id = 0 | ) | [inline, protected] |
virtual gnash::movie_definition::~movie_definition | ( | ) | [inline, protected, virtual] |
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] |
Add an ControlTag to this movie_definition's playlist.
The default implementation is a no-op.
tag | The tag to add in the list of executable tags for the frame currently being loaded. Ownership is transferred to the SWFMovieDefinition. |
Reimplemented in gnash::SWFMovieDefinition, and gnash::sprite_definition.
Referenced by gnash::SWF::DefineSceneAndFrameLabelDataTag::loader(), gnash::SWF::DoABCTag::loader(), gnash::SWF::DoActionTag::loader(), gnash::SWF::DoInitActionTag::loader(), gnash::SWF::ExportAssetsTag::loader(), gnash::SWF::ImportAssetsTag::loader(), gnash::SWF::PlaceObject2Tag::loader(), gnash::SWF::RemoveObjectTag::loader(), gnash::SWF::ScriptLimitsTag::loader(), gnash::SWF::SetBackgroundColorTag::loader(), gnash::SWF::StartSoundTag::loader(), gnash::SWF::StreamSoundBlockTag::loader(), and gnash::SWF::SymbolClassTag::loader().
virtual void gnash::movie_definition::addDisplayObject | ( | boost::uint16_t | , |
DefinitionTag * | |||
) | [inline, virtual] |
Add a DefinitionTag with given ID to the CharactersDictionary.
id | The 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] |
Reimplemented in gnash::SWFMovieDefinition.
Referenced by nsPluginInstance::threadMain().
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).
framenum | 1-based frame index that we want to be fully loaded before this function returns |
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.
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] |
Implemented in gnash::SWFMovieDefinition, gnash::sprite_definition, and gnash::BitmapMovieDefinition.
Referenced by gnash::sprite_definition::get_bytes_loaded().
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.
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] |
Implemented in gnash::SWFMovieDefinition, gnash::sprite_definition, and gnash::BitmapMovieDefinition.
virtual float gnash::movie_definition::get_frame_rate | ( | ) | const [pure virtual] |
Implemented in gnash::SWFMovieDefinition, gnash::sprite_definition, and gnash::BitmapMovieDefinition.
Referenced by nsPluginInstance::threadMain(), and gnash::sprite_definition::get_frame_rate().
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.
label | Label of the frame we're looking for. |
frame_number | Where to write frame number to (if a match is found). A 0-based index will be written there. |
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.
The default implementation returns -1
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.
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] |
Implemented in gnash::SWFMovieDefinition, gnash::sprite_definition, and gnash::BitmapMovieDefinition.
Referenced by gnash::action_buffer::getDefinitionVersion(), gnash::SWF::DefineButtonTag::getSWFVersion(), gnash::BitmapFill::BitmapFill(), gnash::movie_root::init(), gnash::SWF::ShapeRecord::read(), and gnash::sprite_definition::get_version().
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.
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.
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.
frame_number | Frame number, 0-based (ie: first frame is 0) |
Reimplemented in gnash::SWFMovieDefinition.
virtual void gnash::movie_definition::importResources | ( | boost::intrusive_ptr< movie_definition > | , |
const Imports & | |||
) | [inline, virtual] |
Import resources.
source | Movie containing the resources being imported |
imports | Resources 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().