xoreos
0.0.5
|
Public Member Functions | |
PacketizedVorbisStream () | |
~PacketizedVorbisStream () | |
bool | parseExtraData (Common::SeekableReadStream &stream) |
bool | parseExtraData (Common::SeekableReadStream &packet1, Common::SeekableReadStream &packet2, Common::SeekableReadStream &packet3) |
int | getChannels () const |
Return the number channels in this stream. More... | |
int | getRate () const |
Sample rate of the stream. More... | |
size_t | readBuffer (int16 *buffer, const size_t numSamples) |
Fill the given buffer with up to numSamples samples. 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... | |
void | queuePacket (Common::SeekableReadStream *packet) |
Queue the next packet to be decoded. More... | |
void | finish () |
Mark this stream as finished. More... | |
bool | isFinished () const |
Is the stream marked as finished? More... | |
Public Member Functions inherited from Sound::PacketizedAudioStream | |
virtual | ~PacketizedAudioStream () |
Public Member Functions inherited from Sound::AudioStream | |
virtual | ~AudioStream () |
Private Attributes | |
vorbis_info | _vorbisInfo |
vorbis_dsp_state | _dspState |
vorbis_block | _block |
vorbis_comment | _comment |
ogg_packet | _packet |
bool | _init |
Common::Mutex | _mutex |
std::queue< Common::SeekableReadStream * > | _queue |
bool | _finished |
bool | _hasData |
Additional Inherited Members | |
Static Public Attributes inherited from Sound::AudioStream | |
static const size_t | kSizeInvalid = SIZE_MAX |
Definition at line 257 of file vorbis.cpp.
Sound::PacketizedVorbisStream::PacketizedVorbisStream | ( | ) |
Definition at line 292 of file vorbis.cpp.
References _comment, _finished, _hasData, _init, _packet, and _vorbisInfo.
Sound::PacketizedVorbisStream::~PacketizedVorbisStream | ( | ) |
Definition at line 301 of file vorbis.cpp.
References _block, _comment, _dspState, _init, _queue, and _vorbisInfo.
|
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 Sound::AudioStream.
Definition at line 490 of file vorbis.cpp.
References _hasData, _mutex, and _queue.
Referenced by endOfStream().
|
virtual |
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 495 of file vorbis.cpp.
References _finished, _mutex, and endOfData().
|
virtual |
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 506 of file vorbis.cpp.
|
inlinevirtual |
Return the number channels in this stream.
Implements Sound::AudioStream.
Definition at line 266 of file vorbis.cpp.
References _vorbisInfo.
Referenced by readBuffer().
|
inlinevirtual |
Sample rate of the stream.
Implements Sound::AudioStream.
Definition at line 267 of file vorbis.cpp.
References _vorbisInfo.
|
virtual |
Is the stream marked as finished?
Implements Sound::PacketizedAudioStream.
Definition at line 511 of file vorbis.cpp.
bool Sound::PacketizedVorbisStream::parseExtraData | ( | Common::SeekableReadStream & | stream | ) |
Definition at line 317 of file vorbis.cpp.
References _block, _comment, _dspState, _init, _packet, _vorbisInfo, Common::ScopedPtrBase< T, Deallocator >::get(), Common::SeekableReadStream::pos(), Common::ReadStream::read(), Common::ReadStream::readByte(), Common::ReadStream::readUint16BE(), Common::ScopedPtrBase< T, Deallocator >::reset(), Common::SeekableReadStream::seek(), Common::SeekableReadStream::size(), and warning().
bool Sound::PacketizedVorbisStream::parseExtraData | ( | Common::SeekableReadStream & | packet1, |
Common::SeekableReadStream & | packet2, | ||
Common::SeekableReadStream & | packet3 | ||
) |
Definition at line 394 of file vorbis.cpp.
References _block, _comment, _dspState, _init, _packet, _vorbisInfo, Common::ScopedPtrBase< T, Deallocator >::get(), READ_WHOLE_STREAM, and warning().
|
virtual |
Queue the next packet to be decoded.
Implements Sound::PacketizedAudioStream.
Definition at line 500 of file vorbis.cpp.
|
virtual |
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:
Implements Sound::AudioStream.
Definition at line 431 of file vorbis.cpp.
References _block, _dspState, _hasData, _init, _mutex, _packet, _queue, getChannels(), and warning().
|
private |
Definition at line 281 of file vorbis.cpp.
Referenced by parseExtraData(), readBuffer(), and ~PacketizedVorbisStream().
|
private |
Definition at line 282 of file vorbis.cpp.
Referenced by PacketizedVorbisStream(), parseExtraData(), and ~PacketizedVorbisStream().
|
private |
Definition at line 280 of file vorbis.cpp.
Referenced by parseExtraData(), readBuffer(), and ~PacketizedVorbisStream().
|
private |
Definition at line 288 of file vorbis.cpp.
Referenced by endOfStream(), finish(), isFinished(), PacketizedVorbisStream(), and queuePacket().
|
private |
Definition at line 289 of file vorbis.cpp.
Referenced by endOfData(), PacketizedVorbisStream(), and readBuffer().
|
private |
Definition at line 284 of file vorbis.cpp.
Referenced by PacketizedVorbisStream(), parseExtraData(), readBuffer(), and ~PacketizedVorbisStream().
|
mutableprivate |
Definition at line 286 of file vorbis.cpp.
Referenced by endOfData(), endOfStream(), finish(), isFinished(), queuePacket(), and readBuffer().
|
private |
Definition at line 283 of file vorbis.cpp.
Referenced by PacketizedVorbisStream(), parseExtraData(), and readBuffer().
|
private |
Definition at line 287 of file vorbis.cpp.
Referenced by endOfData(), queuePacket(), readBuffer(), and ~PacketizedVorbisStream().
|
private |
Definition at line 279 of file vorbis.cpp.
Referenced by getChannels(), getRate(), PacketizedVorbisStream(), parseExtraData(), and ~PacketizedVorbisStream().