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

Public Member Functions

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

Public Attributes

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

Detailed Description

Definition of an embedded sound.

Member Typedef Documentation

§ Instances

Container for the active instances of this sounds being played.

NOTE: This class does NOT own the active sounds

Constructor & Destructor Documentation

§ StreamingSoundData()

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

Construct a sound with given data, info and volume.

Parameters
infoencoding info
nVolumeinitial volume (0..100).

§ ~StreamingSoundData()

gnash::sound::StreamingSoundData::~StreamingSoundData ( )

References clearInstances().

Member Function Documentation

§ append()

size_t gnash::sound::StreamingSoundData::append ( 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().

§ blockCount()

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

References gnash::key::i.

§ clearInstances()

void gnash::sound::StreamingSoundData::clearInstances ( )

Drop all active sounds.

Locks _soundInstancesMutex

Referenced by gnash::sound::sound_handler::stopAllEventSounds(), and ~StreamingSoundData().

§ createInstance()

std::unique_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().

§ empty()

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

Do we have any data?

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

§ eraseActiveSound() [1/2]

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

§ eraseActiveSound() [2/2]

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

§ firstPlayingInstance()

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

Return the first created instance of this sound.

Locks _soundInstancesMutex

§ getBlock()

const SimpleBuffer& gnash::sound::StreamingSoundData::getBlock ( size_t  index) const
inline

§ getPlayingInstances()

void gnash::sound::StreamingSoundData::getPlayingInstances ( std::vector< InputStream *> &  to) const

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

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

§ getSampleCount()

size_t gnash::sound::StreamingSoundData::getSampleCount ( size_t  index) const
inline

§ getSeekSamples()

size_t gnash::sound::StreamingSoundData::getSeekSamples ( size_t  index) const
inline

§ isPlaying()

bool gnash::sound::StreamingSoundData::isPlaying ( ) const

Are there known playing instances of this sound ?

Locks _soundInstancesMutex

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

§ numPlayingInstances()

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

Return number of playing instances of this sound.

Locks _soundInstancesMutex

§ playingBlock()

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

Member Data Documentation

§ soundinfo

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

Object holding information about the sound.

§ volume

int gnash::sound::StreamingSoundData::volume

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

Referenced by gnash::sound::StreamingSound::StreamingSound().


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