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::character_def gnash::resource gnash::ref_counted gnash::BitmapMovieDefinition gnash::DummyMovieDefinition gnash::movie_def_impl gnash::sprite_definition

List of all members.

Public Types

typedef std::vector< ControlTag * > PlayList

Public Member Functions

virtual int get_version () const =0
virtual float get_width_pixels () const =0
virtual float get_height_pixels () const =0
virtual size_t get_frame_count () const =0
virtual float get_frame_rate () const =0
virtual const rectget_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_instancecreate_movie_instance (character *=0)
 Create a movie instance from a def.
virtual void visit_imported_movies (import_visitor &)
virtual void resolve_import (const std::string &, movie_definition *)
 Call this to resolve an import of the given movie.
virtual int get_bitmap_info_count () const
virtual bitmap_infoget_bitmap_info (int) const
virtual const PlayListgetPlaylist (size_t) const
 Return the list of execute tags for given frame number.
virtual boost::intrusive_ptr
< resource
get_exported_resource (const std::string &)
 Get the named exported resource, if we expose it.
virtual character_defget_character_def (int)
 Get a character from the dictionary.
virtual bool get_labeled_frame (const std::string &, size_t &)
 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 add_character (int, character_def *)
 Add a character with given ID to the CharactersDictionary.
virtual void add_font (int, font *)
 Add a font character with given ID to the CharacterDictionary.
virtual fontget_font (int) const
 Return the font with given character id.
virtual void addControlTag (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< jpeg::input >)
virtual jpeg::inputget_jpeg_loader ()
 Get the jpeg input loader, to load a DefineBits image (one without table info).
virtual bitmap_character_defget_bitmap_character_def (int)
 Get a bitmap character from the dictionary.
virtual void add_bitmap_character_def (int, bitmap_character_def *)
 Add a bitmap character in the dictionary, with the specified character id.
virtual sound_sampleget_sound_sample (int)
 Get the sound sample with given ID.
virtual void add_sound_sample (int, sound_sample *)
 Add a sound sample character in the dictionary, with the specified character id.
virtual void set_loading_sound_stream_id (int)
 Set the currently being loaded sound stream.
virtual int get_loading_sound_stream_id ()
 Get the currently being loaded sound stream, if any.
virtual void export_resource (const std::string &, resource *)
 Mark the given resource as "exported" with the given linkage name.
virtual void add_import (const std::string &, int, const std::string &)
 Adds an entry to a table of resources that need to be imported from other movies.
virtual void add_bitmap_info (bitmap_info *)
 All bitmap_info's used by this movie should be registered with this API.
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)
 Ensure that frame number 'framenum' (1-based offset) has been loaded (load on demand).
virtual void load_next_frame_chunk ()
 Load next chunk of this movie/sprite frames if available.
virtual void addTimelineDepth (int)
 Add a depth to the timeline depth set in current frame.
virtual void removeTimelineDepth (int)
 Remove a depth from the timeline depth set in current frame.
virtual void getTimelineDepths (size_t, std::vector< int > &)
 Get the set of timeline depths supposed to contain an instance in the given frame (0-based).

Classes

class  import_visitor
 Call visit_imported_movies() to retrieve a list of names of movies imported into this movie. More...


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

This design is uncomfortable when it comes to programmatically created characters, in that they do NOT have any *fixed* definition. A possible workaround to this would be not *requiring* character instances to have an associated character_def. I'll work on this --strk 2006-12-05.


Member Typedef Documentation

typedef std::vector<ControlTag*> gnash::movie_definition::PlayList


Member Function Documentation

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

Implemented in gnash::BitmapMovieDefinition, gnash::movie_def_impl, and gnash::DummyMovieDefinition.

virtual float gnash::movie_definition::get_width_pixels (  )  const [pure virtual]

Implemented in gnash::BitmapMovieDefinition, gnash::movie_def_impl, and gnash::DummyMovieDefinition.

virtual float gnash::movie_definition::get_height_pixels (  )  const [pure virtual]

Implemented in gnash::BitmapMovieDefinition, gnash::movie_def_impl, and gnash::DummyMovieDefinition.

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

Implemented in gnash::BitmapMovieDefinition, gnash::movie_def_impl, and gnash::DummyMovieDefinition.

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

Implemented in gnash::BitmapMovieDefinition, gnash::movie_def_impl, and gnash::DummyMovieDefinition.

virtual const rect& gnash::movie_definition::get_frame_size (  )  const [pure virtual]

Return size of frame, in TWIPS.

Implemented in gnash::BitmapMovieDefinition, gnash::movie_def_impl, and gnash::DummyMovieDefinition.

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

Implemented in gnash::BitmapMovieDefinition, gnash::movie_def_impl, and gnash::DummyMovieDefinition.

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::BitmapMovieDefinition, gnash::movie_def_impl, and gnash::DummyMovieDefinition.

virtual movie_instance* gnash::movie_definition::create_movie_instance ( character = 0  )  [inline, virtual]

Create a movie instance from a def.

Not all movie definitions allow creation of movie_instance. In particular, sprite_definition can only create sprite_instance, 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_instance. movie_def_impl is one such example, future examples should include jpeg_movie_def and similar..

Reimplemented in gnash::BitmapMovieDefinition, gnash::movie_def_impl, and gnash::DummyMovieDefinition.

virtual void gnash::movie_definition::visit_imported_movies ( import_visitor  )  [inline, virtual]

Reimplemented in gnash::movie_def_impl.

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

Call this to resolve an import of the given movie.

Replaces the dummy placeholder with the real movie_definition* given.

The default implementation is a no-op.

