#include <wvoggspeex.h>
Inheritance diagram for WvOggSpeexDecoder:
Inbut buffer must contain part of an Ogg Speex bitstream.
Output buffer will contain a sequence of signed 'float' type values in machine order representing normalized PCM audio data.
If flush == false, then encode() will return true immediately after isheaderok() becomes true without outputting any audio data. This allows the client to examine the header and to tailor the actual decoding process based on that information.
Public Types | |
typedef unsigned char | IType |
typedef float | OType |
typedef WvBufBase< IType > | IBuffer |
typedef WvBufBase< OType > | OBuffer |
typedef WvBufViewBase< IType > | IBufferView |
typedef WvBufViewBase< OType > | OBufferView |
Public Member Functions | |
WvOggSpeexDecoder () | |
Creates an Ogg Speex Decoder. | |
bool | isheaderok () const |
Returns true when the entire stream header has been processed and the comments and vendor fields are valid. | |
WvString | vendor () const |
Returns the Ogg Speex vendor comment string. | |
WvStringList & | comments () |
Returns the Ogg Speex list of user comments. | |
int | channels () const |
Returns the number of channels in the stream. | |
int | samplingrate () const |
Returns the sampling rate of the stream. | |
int | samplesperframe () const |
Returns the number of samples per frame. | |
WvSpeex::CodecMode | mode () const |
Returns the current encoding mode. | |
bool | vbr () const |
Returns true if variable bitrate support has been enabled. | |
int | nominalbitrate () const |
Returns the nominal bitrate. | |
bool | postfilter () const |
Determines if the perceptual enhancement post-filter is enabled. | |
void | setpostfilter (bool enable) |
Enables or disables the perceptual enhancement post-filter. | |
bool | encode (IBuffer &inbuf, OBuffer &outbuf, bool flush=false, bool finish=false) |
Typed variant of encode(). | |
bool | encode (WvBuf &inbuf, WvBuf &outbuf, bool flush=false, bool finish=false) |
Reads data from the input buffer, encodes it, and writes the result to the output buffer. | |
bool | flush (IBuffer &inbuf, OBuffer &outbuf, bool finish=false) |
Typed variant of flush(). | |
bool | flush (WvBuf &inbuf, WvBuf &outbuf, bool finish=false) |
Flushes the encoder and optionally finishes it. | |
bool | finish (OBuffer &outbuf) |
Typed variant of finish(). | |
bool | finish (WvBuf &outbuf) |
Tells the encoder that NO MORE DATA will ever be encoded. | |
bool | isok () const |
Returns true if the encoder has not encountered an error. | |
bool | isfinished () const |
Returns true if the encoder can no longer encode data. | |
WvString | geterror () const |
Returns an error message if any is available. | |
bool | reset () |
Asks an encoder to reset itself to its initial state at creation time, if supported. | |
bool | flushstrbuf (WvStringParm instr, WvBuf &outbuf, bool finish=false) |
Flushes data through the encoder from a string to a buffer. | |
bool | flushstrstr (WvStringParm instr, WvString &outstr, bool finish=false) |
Flushes data through the encoder from a string to a string. | |
bool | encodebufstr (WvBuf &inbuf, WvString &outstr, bool flush=false, bool finish=false) |
Encodes data from a buffer to a string. | |
bool | flushbufstr (WvBuf &inbuf, WvString &outstr, bool finish=false) |
Flushes data through the encoder from a buffer to a string. | |
WvString | strflushstr (WvStringParm instr, bool finish=false) |
Flushes data through the encoder from a string to a string. | |
WvString | strflushbuf (WvBuf &inbuf, bool finish=false) |
Flushes data through the encoder from a buffer to a string. | |
bool | flushmembuf (const void *inmem, size_t inlen, WvBuf &outbuf, bool finish=false) |
Flushes data through the encoder from memory to a buffer. | |
bool | flushmemmem (const void *inmem, size_t inlen, void *outmem, size_t *outlen, bool finish=false) |
Flushes data through the encoder from memory to memory. | |
bool | encodebufmem (WvBuf &inbuf, void *outmem, size_t *outlen, bool flush=false, bool finish=false) |
Encodes data from a buffer to memory. | |
bool | flushbufmem (WvBuf &inbuf, void *outmem, size_t *outlen, bool finish=false) |
Flushes data through the encoder from a buffer to memory. | |
bool | flushstrmem (WvStringParm instr, void *outmem, size_t *outlen, bool finish=false) |
Flushes data through the encoder from a string to memory. | |
WvString | strflushmem (const void *inmem, size_t inlen, bool finish=false) |
Flushes data through the encoder from memory to a string. | |
Protected Member Functions | |
virtual bool | _typedencode (IBuffer &inbuf, OBuffer &outbuf, bool flush) |
Typed variant of _encode(). | |
virtual bool | _typedfinish (OBuffer &outbuf) |
Typed variant of _finish(). | |
virtual bool | _isok () const |
Template method implementation of isok(). | |
virtual WvString | _geterror () const |
Template method implementation of geterror(). | |
virtual bool | _encode (WvBuf &inbuf, WvBuf &outbuf, bool flush) |
Wrapper implementation of _encode(). | |
virtual bool | _finish (WvBuf &outbuf) |
Wrapper implementation of _finish(). | |
void | setnotok () |
Sets 'okay' to false explicitly. | |
void | seterror (WvStringParm message) |
Sets an error condition, then setnotok(). | |
void | seterror (WVSTRING_FORMAT_DECL) |
Sets an error condition, then setnotok(). | |
void | setfinished () |
Sets 'finished' to true explicitly. | |
virtual bool | _isfinished () const |
Template method implementation of isfinished(). | |
virtual bool | _reset () |
Template method implementation of reset(). | |
Protected Attributes | |
bool | okay |
bool | finished |
WvString | errstr |
|
Creates an Ogg Speex Decoder. For now, if the input bitstream is stereo, outputs the left channel only. This behaviour may change later on. |
|
Returns true when the entire stream header has been processed and the comments and vendor fields are valid. If false and isok(), try decoding more data. Returns: true when the header has been decoded |
|
Returns the Ogg Speex vendor comment string. Returns: the vendor comment |
|
Returns the Ogg Speex list of user comments. The list is owned by the encoder, do not change. Returns: the list of comments |
|
Returns the number of channels in the stream. Does not return useful information unless isheaderok() == true. Returns: the number of channels, non-negative |
|
Returns the sampling rate of the stream. Does not return useful information unless isheaderok() == true. Returns: the sampling rate |
|
Returns the number of samples per frame. Does not return useful information unless isheaderok() == true. Returns: the frame size |
|
Returns the current encoding mode. Does not return useful information unless isheaderok() == true. Returns: the encoding mode |
|
Returns true if variable bitrate support has been enabled. Does not return useful information unless isheaderok() == true. Returns: true if it is enabled |
|
Returns the nominal bitrate. Does not return useful information unless isheaderok() == true. Returns: the bitrate, or -1 if not specified or not meaningful |
|
Determines if the perceptual enhancement post-filter is enabled. Returns: true if it is enabled |
|
Enables or disables the perceptual enhancement post-filter. "enable" is true or false |
|
Typed variant of _encode().
Implements WvTypedEncoder< unsigned char, float >. |
|
Typed variant of _finish().
Reimplemented from WvTypedEncoder< unsigned char, float >. |
|
Template method implementation of isok(). Not called if any of the following cases are true:
Most implementations do not need to override this. Returns: true if the encoder is ok
Reimplemented from WvEncoder. |
|
Template method implementation of geterror(). Not called if any of the following cases are true:
Most implementations do not need to override this. Returns: the error message, or the null string if _isok() == true
Reimplemented from WvEncoder. |
|
Typed variant of encode().
|
|
Reimplemented from WvEncoder. |
|
Typed variant of flush().
|
|
Reimplemented from WvEncoder. |
|
Typed variant of finish().
|
|
Reimplemented from WvEncoder. |
|
Returns true if the encoder has not encountered an error. This should only be used to record permanent failures. Transient errors (eg. bad block, but recoverable) should be detected in a different fashion. Returns: true if the encoder is ok |
|
Returns true if the encoder can no longer encode data. This will be set when the encoder detects and end-of-data mark in its input, or when finish() is called. Returns: true if the encoder is finished |
|
Returns an error message if any is available. Returns: the error message, or the null string is isok() == true |
|
Asks an encoder to reset itself to its initial state at creation time, if supported. This function may be called at any time, even if isok() == false, or isfinished() == true. If the behaviour is not supported or an error occurs, then false is returned and afterwards isok() == false. Returns: true on success
|
|
Flushes data through the encoder from a string to a buffer. "instr" is the input string "outbuf" is the output buffer "finish" is if true, calls finish() on success Returns: true on success |
|
Flushes data through the encoder from a string to a string. The output data is appended to the target string. "instr" is the input string "outstr" is the output string "finish" is if true, calls finish() on success Returns: true on success |
|
Encodes data from a buffer to a string. The output data is appended to the target string. "inbuf" is the input buffer "outstr" is the output string "flush" is if true, flushes the encoder "finish" is if true, calls finish() on success Returns: true on success |
|
Flushes data through the encoder from a buffer to a string. The output data is appended to the target string. "inbuf" is the input buffer "outstr" is the output string "finish" is if true, calls finish() on success Returns: true on success |
|
Flushes data through the encoder from a string to a string. "inbuf" is the input buffer "finish" is if true, calls finish() on success Returns: the resulting encoded string, does not signal errors |
|
Flushes data through the encoder from a buffer to a string. "inbuf" is the input buffer "finish" is if true, calls finish() on success Returns: the resulting encoded string, does not signal errors |
|
Flushes data through the encoder from memory to a buffer. "inmem" is the input data pointer "inlen" is the input data length "outbuf" is the output buffer "finish" is if true, calls finish() on success Returns: true on success |
|
Flushes data through the encoder from memory to memory. The outlen parameter specifies by reference the length of the output buffer. It is updated in place to reflect the number of bytes copied to the output buffer. If the buffer was too small to hold the data, the overflow bytes will be discarded and false will be returned. "inmem" is the input data pointer "inlen" is the input data length "outmem" is the output data pointer "outlen" is the output data length, by reference "finish" is if true, calls finish() on success Returns: true on success |
|
Encodes data from a buffer to memory. The outlen parameter specifies by reference the length of the output buffer. It is updated in place to reflect the number of bytes copied to the output buffer. If the buffer was too small to hold the data, the overflow bytes will be discarded and false will be returned. "inmem" is the input data pointer "inlen" is the input data length "outmem" is the output data pointer "outlen" is the output data length, by reference "flush" is if true, flushes the encoder "finish" is if true, calls finish() on success Returns: true on success |
|
Flushes data through the encoder from a buffer to memory. The outlen parameter specifies by reference the length of the output buffer. It is updated in place to reflect the number of bytes copied to the output buffer. If the buffer was too small to hold the data, the overflow bytes will be discarded and false will be returned. "inbuf" is the input buffer "outmem" is the output data pointer "outlen" is the output data length, by reference "finish" is if true, calls finish() on success Returns: true on success |
|
Flushes data through the encoder from a string to memory. The outlen parameter specifies by reference the length of the output buffer. It is updated in place to reflect the number of bytes copied to the output buffer. If the buffer was too small to hold the data, the overflow bytes will be discarded and false will be returned. "instr" is the input string "outmem" is the output data pointer "outlen" is the output data length, by reference "finish" is if true, calls finish() on success Returns: true on success |
|
Flushes data through the encoder from memory to a string. "inmem" is the input data pointer "inlen" is the input data length "finish" is if true, calls finish() on success Returns: the resulting encoded string, does not signal errors |
|
Template method implementation of isfinished(). Not called if any of the following cases are true:
Most implementations do not need to override this. Returns: true if the encoder is finished
Reimplemented in WvEncoderChain. |
|
|
false iff setnotok() was called |
|
true iff setfinished()/finish() was called |
|
the error message |