ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge
Inheritance diagram for Audio::FLACStream:
Collaboration diagram for Audio::FLACStream:

List of all members.

Public Member Functions

 FLACStream (Common::SeekableReadStream *inStream, bool dispose)
virtual ~FLACStream ()
int readBuffer (int16 *buffer, const int numSamples)
 Fill the given buffer with up to numSamples samples.
bool isStereo () const
 Is this a stereo stream?
int getRate () const
 Sample rate of the stream.
bool endOfData () const
 End of data reached? If this returns true, it means that at this time there is no data available in the stream.
bool seek (const Timestamp &where)
 Seeks to a given offset in the stream.
Timestamp getLength () const
 Returns the length of the stream.
bool isStreamDecoderReady () const

Protected Types

enum  { BUFTYPE_BITS = 16 }
enum  { BUFFER_SIZE = 65536 }
typedef int16 SampleType
typedef void(* PFCONVERTBUFFERS )(SampleType *, const FLAC__int32 *[], uint, const uint, const uint8)

Protected Member Functions

uint getChannels () const
bool allocateBuffer (uint minSamples)
FLAC__StreamDecoderState getStreamDecoderState () const
bool processSingleBlock ()
bool processUntilEndOfMetadata ()
bool seekAbsolute (FLAC__uint64 sample)
inline::FLAC__SeekableStreamDecoderReadStatus callbackRead (FLAC__byte buffer[], FLAC_size_t *bytes)
inline::FLAC__SeekableStreamDecoderSeekStatus callbackSeek (FLAC__uint64 absoluteByteOffset)
inline::FLAC__SeekableStreamDecoderTellStatus callbackTell (FLAC__uint64 *absoluteByteOffset)
inline::FLAC__SeekableStreamDecoderLengthStatus callbackLength (FLAC__uint64 *streamLength)
bool callbackEOF ()
inline::FLAC__StreamDecoderWriteStatus callbackWrite (const ::FLAC__Frame *frame, const FLAC__int32 *const buffer[])
void callbackMetadata (const ::FLAC__StreamMetadata *metadata)
void callbackError (::FLAC__StreamDecoderErrorStatus status)

Protected Attributes

Common::SeekableReadStream_inStream
bool _disposeAfterUse
::FLAC__SeekableStreamDecoder * _decoder
FLAC__StreamMetadata_StreamInfo _streaminfo
 Header of the stream.
FLAC__uint64 _lastSample
 index + 1(!) of the last sample to be played
Timestamp _length
 total play time
bool _lastSampleWritten
 true if the last sample was decoded from the FLAC-API - there might still be data in the buffer
struct {
   SampleType   bufData [BUFFER_SIZE]
   SampleType *   bufReadPos
   uint   bufFill
_sampleCache
SampleType_outBuffer
uint _requestedSamples
PFCONVERTBUFFERS _methodConvertBuffers

Private Member Functions

void setBestConvertBufferMethod ()

Static Private Member Functions

::FLAC__SeekableStreamDecoderReadStatus callWrapRead (const ::FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], FLAC_size_t *bytes, void *clientData)
::FLAC__SeekableStreamDecoderSeekStatus callWrapSeek (const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absoluteByteOffset, void *clientData)
::FLAC__SeekableStreamDecoderTellStatus callWrapTell (const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absoluteByteOffset, void *clientData)
::FLAC__SeekableStreamDecoderLengthStatus callWrapLength (const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *streamLength, void *clientData)
static FLAC__bool callWrapEOF (const ::FLAC__SeekableStreamDecoder *decoder, void *clientData)
::FLAC__StreamDecoderWriteStatus callWrapWrite (const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 *const buffer[], void *clientData)
static void callWrapMetadata (const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__StreamMetadata *metadata, void *clientData)
static void callWrapError (const ::FLAC__SeekableStreamDecoder *decoder,::FLAC__StreamDecoderErrorStatus status, void *clientData)
static void convertBuffersGeneric (SampleType *bufDestination, const FLAC__int32 *inChannels[], uint numSamples, const uint numChannels, const uint8 numBits)
static void convertBuffersStereoNS (SampleType *bufDestination, const FLAC__int32 *inChannels[], uint numSamples, const uint numChannels, const uint8 numBits)
static void convertBuffersStereo8Bit (SampleType *bufDestination, const FLAC__int32 *inChannels[], uint numSamples, const uint numChannels, const uint8 numBits)
static void convertBuffersMonoNS (SampleType *bufDestination, const FLAC__int32 *inChannels[], uint numSamples, const uint numChannels, const uint8 numBits)
static void convertBuffersMono8Bit (SampleType *bufDestination, const FLAC__int32 *inChannels[], uint numSamples, const uint numChannels, const uint8 numBits)

Detailed Description

Definition at line 85 of file flac.cpp.


Member Typedef Documentation

typedef void(* Audio::FLACStream::PFCONVERTBUFFERS)(SampleType *, const FLAC__int32 *[], uint, const uint, const uint8) [protected]

Definition at line 122 of file flac.cpp.

