Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes

gnash::BufferedAudioStreamer Class Reference

Buffered AudioStreamer. More...

#include <NetStream_as.h>

Collaboration diagram for gnash::BufferedAudioStreamer:
Collaboration graph
[legend]

List of all members.

Classes

class  CursoredBuffer
 A buffer with a cursor state. More...

Public Types

typedef std::deque
< CursoredBuffer * > 
AudioQueue

Public Member Functions

 BufferedAudioStreamer (sound::sound_handler *handler)
void cleanAudioQueue ()
void attachAuxStreamer ()
 Attach the aux streamer.
void detachAuxStreamer ()
 Detach the aux streamer.
unsigned int fetch (boost::int16_t *samples, unsigned int nSamples, bool &eof)
 Fetch samples from the audio queue.
void push (CursoredBuffer *audio)
 Push a buffer to the audio queue.

Static Public Member Functions

static unsigned int fetchWrapper (void *owner, boost::int16_t *samples, unsigned int nSamples, bool &eof)
 Fetch samples from the audio queue.

Public Attributes

sound::sound_handler_soundHandler
AudioQueue _audioQueue
size_t _audioQueueSize
 Number of bytes in the audio queue, protected by _audioQueueMutex.
boost::mutex _audioQueueMutex
sound::InputStream_auxStreamer

Detailed Description

Buffered AudioStreamer.

This class you create passing a sound handler, which will be used to implement attach/detach and eventually throw away buffers of sound when no sound handler is given.

Then you push samples to a buffer of it and can request attach/detach operations. When attached, the sound handler will fetch samples from the buffer, in a thread-safe way.


Member Typedef Documentation


Constructor & Destructor Documentation

gnash::BufferedAudioStreamer::BufferedAudioStreamer ( sound::sound_handler handler  ) 
Parameters:
handler Sound handler to use for attach/detach

Member Function Documentation

void gnash::BufferedAudioStreamer::attachAuxStreamer (  ) 

Attach the aux streamer.

On success, _auxStreamerAttached will be set to true. Won't attach again if already attached.

References _auxStreamer, _soundHandler, gnash::sound::sound_handler::attach_aux_streamer(), fetchWrapper(), and gnash::sound::sound_handler::unplugInputStream().

Referenced by gnash::NetStream_as::play().

void gnash::BufferedAudioStreamer::cleanAudioQueue (  ) 
void gnash::BufferedAudioStreamer::detachAuxStreamer (  ) 

Detach the aux streamer.

_auxStreamerAttached will be set to true. Won't detach if not attached.

References _auxStreamer, _soundHandler, and gnash::sound::sound_handler::unplugInputStream().

Referenced by gnash::NetStream_as::close().

unsigned int gnash::BufferedAudioStreamer::fetch ( boost::int16_t *  samples,
unsigned int  nSamples,
bool &  eof 
)
unsigned int gnash::BufferedAudioStreamer::fetchWrapper ( void *  owner,
boost::int16_t *  samples,
unsigned int  nSamples,
bool &  eof 
) [static]

Fetch samples from the audio queue.

References fetch().

Referenced by attachAuxStreamer().

void gnash::BufferedAudioStreamer::push ( CursoredBuffer audio  ) 

Push a buffer to the audio queue.

Parameters:
audio Samples buffer, ownership transferred.
Todo:
: take something simpler (SimpleBuffer?)

References _audioQueue, _audioQueueMutex, _audioQueueSize, _auxStreamer, and gnash::BufferedAudioStreamer::CursoredBuffer::m_size.


Member Data Documentation

This is where audio frames are pushed by advance and consumed by sound_handler callback (audio_streamer)

Referenced by cleanAudioQueue(), fetch(), push(), and gnash::NetStream_as::update().

The queue needs to be protected as sound_handler callback is invoked by a separate thread (dunno if it makes sense actually)

Referenced by cleanAudioQueue(), fetch(), push(), and gnash::NetStream_as::update().

Number of bytes in the audio queue, protected by _audioQueueMutex.

Referenced by fetch(), and push().


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