frame.h File Reference

Declaration of the mad_frame and mad_header structures, as libmad decoding units, and associated methods. More...

#include "fixed.h"
#include "timer.h"
#include "stream.h"

Include dependency graph for frame.h:

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

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.


Detailed Description

Declaration of the mad_frame and mad_header structures, as libmad decoding units, and associated methods.

Definition in file frame.h.


Define Documentation

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


Enumeration Type Documentation

anonymous enum

Enumerator:
MAD_FLAG_NPRIVATE_III  number of Layer III private bits
MAD_FLAG_INCOMPLETE  header but not data is decoded
MAD_FLAG_PROTECTION  frame has CRC protection
MAD_FLAG_COPYRIGHT  frame is copyright
MAD_FLAG_ORIGINAL  frame is original (else copy)
MAD_FLAG_PADDING  frame has additional slot
MAD_FLAG_I_STEREO  uses intensity joint stereo
MAD_FLAG_MS_STEREO  uses middle/side joint stereo
MAD_FLAG_FREEFORMAT  uses free format bitrate
MAD_FLAG_LSF_EXT  lower sampling freq.

extension

MAD_FLAG_MC_EXT  multichannel audio extension
MAD_FLAG_MPEG_2_5_EXT  MPEG 2.5 (unofficial) extension.

Definition at line 91 of file frame.h.

anonymous enum

Enumerator:
MAD_PRIVATE_HEADER  header private bit
MAD_PRIVATE_III  Layer III private bits (up to 5).

Definition at line 109 of file frame.h.

Enumerator:
MAD_EMPHASIS_NONE  no emphasis
MAD_EMPHASIS_50_15_US  50/15 microseconds emphasis
MAD_EMPHASIS_CCITT_J_17  CCITT J.17 emphasis.
MAD_EMPHASIS_RESERVED  unknown emphasis

Definition at line 45 of file frame.h.

enum mad_layer

Enumerator:
MAD_LAYER_I  Layer I.
MAD_LAYER_II  Layer II.
MAD_LAYER_III  Layer III.

Definition at line 32 of file frame.h.

enum mad_mode

Enumerator:
MAD_MODE_SINGLE_CHANNEL  single channel
MAD_MODE_DUAL_CHANNEL  dual channel
MAD_MODE_JOINT_STEREO  joint (MS/intensity) stereo
MAD_MODE_STEREO  normal LR stereo

Definition at line 38 of file frame.h.


Function Documentation

int mad_frame_decode ( struct mad_frame ,
struct mad_stream  
)

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

Here is the call graph for this function:

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  
)

void mad_header_init ( struct mad_header  ) 


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