#include "bit.h"
Go to the source code of this file.
Data Structures | |
struct | mad_stream |
Defines | |
#define | MAD_BUFFER_GUARD 8 |
#define | MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) |
#define | MAD_RECOVERABLE(error) ((error) & 0xff00) |
#define | mad_stream_options(stream, opts) ((void) ((stream)->options = (opts))) |
Enumerations | |
enum | mad_error { MAD_ERROR_NONE = 0x0000, MAD_ERROR_BUFLEN = 0x0001, MAD_ERROR_BUFPTR = 0x0002, MAD_ERROR_NOMEM = 0x0031, MAD_ERROR_LOSTSYNC = 0x0101, MAD_ERROR_BADLAYER = 0x0102, MAD_ERROR_BADBITRATE = 0x0103, MAD_ERROR_BADSAMPLERATE = 0x0104, MAD_ERROR_BADEMPHASIS = 0x0105, MAD_ERROR_BADCRC = 0x0201, MAD_ERROR_BADBITALLOC = 0x0211, MAD_ERROR_BADSCALEFACTOR = 0x0221, MAD_ERROR_BADMODE = 0x0222, MAD_ERROR_BADFRAMELEN = 0x0231, MAD_ERROR_BADBIGVALUES = 0x0232, MAD_ERROR_BADBLOCKTYPE = 0x0233, MAD_ERROR_BADSCFSI = 0x0234, MAD_ERROR_BADDATAPTR = 0x0235, MAD_ERROR_BADPART3LEN = 0x0236, MAD_ERROR_BADHUFFTABLE = 0x0237, MAD_ERROR_BADHUFFDATA = 0x0238, MAD_ERROR_BADSTEREO = 0x0239 } |
enum | { MAD_OPTION_IGNORECRC = 0x0001, MAD_OPTION_HALFSAMPLERATE = 0x0002 } |
Functions | |
void | mad_stream_init (struct mad_stream *) |
Initializes stream struct. | |
void | mad_stream_finish (struct mad_stream *) |
Deallocates any dynamic memory associated with stream. | |
void | mad_stream_buffer (struct mad_stream *, unsigned char const *, unsigned long) |
Sets stream buffer pointers. | |
void | mad_stream_skip (struct mad_stream *, unsigned long) |
Arranges to skip bytes before the next frame. | |
int | mad_stream_sync (struct mad_stream *) |
Locates the next stream sync word. | |
char const * | mad_stream_errorstr (struct mad_stream const *) |
Returns a string description of the current error condition. |
Definition in file stream.h.
#define MAD_BUFFER_GUARD 8 |
Definition at line 31 of file stream.h.
Referenced by III_huffdecode(), mad_header_decode(), and mad_stream_sync().
#define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) |
#define MAD_RECOVERABLE | ( | error | ) | ((error) & 0xff00) |
#define mad_stream_options | ( | stream, | |||
opts | ) | ((void) ((stream)->options = (opts))) |
anonymous enum |
enum mad_error |
MAD_ERROR_NONE | no error |
MAD_ERROR_BUFLEN | input buffer too small (or EOF) |
MAD_ERROR_BUFPTR | invalid (null) buffer pointer |
MAD_ERROR_NOMEM | not enough memory |
MAD_ERROR_LOSTSYNC | lost synchronization |
MAD_ERROR_BADLAYER | reserved header layer value |
MAD_ERROR_BADBITRATE | forbidden bitrate value |
MAD_ERROR_BADSAMPLERATE | reserved sample frequency value |
MAD_ERROR_BADEMPHASIS | reserved emphasis value |
MAD_ERROR_BADCRC | CRC check failed. |
MAD_ERROR_BADBITALLOC | forbidden bit allocation value |
MAD_ERROR_BADSCALEFACTOR | bad scalefactor index |
MAD_ERROR_BADMODE | bad bitrate/mode combination |
MAD_ERROR_BADFRAMELEN | bad frame length |
MAD_ERROR_BADBIGVALUES | bad big_values count |
MAD_ERROR_BADBLOCKTYPE | reserved block_type |
MAD_ERROR_BADSCFSI | bad scalefactor selection info |
MAD_ERROR_BADDATAPTR | bad main_data_begin pointer |
MAD_ERROR_BADPART3LEN | bad audio data length |
MAD_ERROR_BADHUFFTABLE | bad Huffman table select |
MAD_ERROR_BADHUFFDATA | Huffman data overrun. |
MAD_ERROR_BADSTEREO | incompatible block_type for JS |
void mad_stream_buffer | ( | struct mad_stream * | , | |
unsigned char const * | , | |||
unsigned | long | |||
) |
Sets stream buffer pointers.
Definition at line 80 of file stream.c.
References mad_stream::bufend, mad_stream::buffer, mad_bit_init(), mad_stream::next_frame, mad_stream::ptr, mad_stream::sync, and mad_stream::this_frame.
Referenced by input().
char const* mad_stream_errorstr | ( | struct mad_stream const * | ) |
Returns a string description of the current error condition.
Definition at line 127 of file stream.c.
References mad_stream::error, MAD_ERROR_BADBIGVALUES, MAD_ERROR_BADBITALLOC, MAD_ERROR_BADBITRATE, MAD_ERROR_BADBLOCKTYPE, MAD_ERROR_BADCRC, MAD_ERROR_BADDATAPTR, MAD_ERROR_BADEMPHASIS, MAD_ERROR_BADFRAMELEN, MAD_ERROR_BADHUFFDATA, MAD_ERROR_BADHUFFTABLE, MAD_ERROR_BADLAYER, MAD_ERROR_BADMODE, MAD_ERROR_BADPART3LEN, MAD_ERROR_BADSAMPLERATE, MAD_ERROR_BADSCALEFACTOR, MAD_ERROR_BADSCFSI, MAD_ERROR_BADSTEREO, MAD_ERROR_BUFLEN, MAD_ERROR_BUFPTR, MAD_ERROR_LOSTSYNC, MAD_ERROR_NOMEM, and MAD_ERROR_NONE.
Referenced by error().
void mad_stream_finish | ( | struct mad_stream * | ) |
Deallocates any dynamic memory associated with stream.
Definition at line 66 of file stream.c.
References mad_stream::anc_ptr, mad_bit_finish, mad_stream::main_data, and mad_stream::ptr.
Referenced by run_sync().
void mad_stream_init | ( | struct mad_stream * | ) |
Initializes stream struct.
Definition at line 40 of file stream.c.
References mad_stream::anc_bitlen, mad_stream::anc_ptr, mad_stream::bufend, mad_stream::buffer, mad_stream::error, mad_stream::freerate, mad_bit_init(), MAD_ERROR_NONE, mad_stream::main_data, mad_stream::md_len, mad_stream::next_frame, mad_stream::options, mad_stream::ptr, mad_stream::skiplen, mad_stream::sync, and mad_stream::this_frame.
Referenced by run_sync().
void mad_stream_skip | ( | struct mad_stream * | , | |
unsigned | long | |||
) |
Arranges to skip bytes before the next frame.
Definition at line 97 of file stream.c.
References mad_stream::skiplen.
int mad_stream_sync | ( | struct mad_stream * | ) |
Locates the next stream sync word.
Definition at line 105 of file stream.c.
References mad_stream::bufend, mad_bit_init(), mad_bit_nextbyte(), MAD_BUFFER_GUARD, and mad_stream::ptr.
Referenced by free_bitrate(), and mad_header_decode().