#include "fixed.h"
#include "timer.h"
#include "stream.h"
Go to the source code of this file.
Data Structures | |
struct | mad_header |
MPEG frame header information. More... | |
struct | mad_frame |
MPEG unit of encoding, and associated context. More... | |
Defines | |
#define | MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) |
#define | MAD_NSBSAMPLES(header) |
#define | mad_header_finish(header) |
Releases a mad_header structure after usage. | |
Enumerations | |
enum | mad_layer { MAD_LAYER_I = 1, MAD_LAYER_II = 2, MAD_LAYER_III = 3 } |
enum | mad_mode { MAD_MODE_SINGLE_CHANNEL = 0, MAD_MODE_DUAL_CHANNEL = 1, MAD_MODE_JOINT_STEREO = 2, MAD_MODE_STEREO = 3 } |
enum | mad_emphasis { MAD_EMPHASIS_NONE = 0, MAD_EMPHASIS_50_15_US = 1, MAD_EMPHASIS_CCITT_J_17 = 3, MAD_EMPHASIS_RESERVED = 2 } |
enum | { MAD_FLAG_NPRIVATE_III = 0x0007, MAD_FLAG_INCOMPLETE = 0x0008, MAD_FLAG_PROTECTION = 0x0010, MAD_FLAG_COPYRIGHT = 0x0020, MAD_FLAG_ORIGINAL = 0x0040, MAD_FLAG_PADDING = 0x0080, MAD_FLAG_I_STEREO = 0x0100, MAD_FLAG_MS_STEREO = 0x0200, MAD_FLAG_FREEFORMAT = 0x0400, MAD_FLAG_LSF_EXT = 0x1000, MAD_FLAG_MC_EXT = 0x2000, MAD_FLAG_MPEG_2_5_EXT = 0x4000 } |
enum | { MAD_PRIVATE_HEADER = 0x0100, MAD_PRIVATE_III = 0x001f } |
Functions | |
void | mad_header_init (struct mad_header *) |
Initializes a newly created mad_header structure. | |
int | mad_header_decode (struct mad_header *, struct mad_stream *) |
Reads the next frame header from the stream. | |
void | mad_frame_init (struct mad_frame *) |
Initializes a frame struct. | |
void | mad_frame_finish (struct mad_frame *) |
Deallocates any dynamic memory associated with frame. | |
int | mad_frame_decode (struct mad_frame *, struct mad_stream *) |
Decodes a single frame from a bitstream. | |
void | mad_frame_mute (struct mad_frame *) |
Zeroes all subband values so the frame becomes silent. |
Definition in file frame.h.
#define mad_header_finish | ( | header | ) |
Releases a mad_header structure after usage.
nothing
Definition at line 119 of file frame.h.
Referenced by mad_frame_finish().
#define MAD_NCHANNELS | ( | header | ) | ((header)->mode ? 2 : 1) |
Definition at line 85 of file frame.h.
Referenced by mad_layer_I(), mad_layer_II(), mad_layer_III(), and mad_synth_frame().
#define MAD_NSBSAMPLES | ( | header | ) |
Value:
((header)->layer == MAD_LAYER_I ? 12 : \ (((header)->layer == MAD_LAYER_III && \ ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36))
Definition at line 86 of file frame.h.
Referenced by mad_header_decode(), and mad_synth_frame().
anonymous enum |
anonymous enum |
enum mad_emphasis |
enum mad_layer |
enum mad_mode |
int mad_frame_decode | ( | struct mad_frame * | , | |
struct mad_stream * | ||||
) |
Decodes a single frame from a bitstream.
Definition at line 434 of file frame.c.
References mad_stream::anc_bitlen, mad_stream::anc_ptr, decoder_table, mad_stream::error, mad_header::flags, mad_frame::header, mad_header::layer, mad_bit_finish, mad_bit_init(), mad_bit_length(), MAD_FLAG_INCOMPLETE, mad_header_decode(), MAD_LAYER_III, MAD_RECOVERABLE, mad_stream::next_frame, mad_stream::options, mad_frame::options, mad_stream::ptr, and mad_stream::this_frame.
Referenced by run_sync().
void mad_frame_finish | ( | struct mad_frame * | ) |
Deallocates any dynamic memory associated with frame.
Definition at line 105 of file frame.c.
References mad_frame::header, mad_header_finish, and mad_frame::overlap.
Referenced by run_sync().
void mad_frame_init | ( | struct mad_frame * | ) |
Initializes a frame struct.
Definition at line 92 of file frame.c.
References mad_frame::header, mad_frame_mute(), mad_header_init(), mad_frame::options, and mad_frame::overlap.
Referenced by run_sync().
void mad_frame_mute | ( | struct mad_frame * | ) |
Zeroes all subband values so the frame becomes silent.
Definition at line 479 of file frame.c.
References mad_frame::overlap, s, and mad_frame::sbsample.
Referenced by error_default(), and mad_frame_init().
int mad_header_decode | ( | struct mad_header * | , | |
struct mad_stream * | ||||
) |
Reads the next frame header from the stream.
Definition at line 297 of file frame.c.
References mad_header::bitrate, mad_stream::bufend, decode_header(), mad_header::duration, mad_stream::error, mad_header::flags, free_bitrate(), mad_stream::freerate, mad_header::layer, mad_bit_init(), mad_bit_nextbyte(), MAD_BUFFER_GUARD, MAD_ERROR_BUFLEN, MAD_ERROR_BUFPTR, MAD_ERROR_LOSTSYNC, MAD_FLAG_FREEFORMAT, MAD_FLAG_INCOMPLETE, MAD_FLAG_LSF_EXT, MAD_FLAG_PADDING, MAD_LAYER_I, MAD_LAYER_III, MAD_NSBSAMPLES, mad_stream_sync(), mad_timer_set(), mad_stream::next_frame, mad_stream::ptr, mad_header::samplerate, mad_stream::skiplen, mad_stream::sync, and mad_stream::this_frame.
Referenced by mad_frame_decode(), and run_sync().
void mad_header_init | ( | struct mad_header * | ) |
Initializes a newly created mad_header structure.
Definition at line 70 of file frame.c.
References mad_header::bitrate, mad_header::crc_check, mad_header::crc_target, mad_header::duration, mad_header::emphasis, mad_header::flags, mad_header::layer, mad_timer_zero, mad_header::mode, mad_header::mode_extension, mad_header::private_bits, and mad_header::samplerate.
Referenced by mad_frame_init().