typedef int16 Audio::FLACStream::SampleType [protected]

Definition at line 104 of file flac.cpp.


Member Enumeration Documentation

anonymous enum [protected]
Enumerator:
BUFTYPE_BITS 

Definition at line 105 of file flac.cpp.

anonymous enum [protected]
Enumerator:
BUFFER_SIZE 

Definition at line 107 of file flac.cpp.


Constructor & Destructor Documentation

Audio::FLACStream::FLACStream ( Common::SeekableReadStream inStream,
bool  dispose 
)

Definition at line 182 of file flac.cpp.

Audio::FLACStream::~FLACStream (  )  [virtual]

Definition at line 240 of file flac.cpp.


Member Function Documentation

bool Audio::FLACStream::allocateBuffer ( uint  minSamples  )  [protected]
bool Audio::FLACStream::callbackEOF (  )  [inline, protected]

Definition at line 657 of file flac.cpp.

void Audio::FLACStream::callbackError ( ::FLAC__StreamDecoderErrorStatus  status  )  [inline, protected]

Definition at line 669 of file flac.cpp.

FLAC__SeekableStreamDecoderLengthStatus Audio::FLACStream::callbackLength ( FLAC__uint64 *  streamLength  )  [inline, protected]

Definition at line 648 of file flac.cpp.

void Audio::FLACStream::callbackMetadata ( const ::FLAC__StreamMetadata *  metadata  )  [inline, protected]

Definition at line 662 of file flac.cpp.

FLAC__SeekableStreamDecoderReadStatus Audio::FLACStream::callbackRead ( FLAC__byte  buffer[],
FLAC_size_t bytes 
) [inline, protected]

Definition at line 372 of file flac.cpp.

FLAC__SeekableStreamDecoderSeekStatus Audio::FLACStream::callbackSeek ( FLAC__uint64  absoluteByteOffset  )  [inline, protected]

Definition at line 628 of file flac.cpp.

FLAC__SeekableStreamDecoderTellStatus Audio::FLACStream::callbackTell ( FLAC__uint64 *  absoluteByteOffset  )  [inline, protected]

Definition at line 639 of file flac.cpp.

FLAC__StreamDecoderWriteStatus Audio::FLACStream::callbackWrite ( const ::FLAC__Frame *  frame,
const FLAC__int32 *const   buffer[] 
) [inline, protected]

Definition at line 568 of file flac.cpp.

FLAC__bool Audio::FLACStream::callWrapEOF ( const ::FLAC__SeekableStreamDecoder *  decoder,
void *  clientData 
) [static, private]

Definition at line 700 of file flac.cpp.

void Audio::FLACStream::callWrapError ( const ::FLAC__SeekableStreamDecoder *  decoder,
::FLAC__StreamDecoderErrorStatus  status,
void *  clientData 
) [static, private]

Definition at line 718 of file flac.cpp.

FLAC__SeekableStreamDecoderLengthStatus Audio::FLACStream::callWrapLength ( const ::FLAC__SeekableStreamDecoder *  decoder,
FLAC__uint64 *  streamLength,
void *  clientData 
) [static, private]

Definition at line 694 of file flac.cpp.

void Audio::FLACStream::callWrapMetadata ( const ::FLAC__SeekableStreamDecoder *  decoder,
const ::FLAC__StreamMetadata *  metadata,
void *  clientData 
) [static, private]

Definition at line 712 of file flac.cpp.

FLAC__SeekableStreamDecoderReadStatus Audio::FLACStream::callWrapRead ( const ::FLAC__SeekableStreamDecoder *  decoder,
FLAC__byte  buffer[],
FLAC_size_t bytes,
void *  clientData 
) [static, private]

Definition at line 676 of file flac.cpp.

FLAC__SeekableStreamDecoderSeekStatus Audio::FLACStream::callWrapSeek ( const ::FLAC__SeekableStreamDecoder *  decoder,
FLAC__uint64  absoluteByteOffset,
void *  clientData 
) [static, private]

Definition at line 682 of file flac.cpp.

FLAC__SeekableStreamDecoderTellStatus Audio::FLACStream::callWrapTell ( const ::FLAC__SeekableStreamDecoder *  decoder,
FLAC__uint64 *  absoluteByteOffset,
void *  clientData 
) [static, private]

Definition at line 688 of file flac.cpp.

FLAC__StreamDecoderWriteStatus Audio::FLACStream::callWrapWrite ( const ::FLAC__SeekableStreamDecoder *  decoder,
const ::FLAC__Frame *  frame,
const FLAC__int32 *const   buffer[],
void *  clientData 
) [static, private]

Definition at line 706 of file flac.cpp.

void Audio::FLACStream::convertBuffersGeneric ( SampleType bufDestination,
const FLAC__int32 *  inChannels[],
uint  numSamples,
const uint  numChannels,
const uint8  numBits 
) [static, private]

Definition at line 541 of file flac.cpp.

