gnash::movie_def_impl Class Reference

Immutable definition of a movie's contents. More...

#include <movie_def_impl.h>

Inheritance diagram for gnash::movie_def_impl:

gnash::movie_definition gnash::character_def gnash::resource gnash::ref_counted

List of all members.

Public Member Functions

 movie_def_impl ()
 ~movie_def_impl ()
size_t get_frame_count () const
float get_frame_rate () const
const rectget_frame_size () const
 Return size of frame, in TWIPS.
float get_width_pixels () const
float get_height_pixels () const
virtual int get_version () const
virtual size_t get_loading_frame () const
 Get the number of fully loaded frames.
size_t get_bytes_loaded () const
 Get number of bytes loaded from input stream.
size_t get_bytes_total () const
 Get total number of bytes as parsed from the SWF header.
virtual void add_bitmap_info (bitmap_info *bi)
virtual int get_bitmap_info_count () const
virtual bitmap_infoget_bitmap_info (int i) const
virtual void export_resource (const std::string &symbol, resource *res)
 Mark the given resource as "exported" with the given linkage name.
virtual boost::intrusive_ptr
< resource
get_exported_resource (const std::string &symbol)
 Get the named exported resource, if we expose it.
virtual void add_import (const std::string &source_url, int id, const std::string &symbol)
 Adds an entry to a table of resources that need to be imported from other movies.
virtual void visit_imported_movies (import_visitor &visitor)
 Calls back the visitor for each movie that we import symbols from.
virtual void resolve_import (const std::string &source_url, movie_definition *source_movie)
 Call this to resolve an import of the given movie.
void add_character (int character_id, character_def *c)
 Add a character with given ID to the CharactersDictionary.
character_defget_character_def (int character_id)
 Return a character from the dictionary NOTE: call add_ref() on the return or put in a boost::intrusive_ptr<> TODO: return a boost::intrusive_ptr<> directly...
bool get_labeled_frame (const std::string &label, size_t &frame_number)
 Get 0-based index of the frame with given label.
void add_font (int font_id, font *f)
 Add a font character with given ID to the CharacterDictionary.
fontget_font (int font_id) const
 Return the font with given character id.
bitmap_character_defget_bitmap_character_def (int character_id)
 Get a bitmap character from the dictionary.
void add_bitmap_character_def (int character_id, bitmap_character_def *ch)
 Add a bitmap character in the dictionary, with the specified character id.
sound_sampleget_sound_sample (int character_id)
 Get the sound sample with given ID.
virtual void add_sound_sample (int character_id, sound_sample *sam)
 Add a sound sample character in the dictionary, with the specified character id.
virtual void set_loading_sound_stream_id (int id)
 Set the currently being loaded sound stream.
int get_loading_sound_stream_id ()
 Get the currently being loaded sound stream, if any.
void addControlTag (ControlTag *tag)
 Add an ControlTag to this movie_definition's playlist.
void add_frame_name (const std::string &name)
 Labels the frame currently being loaded with the given name.
void set_jpeg_loader (std::auto_ptr< jpeg::input > j_in)
jpeg::inputget_jpeg_loader ()
 Get the jpeg input loader, to load a DefineBits image (one without table info).
virtual const PlayListgetPlaylist (size_t frame_number) const
 Return the list of execute tags for given frame number.
bool read (std::auto_ptr< tu_file > in, const std::string &url)
 Calls readHeader() and completeLoad() in sequence.
bool readHeader (std::auto_ptr< tu_file > in, const std::string &url)
 Read the header of the SWF file.
bool completeLoad ()
 Complete load of the SWF file.
bool ensure_frame_loaded (size_t framenum)
 Ensure that frame number 'framenum' (1-based offset) has been loaded (load on demand).
void read_all_swf ()
 Read and parse all the SWF stream (blocking until load is finished).
virtual void load_next_frame_chunk ()
 Load next chunk of this movie/sprite frames if available.
