Gnash  0.8.11dev
Public Types | Public Member Functions | Public Attributes | List of all members
gnash::sound::StreamingSoundData Class Reference

Definition of an embedded sound. More...

#include <StreamingSoundData.h>

Public Types

typedef std::list< InputStream * > Instances
 Container for the active instances of this sounds being played.

Public Member Functions

 StreamingSoundData (const media::SoundInfo &info, int nVolume)
 Construct a sound with given data, info and volume.
 ~StreamingSoundData ()
size_t append (std::auto_ptr< SimpleBuffer > data, size_t sampleCount, int seekSamples)
 Append a sound data block.
bool empty () const
 Do we have any data?
const SimpleBuffergetBlock (size_t index) const
size_t getSampleCount (size_t index) const
size_t getSeekSamples (size_t index) const
size_t blockCount () const
size_t playingBlock () const
bool isPlaying () const
 Are there known playing instances of this sound ?
size_t numPlayingInstances () const
 Return number of playing instances of this sound.
void getPlayingInstances (std::vector< InputStream * > &to) const
 Append to the given vector all playing instances of this sound def.
InputStreamfirstPlayingInstance () const
 Return the first created instance of this sound.
std::auto_ptr< StreamingSoundcreateInstance (media::MediaHandler &mh, unsigned long blockOffset)
 Create an instance of this sound.
void clearInstances ()
 Drop all active sounds.
Instances::iterator eraseActiveSound (Instances::iterator i)
 Drop an active sound (by iterator)
void eraseActiveSound (InputStream *inst)
 Drop an active sound (by pointer)

Public Attributes

media::SoundInfo soundinfo
 Object holding information about the sound.
int volume

Detailed Description

Definition of an embedded sound.

Member Typedef Documentation

Container for the active instances of this sounds being played.

NOTE: This class does NOT own the active sounds

Constructor & Destructor Documentation

gnash::sound::StreamingSoundData::StreamingSoundData ( const media::SoundInfo info,
int  nVolume 
)

Construct a sound with given data, info and volume.

Parameters
infoencoding info
nVolumeinitial volume (0..100).
gnash::sound::StreamingSoundData::~StreamingSoundData ( )

References clearInstances().

Member Function Documentation

size_t gnash::sound::StreamingSoundData::append ( std::auto_ptr< SimpleBuffer data,
size_t  sampleCount,
int  seekSamples 
)

Append a sound data block.

Parameters
dataUndecoded sound data. Must be appropriately padded (see MediaHandler::getInputPaddingBytes())
sampleCountThe number of samples when decoded.
seekSamplesWhere to start playing from at a particular frame.

Referenced by gnash::sound::sound_handler::addSoundBlock().

size_t gnash::sound::StreamingSoundData::blockCount ( ) const
inline
void gnash::sound::StreamingSoundData::clearInstances ( )

Drop all active sounds.

Locks _soundInstancesMutex

Referenced by ~StreamingSoundData().

std::auto_ptr< StreamingSound > gnash::sound::StreamingSoundData::createInstance ( media::MediaHandler mh,
unsigned long  blockOffset 
)

Create an instance of this sound.

The returned instance ownership is transferred

Parameters
mhThe MediaHandler to use for on-demand decoding
blockOffsetBlock number in the immutable (encoded) data this instance should start decoding. This refers to a specific StreamSoundBlock.
See Also
gnash::swf::StreamSoundBlockTag Locks the _soundInstancesMutex when pushing to it

Referenced by gnash::sound::sound_handler::playStream().

bool gnash::sound::StreamingSoundData::empty ( ) const
inline

Do we have any data?

Referenced by gnash::sound::sound_handler::playStream().

StreamingSoundData::Instances::iterator gnash::sound::StreamingSoundData::eraseActiveSound ( Instances::iterator  i)

Drop an active sound (by iterator)

Does NOT lock the _soundInstancesMutex

Returns
iterator after the one being erased

Referenced by eraseActiveSound(), and gnash::sound::StreamingSound::~StreamingSound().

void gnash::sound::StreamingSoundData::eraseActiveSound ( InputStream inst)

Drop an active sound (by pointer)

Parameters
instThe active sound instance to unregister

This is intended to be called by StreamingSoundDataInst destructor, which may be called by a separate thread so MUST be thread-safe

Does lock the _soundInstancesMutex

References eraseActiveSound().

InputStream * gnash::sound::StreamingSoundData::firstPlayingInstance ( ) const

Return the first created instance of this sound.

Locks _soundInstancesMutex

const SimpleBuffer& gnash::sound::StreamingSoundData::getBlock ( size_t  index) const
inline
void gnash::sound::StreamingSoundData::getPlayingInstances ( std::vector< InputStream * > &  to) const

Append to the given vector all playing instances of this sound def.

References gnash::key::e, and gnash::key::i.

size_t gnash::sound::StreamingSoundData::getSampleCount ( size_t  index) const
inline
size_t gnash::sound::StreamingSoundData::getSeekSamples ( size_t  index) const
inline
bool gnash::sound::StreamingSoundData::isPlaying ( ) const

Are there known playing instances of this sound ?

Locks _soundInstancesMutex

Referenced by gnash::sound::sound_handler::playStream().

size_t gnash::sound::StreamingSoundData::numPlayingInstances ( ) const

Return number of playing instances of this sound.

Locks _soundInstancesMutex

Referenced by gnash::sound::sound_handler::delete_all_sounds().

size_t gnash::sound::StreamingSoundData::playingBlock ( ) const

Member Data Documentation

media::SoundInfo gnash::sound::StreamingSoundData::soundinfo

Object holding information about the sound.

int gnash::sound::StreamingSoundData::volume

Volume for AS-sounds, range: 0-100. It's the SWF range that is represented here.


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