See also:
add_import

Reimplemented in gnash::movie_def_impl.

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

Reimplemented in gnash::movie_def_impl.

virtual bitmap_info* gnash::movie_definition::get_bitmap_info ( int   )  const [inline, virtual]

Reimplemented in gnash::movie_def_impl.

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

Return the list of execute tags for given frame number.

Parameters:
frame_number Frame 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::movie_def_impl.

virtual boost::intrusive_ptr<resource> gnash::movie_definition::get_exported_resource ( const std::string &   )  [inline, virtual]

Get the named exported resource, if we expose it.

Parameters:
symbol The symbol name. Matching should be case-insensitive for all SWF versions.
Returns:
NULL if the label doesn't correspond to an exported resource. This is the default behaviour.

Reimplemented in gnash::movie_def_impl.

virtual character_def* gnash::movie_definition::get_character_def ( int   )  [inline, virtual]

Get a character from the dictionary.

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

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

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

virtual bool gnash::movie_definition::get_labeled_frame ( const std::string &  ,
size_t &   
) [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:
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.
Returns:
true if a frame with that label was found, false otherwise

Reimplemented in gnash::movie_def_impl.

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::BitmapMovieDefinition, gnash::movie_def_impl, and gnash::DummyMovieDefinition.

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

Add a character with given ID to the CharactersDictionary.

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

Reimplemented in gnash::movie_def_impl.

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

Add a font character 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::movie_def_impl.

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

Return the font with given character id.

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

Reimplemented in gnash::movie_def_impl.

virtual void gnash::movie_definition::addControlTag ( ControlTag  )  [inline, virtual]

Add an ControlTag to this movie_definition's playlist.

The default implementation is a no-op.

Parameters:
tag The tag to add in the list of executable tags for the frame currently being loaded. Ownership is transferred to the movie_def_impl.
TODO: take an auto_ptr. NOTE: the default implementation just let the ControlTag leak.

Reimplemented in gnash::movie_def_impl.

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::movie_def_impl.

virtual void gnash::movie_definition::set_jpeg_loader ( std::auto_ptr< jpeg::input  )  [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::movie_def_impl.

virtual jpeg::input* gnash::movie_definition::get_jpeg_loader (  )  [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::movie_def_impl.

virtual bitmap_character_def* gnash::movie_definition::get_bitmap_character_def ( int   )  [inline, virtual]

Get a bitmap character from the dictionary.

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

Returns:
NULL if no character with the given ID is found, or if the corresponding character is not a bitmap.
The default implementation returns NULL.

Reimplemented in gnash::movie_def_impl.

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

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

The default implementation is a no-op

Reimplemented in gnash::movie_def_impl.

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

Get the sound sample with given ID.

Returns:
NULL if the given character ID isn't found in the dictionary or it is not a sound sample.
The default implementation always returns NULL

Reimplemented in gnash::movie_def_impl.

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

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

The default implementation is a no-op

Reimplemented in gnash::movie_def_impl.

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::movie_def_impl.

virtual int gnash::movie_definition::get_loading_sound_stream_id (  )  [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::movie_def_impl.

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

Mark the given resource as "exported" with the given linkage name.

Note that any previously exported resource with the same linkage name will become unreachable (export override).

See also:
get_exported_resource
The default implementation is a no-op

Reimplemented in gnash::movie_def_impl.

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

Adds an entry to a table of resources that need to be imported from other movies.

Client code must call resolve_import() later, when the source movie has been loaded, so that the actual resource can be used.

This mechanism (add_import/resolve_import) is only used by the IMPORT tag loader if s_no_recurse_while_loading is true, which currently NEVER happens using the standard executables.

The default implementation is a no-op.

Reimplemented in gnash::movie_def_impl.

virtual void gnash::movie_definition::add_bitmap_info ( bitmap_info  )  [inline, virtual]

All bitmap_info's used by this movie should be registered with this API.

This was likely used for 'caching' renderer-specific versions of bitmaps. I'm not sure it is really needed currently (caching on disk is broken).

The default implementation is a no-op

Reimplemented in gnash::movie_def_impl.

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::BitmapMovieDefinition, gnash::movie_def_impl, and gnash::DummyMovieDefinition.

virtual bool gnash::movie_definition::completeLoad (  )  [inline, virtual]

Reimplemented in gnash::movie_def_impl.

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

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

Parameters:
framenum 1-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::movie_def_impl.

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

Load next chunk of this movie/sprite frames if available.

The default implementation is a no-op

Reimplemented in gnash::movie_def_impl.

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

Add a depth to the timeline depth set in current frame.

The default implementations is a no-op

It is overridden by timeline-equipped definitions:

Parameters:
depth Depth of an instance placed by PlaceObject* tag. Assumed to be in the static zone (an assertion would fail otherwise).

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

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

Remove a depth from the timeline depth set in current frame.

The default implementations is a no-op

It is overridden by timeline-equipped definitions:

Parameters:
depth Depth of an instance placed by PlaceObject* tag. Assumed to be in the static zone (an assertion would fail otherwise).

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

virtual void gnash::movie_definition::getTimelineDepths ( size_t  ,
std::vector< int > &   
) [inline, virtual]

Get the set of timeline depths supposed to contain an instance in the given frame (0-based).

The default implementations is a no-op

PRECONDITIONS:

Parameters:
frameno 0-based frame number we want to inspect. Assumed to be in the static zone.
depths A vector to copy all frame depths to.

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


The documentation for this class was generated from the following file:
Generated on Thu Mar 6 18:25:11 2008 for Gnash by  doxygen 1.5.4