void get_owned_fonts (std::vector< font * > *fonts)
 Fill up *fonts with fonts that we own.
movie_instancecreate_movie_instance (character *parent=0)
 Create an instance of this movie.
virtual const std::string & get_url () const
 Return the URL of the SWF stream this definition has been read from.
const rectget_bound () const
void addTimelineDepth (int depth)
 Add a depth to the timeline depth set in current frame.
void removeTimelineDepth (int depth)
 Remove a depth from the timeline depth set in current frame.
void getTimelineDepths (size_t frameno, std::vector< int > &depths)
 Get the set of timeline depths supposed to contain an instance in the given frame (0-based).


Detailed Description

Immutable definition of a movie's contents.

It cannot be played directly, and does not hold current state; for that you need to call create_movie_instance() to get a movie instance


Constructor & Destructor Documentation

gnash::movie_def_impl::movie_def_impl (  ) 

gnash::movie_def_impl::~movie_def_impl (  ) 


Member Function Documentation

size_t gnash::movie_def_impl::get_frame_count (  )  const [inline, virtual]

Implements gnash::movie_definition.

float gnash::movie_def_impl::get_frame_rate (  )  const [inline, virtual]

Implements gnash::movie_definition.

const rect& gnash::movie_def_impl::get_frame_size (  )  const [inline, virtual]

Return size of frame, in TWIPS.

Implements gnash::movie_definition.

float gnash::movie_def_impl::get_width_pixels (  )  const [inline, virtual]

Implements gnash::movie_definition.

float gnash::movie_def_impl::get_height_pixels (  )  const [inline, virtual]

Implements gnash::movie_definition.

virtual int gnash::movie_def_impl::get_version (  )  const [inline, virtual]

Implements gnash::movie_definition.

size_t gnash::movie_def_impl::get_loading_frame (  )  const [virtual]

Get the number of fully loaded frames.

The number returned is also the index of the frame currently being loaded/parsed, except when parsing finishes, in which case it an index to on-past-last frame.

NOTE: this method locks _frames_loaded_mutex

Implements gnash::movie_definition.

size_t gnash::movie_def_impl::get_bytes_loaded (  )  const [inline, virtual]

Get number of bytes loaded from input stream.

NOTE: this method locks _bytes_loaded_mutex

Implements gnash::movie_definition.

size_t gnash::movie_def_impl::get_bytes_total (  )  const [inline, virtual]

Get total number of bytes as parsed from the SWF header.

Implements gnash::movie_definition.

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

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

Reimplemented from gnash::movie_definition.

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

Reimplemented from gnash::movie_definition.

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

Reimplemented from gnash::movie_definition.