void Audio::FLACStream::convertBuffersMono8Bit ( SampleType bufDestination,
const FLAC__int32 *  inChannels[],
uint  numSamples,
const uint  numChannels,
const uint8  numBits 
) [static, private]

Definition at line 449 of file flac.cpp.

void Audio::FLACStream::convertBuffersMonoNS ( SampleType bufDestination,
const FLAC__int32 *  inChannels[],
uint  numSamples,
const uint  numChannels,
const uint8  numBits 
) [static, private]

Definition at line 424 of file flac.cpp.

void Audio::FLACStream::convertBuffersStereo8Bit ( SampleType bufDestination,
const FLAC__int32 *  inChannels[],
uint  numSamples,
const uint  numChannels,
const uint8  numBits 
) [static, private]

Definition at line 508 of file flac.cpp.

void Audio::FLACStream::convertBuffersStereoNS ( SampleType bufDestination,
const FLAC__int32 *  inChannels[],
uint  numSamples,
const uint  numChannels,
const uint8  numBits 
) [static, private]

Definition at line 475 of file flac.cpp.

bool Audio::FLACStream::endOfData (  )  const [inline, virtual]

End of data reached? If this returns true, it means that at this time there is no data available in the stream.

However there may be more data in the future. This is used by e.g. a rate converter to decide whether to keep on converting data or stop.

Implements Audio::AudioStream.

Definition at line 134 of file flac.cpp.

uint Audio::FLACStream::getChannels (  )  const [inline, protected]

Definition at line 145 of file flac.cpp.

Timestamp Audio::FLACStream::getLength (  )  const [inline, virtual]

Returns the length of the stream.

Returns:
length as Timestamp.

Implements Audio::SeekableAudioStream.

Definition at line 141 of file flac.cpp.

int Audio::FLACStream::getRate (  )  const [inline, virtual]

Sample rate of the stream.

Implements Audio::AudioStream.

Definition at line 133 of file flac.cpp.

FLAC__StreamDecoderState Audio::FLACStream::getStreamDecoderState (  )  const [inline, protected]

Definition at line 254 of file flac.cpp.

bool Audio::FLACStream::isStereo (  )  const [inline, virtual]

Is this a stereo stream?

Implements Audio::AudioStream.

Definition at line 132 of file flac.cpp.

bool Audio::FLACStream::isStreamDecoderReady (  )  const [inline]

Definition at line 143 of file flac.cpp.

bool Audio::FLACStream::processSingleBlock (  )  [inline, protected]

Definition at line 263 of file flac.cpp.

bool Audio::FLACStream::processUntilEndOfMetadata (  )  [inline, protected]

Definition at line 272 of file flac.cpp.

int Audio::FLACStream::readBuffer ( int16 buffer,
const int  numSamples 
) [virtual]

Fill the given buffer with up to numSamples samples.

Returns the actual number of samples read, or -1 if a critical error occurred (note: you *must* check if this value is less than what you requested, this can happen when the stream is fully used up).

Data has to be in native endianess, 16 bit per sample, signed. For stereo stream, buffer will be filled with interleaved left and right channel samples, starting with a left sample. Furthermore, the samples in the left and right are summed up. So if you request 4 samples from a stereo stream, you will get a total of two left channel and two right channel samples.

Implements Audio::AudioStream.

Definition at line 302 of file flac.cpp.

bool Audio::FLACStream::seek ( const Timestamp where  )  [virtual]

Seeks to a given offset in the stream.

Parameters:
where offset as timestamp
Returns:
true on success, false on failure.

Implements Audio::SeekableAudioStream.

Definition at line 294 of file flac.cpp.

bool Audio::FLACStream::seekAbsolute ( FLAC__uint64  sample  )  [protected]

Definition at line 281 of file flac.cpp.

void Audio::FLACStream::setBestConvertBufferMethod (  )  [private]

Definition at line 399 of file flac.cpp.


Member Data Documentation

::FLAC__SeekableStreamDecoder* Audio::FLACStream::_decoder [protected]

Definition at line 90 of file flac.cpp.

Definition at line 88 of file flac.cpp.

Definition at line 87 of file flac.cpp.

FLAC__uint64 Audio::FLACStream::_lastSample [protected]

index + 1(!) of the last sample to be played

Definition at line 96 of file flac.cpp.

true if the last sample was decoded from the FLAC-API - there might still be data in the buffer

Definition at line 102 of file flac.cpp.

total play time

Definition at line 99 of file flac.cpp.

Definition at line 123 of file flac.cpp.

Definition at line 119 of file flac.cpp.

Definition at line 120 of file flac.cpp.

struct { ... } Audio::FLACStream::_sampleCache [protected]
FLAC__StreamMetadata_StreamInfo Audio::FLACStream::_streaminfo [protected]

Header of the stream.

Definition at line 93 of file flac.cpp.

Definition at line 114 of file flac.cpp.

Definition at line 116 of file flac.cpp.

Definition at line 115 of file flac.cpp.


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


Generated on Sat Nov 16 2019 05:02:34 for ResidualVM by doxygen 1.7.1
curved edge   curved edge