stream.h File Reference

Defines the mad_stream structure and methods, which handle the input stream buffer which is to be decoded. More...

#include "bit.h"

Include dependency graph for stream.h:

This graph shows which files directly or indirectly include this file:

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.


Detailed Description

Defines the mad_stream structure and methods, which handle the input stream buffer which is to be decoded.

Definition in file stream.h.


Define Documentation

#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)

Definition at line 32 of file stream.h.

Referenced by mad_layer_III().

#define MAD_RECOVERABLE ( error   )     ((error) & 0xff00)

Definition at line 63 of file stream.h.

Referenced by mad_frame_decode(), and run_sync().

#define mad_stream_options ( stream,
opts   )     ((void) ((stream)->options = (opts)))

Definition at line 101 of file stream.h.

Referenced by run_sync().


Enumeration Type Documentation

anonymous enum

Enumerator:
MAD_OPTION_IGNORECRC  ignore CRC errors
MAD_OPTION_HALFSAMPLERATE  generate PCM at 1/2 sample rate

Definition at line 88 of file stream.h.

enum mad_error

Enumerator:
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

Definition at line 34 of file stream.h.


Function Documentation

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().

Here is the call graph for this function:

char const* mad_stream_errorstr ( struct mad_stream const *   ) 

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  ) 

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().

Here is the call graph for this function:


Generated on Tue Jun 10 12:14:18 2008 for libmad by  doxygen 1.5.5