void gnash::movie_def_impl::export_resource ( const std::string &  ,
resource  
) [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 from gnash::movie_definition.

boost::intrusive_ptr< resource > gnash::movie_def_impl::get_exported_resource ( const std::string &  symbol  )  [virtual]

Get the named exported resource, if we expose it.

Returns:
NULL if the label doesn't correspond to an exported resource, or if a timeout occurs while scanning the movie.

Reimplemented from gnash::movie_definition.

virtual void gnash::movie_def_impl::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 from gnash::movie_definition.

void gnash::movie_def_impl::visit_imported_movies ( import_visitor visitor  )  [virtual]

Calls back the visitor for each movie that we import symbols from.

Reimplemented from gnash::movie_definition.

void gnash::movie_def_impl::resolve_import ( const std::string &  ,
movie_definition  
) [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 from gnash::movie_definition.

void gnash::movie_def_impl::add_character ( int  ,
character_def  
) [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 from gnash::movie_definition.

character_def * gnash::movie_def_impl::get_character_def ( int  character_id  )  [virtual]

Return a character from the dictionary NOTE: call add_ref() on the return or put in a boost::intrusive_ptr<> TODO: return a boost::intrusive_ptr<> directly...

Reimplemented from gnash::movie_definition.

bool gnash::movie_def_impl::get_labeled_frame ( const std::string &  ,
size_t &   
) [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 from gnash::movie_definition.

void gnash::movie_def_impl::add_font ( int  ,
font  
) [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 from gnash::movie_definition.

font * gnash::movie_def_impl::get_font ( int   )  const [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 from gnash::movie_definition.

bitmap_character_def * gnash::movie_def_impl::get_bitmap_character_def ( int   )  [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 from gnash::movie_definition.

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

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

The default implementation is a no-op

Reimplemented from gnash::movie_definition.

sound_sample * gnash::movie_def_impl::get_sound_sample ( int   )  [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 from gnash::movie_definition.

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

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

The default implementation is a no-op

Reimplemented from gnash::movie_definition.

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

Set the currently being loaded sound stream.

The default implementation is a no-op

Reimplemented from gnash::movie_definition.

int gnash::movie_def_impl::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 from gnash::movie_definition.

void gnash::movie_def_impl::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 from gnash::movie_definition.

void gnash::movie_def_impl::add_frame_name ( const std::string &   )  [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 from gnash::movie_definition.

void gnash::movie_def_impl::set_jpeg_loader ( std::auto_ptr< jpeg::input j_in  )  [inline, virtual]

Set an input object for later loading DefineBits images (JPEG images without the table info).

Reimplemented from gnash::movie_definition.

jpeg::input* gnash::movie_def_impl::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 from gnash::movie_definition.

virtual const PlayList* gnash::movie_def_impl::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 from gnash::movie_definition.

bool gnash::movie_def_impl::read ( std::auto_ptr< tu_file in,
const std::string &  url 
)

Calls readHeader() and completeLoad() in sequence.

Returns:
false on failure see description of readHeader() and completeLoad() for possible reasons of failures

bool gnash::movie_def_impl::readHeader ( std::auto_ptr< tu_file in,
const std::string &  url 
)

Read the header of the SWF file.

This function only reads the header of the SWF stream and assigns the movie an URL. Call completeLoad() to fire up the loader thread.

Parameters:
in the tu_file from which to read SWF
url the url associated with the input
Returns:
false if SWF header could not be parsed

bool gnash::movie_def_impl::completeLoad (  )  [virtual]

Complete load of the SWF file.

This function completes parsing of the SWF stream engaging a separate thread. Make sure you called readHeader before this!

Returns:
false if the loading thread could not be started.

Reimplemented from gnash::movie_definition.

bool gnash::movie_def_impl::ensure_frame_loaded ( size_t  framenum  )  [virtual]

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

Reimplemented from gnash::movie_definition.

void gnash::movie_def_impl::read_all_swf (  ) 

Read and parse all the SWF stream (blocking until load is finished).

This function uses a private TagLoadersTable to interpret specific tag types. Currently the TagLoadersTable in use is the TagLoadersTable singleton.

void gnash::movie_def_impl::load_next_frame_chunk (  )  [virtual]

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

The default implementation is a no-op

Reimplemented from gnash::movie_definition.

void gnash::movie_def_impl::get_owned_fonts ( std::vector< font * > *  fonts  ) 

Fill up *fonts with fonts that we own.

movie_instance * gnash::movie_def_impl::create_movie_instance ( character parent = 0  )  [virtual]

Create an instance of this movie.

TOCHECK: Make sure you called completeLoad() before this function is invoked (calling read() will do that for you).

TOCHECK: The _root reference of the newly created movie_root will be set to a newly created movie_instance.

Reimplemented from gnash::movie_definition.

virtual const std::string& gnash::movie_def_impl::get_url (  )  const [inline, virtual]

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

Implements gnash::movie_definition.

const rect& gnash::movie_def_impl::get_bound (  )  const [inline, virtual]

Implements gnash::character_def.

void gnash::movie_def_impl::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 from gnash::movie_definition.

void gnash::movie_def_impl::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 from gnash::movie_definition.

void gnash::movie_def_impl::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 from gnash::movie_definition.


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