xoreos  0.0.5
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Sound::AACDecoder Class Reference
Inheritance diagram for Sound::AACDecoder:
Inheritance graph
[legend]
Collaboration diagram for Sound::AACDecoder:
Collaboration graph
[legend]

Public Member Functions

 AACDecoder (Common::SeekableReadStream &stream)
 
 ~AACDecoder ()
 
int getChannels () const
 Return the number channels in this stream. More...
 
int getRate () const
 Sample rate of the stream. More...
 
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. More...
 
bool endOfStream () const
 End of stream reached? If this returns true, it means that all data in this stream is used up and no additional data will appear in it in the future. More...
 
size_t readBuffer (int16 *buffer, const size_t numSamples)
 Fill the given buffer with up to numSamples samples. More...
 
void finish ()
 Mark this stream as finished. More...
 
bool isFinished () const
 Is the stream marked as finished? More...
 
void queuePacket (Common::SeekableReadStream *data)
 Queue the next packet to be decoded. More...
 
- Public Member Functions inherited from Sound::PacketizedAudioStream
virtual ~PacketizedAudioStream ()
 
- Public Member Functions inherited from Sound::AudioStream
virtual ~AudioStream ()
 

Private Member Functions

AudioStreamdecodeFrame (Common::SeekableReadStream &stream)
 

Private Attributes

NeAACDecHandle _handle
 
byte _channels
 
unsigned long _rate
 
Common::ScopedPtr< QueuingAudioStream_audStream
 

Additional Inherited Members

- Static Public Attributes inherited from Sound::AudioStream
static const size_t kSizeInvalid = SIZE_MAX
 

Detailed Description

Definition at line 43 of file aac.cpp.

Constructor & Destructor Documentation

◆ AACDecoder()

Sound::AACDecoder::AACDecoder ( Common::SeekableReadStream stream)

◆ ~AACDecoder()

Sound::AACDecoder::~AACDecoder ( )

Definition at line 98 of file aac.cpp.

References _handle.

Member Function Documentation

◆ decodeFrame()

AudioStream * Sound::AACDecoder::decodeFrame ( Common::SeekableReadStream stream)
private

◆ endOfData()

bool Sound::AACDecoder::endOfData ( ) const
inlinevirtual

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 Sound::AudioStream.

Definition at line 51 of file aac.cpp.

References _audStream.

◆ endOfStream()

bool Sound::AACDecoder::endOfStream ( ) const
inlinevirtual

End of stream reached? If this returns true, it means that all data in this stream is used up and no additional data will appear in it in the future.

This is used by the mixer to decide whether a given stream shall be removed from the list of active streams (and thus be destroyed). By default this maps to endOfData()

Reimplemented from Sound::AudioStream.

Definition at line 52 of file aac.cpp.

References _audStream.

◆ finish()

void Sound::AACDecoder::finish ( )
inlinevirtual

Mark this stream as finished.

That is, signal that no further data will be queued to it. Only after this has been done can this stream ever 'end'.

Implements Sound::PacketizedAudioStream.

Definition at line 56 of file aac.cpp.

References _audStream.

◆ getChannels()

int Sound::AACDecoder::getChannels ( ) const
inlinevirtual

Return the number channels in this stream.

Implements Sound::AudioStream.

Definition at line 49 of file aac.cpp.

References _channels.

◆ getRate()

int Sound::AACDecoder::getRate ( ) const
inlinevirtual

Sample rate of the stream.

Implements Sound::AudioStream.

Definition at line 50 of file aac.cpp.

References _rate.

◆ isFinished()

bool Sound::AACDecoder::isFinished ( ) const
inlinevirtual

Is the stream marked as finished?

Implements Sound::PacketizedAudioStream.

Definition at line 57 of file aac.cpp.

References _audStream.

◆ queuePacket()

void Sound::AACDecoder::queuePacket ( Common::SeekableReadStream data)
virtual

Queue the next packet to be decoded.

Implements Sound::PacketizedAudioStream.

Definition at line 135 of file aac.cpp.

References _audStream, and decodeFrame().

Here is the call graph for this function:

◆ readBuffer()

size_t Sound::AACDecoder::readBuffer ( int16 buffer,
const size_t  numSamples 
)
inlinevirtual

Fill the given buffer with up to numSamples samples.

Returns the actual number of samples read, or kSizeInvalid 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 endianness, 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.

The same holds true for more channels. Channel configurations recognized:

  • 5.1: front left, front right, front center, low frequency rear left, rear right

Implements Sound::AudioStream.

Definition at line 53 of file aac.cpp.

References _audStream.

Member Data Documentation

◆ _audStream

Common::ScopedPtr<QueuingAudioStream> Sound::AACDecoder::_audStream
private

Definition at line 66 of file aac.cpp.

Referenced by AACDecoder(), endOfData(), endOfStream(), finish(), isFinished(), queuePacket(), and readBuffer().

◆ _channels

byte Sound::AACDecoder::_channels
private

Definition at line 62 of file aac.cpp.

Referenced by AACDecoder(), decodeFrame(), and getChannels().

◆ _handle

NeAACDecHandle Sound::AACDecoder::_handle
private

Definition at line 61 of file aac.cpp.

Referenced by AACDecoder(), decodeFrame(), and ~AACDecoder().

◆ _rate

unsigned long Sound::AACDecoder::_rate
private

Definition at line 63 of file aac.cpp.

Referenced by AACDecoder(), decodeFrame(), and getRate().


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