|This is a private message structure. More...|
|static int||decode (unsigned char const *start, unsigned long length)|
|This is the function called by main() above to perform all the decoding. |
|int||main (int argc, char *argv)|
|static enum mad_flow||input (void *data, struct mad_stream *stream)|
|This is the input callback. |
|static signed int||scale (mad_fixed_t sample)|
|The following utility routine performs simple rounding, clipping, and scaling of MAD's high-resolution samples down to 16 bits. |
|static enum mad_flow||output (void *data, struct mad_header const *header, struct mad_pcm *pcm)|
|This is the output callback function. |
|static enum mad_flow||error (void *data, struct mad_stream *stream, struct mad_frame *frame)|
|This is the error callback function. |
Standard input is mapped into memory via mmap(), then the high-level API is invoked with three callbacks: input, output, and error. The output callback converts MAD's high-resolution PCM samples to 16 bits, then writes them to standard output in little-endian, stereo-interleaved format.
Definition in file minimad.c.
|static int decode||(||unsigned char const *||start,|
This is the function called by main() above to perform all the decoding.
It instantiates a decoder object and configures it with the input, output, and error callback functions above. A single call to mad_decoder_run() continues until a callback function returns MAD_FLOW_STOP (to stop decoding) or MAD_FLOW_BREAK (to stop decoding and signal an error).
Referenced by main().
|static enum mad_flow error||(||void *||data,|
|struct mad_stream *||stream,|
|struct mad_frame *||frame|
This is the error callback function.
This is the input callback.
The purpose of this callback is to (re)fill the stream buffer which is to be decoded. In this example, an entire file has been mapped into memory, so we just call mad_stream_buffer() with the address and length of the mapping. When this callback is called a second time, we are finished decoding.
Referenced by decode().
|static enum mad_flow output||(||void *||data,|
|struct mad_header const *||header,|
|struct mad_pcm *||pcm|
This is the output callback function.
It is called after each frame of MPEG audio data has been completely decoded. The purpose of this callback is to output (or play) the decoded PCM audio.
|static signed int scale||(||mad_fixed_t||sample||)||
The following utility routine performs simple rounding, clipping, and scaling of MAD's high-resolution samples down to 16 bits.
It does not perform any dithering or noise shaping, which would be recommended to obtain any exceptional audio quality. It is therefore not recommended to use this routine if high-quality output is desired.