Gnash
0.8.10
|
Definition of an embedded sound. More...
#include <StreamingSoundData.h>
Classes | |
struct | BlockData |
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 SimpleBuffer & | getBlock (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. | |
InputStream * | firstPlayingInstance () const |
Return the first created instance of this sound. | |
std::auto_ptr< StreamingSound > | createInstance (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 |
Definition of an embedded sound.
typedef std::list<InputStream*> gnash::sound::StreamingSoundData::Instances |
Container for the active instances of this sounds being played.
NOTE: This class does NOT own the active sounds
gnash::sound::StreamingSoundData::StreamingSoundData | ( | const media::SoundInfo & | info, |
int | nVolume | ||
) |
Construct a sound with given data, info and volume.
info | encoding info |
nVolume | initial volume (0..100). |
gnash::sound::StreamingSoundData::~StreamingSoundData | ( | ) |
References clearInstances().
size_t gnash::sound::StreamingSoundData::append | ( | std::auto_ptr< SimpleBuffer > | data, |
size_t | sampleCount, | ||
int | seekSamples | ||
) |
Append a sound data block.
data | Undecoded sound data. Must be appropriately padded (see MediaHandler::getInputPaddingBytes()) |
sampleCount | The number of samples when decoded. |
seekSamples | Where to start playing from at a particular frame. |
References assert.
Referenced by gnash::sound::sound_handler::addSoundBlock().
size_t gnash::sound::StreamingSoundData::blockCount | ( | ) | const [inline] |
void gnash::sound::StreamingSoundData::clearInstances | ( | ) |
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
mh | The MediaHandler to use for on-demand decoding |
blockOffset | Block number in the immutable (encoded) data this instance should start decoding. This refers to a specific StreamSoundBlock. |
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
Referenced by gnash::sound::StreamingSound::~StreamingSound(), and eraseActiveSound().
void gnash::sound::StreamingSoundData::eraseActiveSound | ( | InputStream * | inst | ) |
Drop an active sound (by pointer)
inst | The 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::i, and gnash::key::e.
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 |
Object holding information about the sound.
Volume for AS-sounds, range: 0-100. It's the SWF range that is represented here.