xoreos
0.0.5
|
Public Member Functions | |
WwRIFFVorbisStream (Common::SeekableReadStream *inStream, bool disposeStream, Common::SeekableReadStream *codebooks, bool disposeCodebooks, bool fullSetup) | |
size_t | readBuffer (int16 *buffer, const size_t numSamples) |
Fill the given buffer with up to numSamples samples. More... | |
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 | rewind () |
Rewinds the stream to its start. More... | |
uint64 | getLength () const |
Estimate the total number of samples per channel in this stream. More... | |
Public Member Functions inherited from Sound::RewindableAudioStream | |
virtual uint64 | getDuration () const |
Estimate the total duration of the stream in milliseconds. More... | |
Public Member Functions inherited from Sound::AudioStream | |
virtual | ~AudioStream () |
virtual 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... | |
Private Member Functions | |
void | init () |
Common::SeekableReadStream * | generateHeaderIdentification () |
Common::SeekableReadStream * | generateHeaderComment () |
Common::SeekableReadStream * | generateHeaderSetup () |
Common::SeekableReadStream * | createPacket () |
Private Attributes | |
Common::ScopedPtr< Sound::PacketizedAudioStream > | _vorbis |
Common::DisposablePtr< Common::SeekableReadStream > | _inStream |
Common::DisposablePtr< Common::SeekableReadStream > | _codebooks |
bool | _fullSetup |
bool | _headerTriadPresent |
bool | _oldPacketHeaders |
bool | _noGranule |
bool | _modPackets |
size_t | _dataOffset |
size_t | _dataSize |
size_t | _currentOffset |
size_t | _setupPacketOffset |
size_t | _firstAudioPacketOffset |
uint16 | _channels |
uint32 | _sampleRate |
uint32 | _averageBytesPerSecond |
uint64 | _sampleCount |
uint32 | _uid |
uint8 | _blocksize0Pow |
uint8 | _blocksize1Pow |
uint32 | _loopCount |
uint32 | _loopStart |
uint32 | _loopEnd |
Common::ScopedArray< bool > | _modeBlockFlags |
size_t | _modeBits |
bool | _end |
Additional Inherited Members | |
Static Public Attributes inherited from Sound::RewindableAudioStream | |
static const uint64 | kInvalidLength = UINT64_C(0xFFFFFFFFFFFFFFFF) |
Static Public Attributes inherited from Sound::AudioStream | |
static const size_t | kSizeInvalid = SIZE_MAX |
Definition at line 313 of file wwriffvorbis.cpp.
Sound::WwRIFFVorbisStream::WwRIFFVorbisStream | ( | Common::SeekableReadStream * | inStream, |
bool | disposeStream, | ||
Common::SeekableReadStream * | codebooks, | ||
bool | disposeCodebooks, | ||
bool | fullSetup | ||
) |
Definition at line 407 of file wwriffvorbis.cpp.
References _headerTriadPresent, _modPackets, _oldPacketHeaders, init(), and rewind().
|
private |
Definition at line 1002 of file wwriffvorbis.cpp.
References _currentOffset, _dataOffset, _dataSize, _inStream, _noGranule, Sound::Packet::headerSize(), Sound::Packet::nextOffset(), Sound::Packet::offset(), and Sound::Packet::size().
Referenced by readBuffer().
|
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 442 of file wwriffvorbis.cpp.
References _end.
|
private |
Definition at line 705 of file wwriffvorbis.cpp.
References Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::flush(), Common::MemoryWriteStreamDynamic::getData(), Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::putBits(), Sound::putVorbisHeader(), Common::MemoryWriteStreamDynamic::setDisposable(), and Common::MemoryWriteStreamDynamic::size().
Referenced by rewind().
|
private |
Definition at line 678 of file wwriffvorbis.cpp.
References _averageBytesPerSecond, _blocksize0Pow, _blocksize1Pow, _channels, _sampleRate, Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::flush(), Common::MemoryWriteStreamDynamic::getData(), Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::putBits(), Sound::putVorbisHeader(), Common::MemoryWriteStreamDynamic::setDisposable(), and Common::MemoryWriteStreamDynamic::size().
Referenced by rewind().
|
private |
Definition at line 722 of file wwriffvorbis.cpp.
References _channels, _codebooks, _dataOffset, _firstAudioPacketOffset, _fullSetup, _inStream, _modeBits, _modeBlockFlags, _noGranule, _setupPacketOffset, Sound::CodebookLibrary::copy(), Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::flush(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBit(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBits(), Common::MemoryWriteStreamDynamic::getData(), Sound::Packet::granule(), Common::intLog2(), MAX(), Sound::Packet::nextOffset(), Sound::Packet::offset(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::pos(), Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::putBit(), Common::BitStreamWriterImpl< valueBits, isLE, isMSB2LSB >::putBits(), Sound::putVorbisHeader(), Sound::CodebookLibrary::rebuild(), Common::ScopedPtrBase< T, Deallocator >::reset(), Common::MemoryWriteStreamDynamic::setDisposable(), Common::MemoryWriteStreamDynamic::size(), and Sound::Packet::size().
Referenced by rewind().
|
virtual |
Return the number channels in this stream.
Implements Sound::AudioStream.
Definition at line 434 of file wwriffvorbis.cpp.
References _vorbis.
|
virtual |
Estimate the total number of samples per channel in this stream.
If this value is not calculatable, return kInvalidLength.
Reimplemented from Sound::RewindableAudioStream.
Definition at line 460 of file wwriffvorbis.cpp.
References _sampleCount.
|
virtual |
Sample rate of the stream.
Implements Sound::AudioStream.
Definition at line 438 of file wwriffvorbis.cpp.
References _vorbis.
|
private |
Definition at line 487 of file wwriffvorbis.cpp.
References _averageBytesPerSecond, _blocksize0Pow, _blocksize1Pow, _channels, _dataOffset, _dataSize, _firstAudioPacketOffset, _headerTriadPresent, _inStream, _loopCount, _loopEnd, _loopStart, _modPackets, _noGranule, _oldPacketHeaders, _sampleCount, _sampleRate, _setupPacketOffset, _uid, Common::kEncodingASCII, MKTAG, Common::readStringFixed(), and SIZE_MAX.
Referenced by WwRIFFVorbisStream().
|
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 464 of file wwriffvorbis.cpp.
References _end, _vorbis, createPacket(), and Common::ScopedPtrBase< T, Deallocator >::release().
|
virtual |
Rewinds the stream to its start.
Implements Sound::RewindableAudioStream.
Definition at line 446 of file wwriffvorbis.cpp.
References _currentOffset, _dataOffset, _end, _firstAudioPacketOffset, _vorbis, generateHeaderComment(), generateHeaderIdentification(), generateHeaderSetup(), Sound::makePacketizedVorbisStream(), and Common::ScopedPtrBase< T, Deallocator >::reset().
Referenced by WwRIFFVorbisStream().
|
private |
Definition at line 350 of file wwriffvorbis.cpp.
Referenced by generateHeaderIdentification(), and init().
|
private |
Definition at line 355 of file wwriffvorbis.cpp.
Referenced by generateHeaderIdentification(), and init().
|
private |
Definition at line 356 of file wwriffvorbis.cpp.
Referenced by generateHeaderIdentification(), and init().
|
private |
Definition at line 348 of file wwriffvorbis.cpp.
Referenced by generateHeaderIdentification(), generateHeaderSetup(), and init().
|
private |
Definition at line 333 of file wwriffvorbis.cpp.
Referenced by generateHeaderSetup().
|
private |
Definition at line 343 of file wwriffvorbis.cpp.
Referenced by createPacket(), and rewind().
|
private |
Definition at line 341 of file wwriffvorbis.cpp.
Referenced by createPacket(), generateHeaderSetup(), init(), and rewind().
|
private |
Definition at line 342 of file wwriffvorbis.cpp.
Referenced by createPacket(), and init().
|
private |
Definition at line 365 of file wwriffvorbis.cpp.
Referenced by endOfData(), readBuffer(), and rewind().
|
private |
Definition at line 346 of file wwriffvorbis.cpp.
Referenced by generateHeaderSetup(), init(), and rewind().
|
private |
Definition at line 335 of file wwriffvorbis.cpp.
Referenced by generateHeaderSetup().
|
private |
Definition at line 336 of file wwriffvorbis.cpp.
Referenced by init(), and WwRIFFVorbisStream().
|
private |
Definition at line 332 of file wwriffvorbis.cpp.
Referenced by createPacket(), generateHeaderSetup(), and init().
|
private |
Definition at line 358 of file wwriffvorbis.cpp.
Referenced by init().
|
private |
Definition at line 360 of file wwriffvorbis.cpp.
Referenced by init().
|
private |
Definition at line 359 of file wwriffvorbis.cpp.
Referenced by init().
|
private |
Definition at line 363 of file wwriffvorbis.cpp.
Referenced by generateHeaderSetup().
|
private |
Definition at line 362 of file wwriffvorbis.cpp.
Referenced by generateHeaderSetup().
|
private |
Definition at line 339 of file wwriffvorbis.cpp.
Referenced by init(), and WwRIFFVorbisStream().
|
private |
Definition at line 338 of file wwriffvorbis.cpp.
Referenced by createPacket(), generateHeaderSetup(), and init().
|
private |
Definition at line 337 of file wwriffvorbis.cpp.
Referenced by init(), and WwRIFFVorbisStream().
|
private |
Definition at line 352 of file wwriffvorbis.cpp.
Referenced by getLength(), and init().
|
private |
Definition at line 349 of file wwriffvorbis.cpp.
Referenced by generateHeaderIdentification(), and init().
|
private |
Definition at line 345 of file wwriffvorbis.cpp.
Referenced by generateHeaderSetup(), and init().
|
private |
Definition at line 354 of file wwriffvorbis.cpp.
Referenced by init().
|
private |
Definition at line 330 of file wwriffvorbis.cpp.
Referenced by getChannels(), getRate(), readBuffer(), and rewind().