Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

mp3_frame_header Class Reference

#include <mp3_frame_header.h>

Collaboration diagram for mp3_frame_header:

Collaboration graph
List of all members.

Detailed Description

MP3 Frame Header class.


Public Member Functions

 mp3_frame_header (void)
 MP3 frame header constructor.

 mp3_frame_header (char *pMemory)
 MP3 frame header constructor.

 ~mp3_frame_header (void)
 MP3 frame header destructor.

void SetFrameHeader (char *pMemory)
 Set MP3 frame header.

bool IsValidFrameHeader (void) const
 Test if a frame header it is a true frame header.

int GetLength (void) const
 Gets the length of the frame.

int GetSlotSize (void) const
 Determine the slot size.

int GetSamplerateConstant (void) const
 Determine the samplerate constant.

int GetBitrateConstant (void) const
 Determine the bitrate constant.

string GetMPEGVersionDesc (void) const
 Gets MPEG version description.

string GetLayerVersionDesc (void) const
 Gets layer version description.

int GetBitrateDesc (void) const
 Gets bitrate description.

int GetSamplerateDesc (void) const
 Gets samplerate description.

string GetChanmodeDesc (void) const
 Gets channel mode description.

string GetChanmodeExDesc (void) const
 Gets extended channel mode description.

string GetEmphasisDesc (void) const
 Gets emphasis description.

bool GetCRC (void) const
 Gets the CRC flag from the frame header.

bool GetPrivate (void) const
 Gets the private flag from the frame header.

bool GetCopyright (void) const
 Gets the copyright flag from the frame header.

bool GetOriginal (void) const
 Gets the original flag from the frame header.


Private Member Functions

int GetMPEGVersion (void) const
 Gets the MPEG version from the frame header.

int GetLayerVersion (void) const
 Gets the layer version from the frame header.

int GetBitrate (void) const
 Gets the bitrate index from the frame header.

int GetSamplerate (void) const
 Gets the samplerate index from the frame header.

int GetPadded (void) const
 Gets the padded flag from the frame header.

int GetChanmode (void) const
 Gets the channel mode index from the frame header.

int GetChanmodeEx (void) const
 Gets the extended channel mode index from the frame header.

int GetEmphasis (void) const
 Gets the emphasis index from the frame header.


Private Attributes

int m_FrameHeader
 MP3 frame header.


Static Private Attributes

const int FRAME_SYNC = 0x0FFE00000
 Frame Sync: 1111 1111 1110 0000 0000 0000 0000 0000.

const int NUM_MPEG_VERSION = 4
 Number of versions.

const int MPEG_V1 = 3
 Version 1.

const int MPEG_V2 = 2
 Version 2.

const int MPEG_V25 = 0
 Version 2.5.

const int INVALID_MPEG = 1
 Invalid version.

const int NUM_LAYER_VERSION = 4
 Number of layers.

const int LAYER_I = 3
 Layer I.

const int LAYER_II = 2
 Layer II.

const int LAYER_III = 1
 Layer III.

const int INVALID_LAYER = 0
 Invalid layer.

const int SLOT_SIZE_LAYER_I = 4
 Size of a slot - Layer I.

const int SLOT_SIZE_LAYER_II_III = 1
 Size of a slot - Layer II & III.

const int SAMPLERATE_CONST_LAYER_I = 384
 Sample rate constant - Layer I.

const int SAMPLERATE_CONST_LAYER_II_III = 1152
 Sample rate constant - Layer II & III.

const int BITRATE_CONST_LAYER_I = 12
 Bit rate constant - Layer I.

const int BITRATE_CONST_LAYER_II_III = 144
 Bit rate constant - Layer II & III.

const int NUM_BITRATE = 16
 Number of bit rates.

const int FREE_BITRATE = 0
 Free bitrate.

const int INVALID_BITRATE = 15
 Invalid bitrate.

const int INVALID_BR_DESC = -1
 Bit Rate desc for invalid bitrate.

const int FREE_BR_DESC = 0
 Bit Rate desc for free bitrate.

const int NUM_SAMPLERATE = 4
 Number of sample rates.

const int INVALID_SAMPLERATE = 3
 Invalid samplerate.

const int INVALID_SR_DESC = -1
 Sample Rate desc for invalid samplerate.

const int NUM_CHANMODE = 4
 Number of channel modes.

const int CHANMODE_EX = 1
 Channel mode extended.

const int NUM_CHANMODE_EX = 4
 Number of channel modes ex.

const int NUM_EMPHASIS = 4
 Number of emphasis.

const string MPEG_VERSION_DESC [NUM_MPEG_VERSION]
 Array of mpeg versions.

const string LAYER_VERSION_DESC [NUM_LAYER_VERSION]
 Array of channel modes.

const int BITRATE_DESC [NUM_MPEG_VERSION][NUM_LAYER_VERSION][NUM_BITRATE]
 Array of bit rates.

const int SAMPLERATE_DESC [NUM_MPEG_VERSION][NUM_SAMPLERATE]
 Array of sample rates.

const string CHANMODE_DESC [NUM_CHANMODE]
 Array of channel modes.

const string CHANMODE_EX_DESC [NUM_LAYER_VERSION][NUM_CHANMODE_EX]
 Array of extended channel modes.

const string EMPHASIS_DESC [NUM_EMPHASIS]
 Array of emphasis.


Constructor & Destructor Documentation

mp3_frame_header::mp3_frame_header void   ) 
 

MP3 frame header constructor.

mp3_frame_header::mp3_frame_header char *  pMemory  ) 
 

MP3 frame header constructor.

Parameters:
pMemory: Pointer to a block of memory starting with a MP3 frame header.

Here is the call graph for this function:

mp3_frame_header::~mp3_frame_header void   ) 
 

MP3 frame header destructor.


Member Function Documentation

void mp3_frame_header::SetFrameHeader char *  pMemory  ) 
 

Set MP3 frame header.

Parameters:
pMemory: Pointer to a block of memory starting with a MP3 frame header.

bool mp3_frame_header::IsValidFrameHeader void   )  const
 

Test if a frame header it is a true frame header.

Returns:
If is valid return true else false.

Here is the call graph for this function:

int mp3_frame_header::GetLength void   )  const
 

Gets the length of the frame.

Returns:
Length of the frame.

Here is the call graph for this function:

int mp3_frame_header::GetSlotSize void   )  const
 

Determine the slot size.

Returns:
Slot size, it can be 1 (LAYER_II_SLOT_SIZE, LAYER_III_SLOT_SIZE) or 4(LAYER_I_SLOT_SIZE)

Here is the call graph for this function:

int mp3_frame_header::GetSamplerateConstant void   )  const
 

Determine the samplerate constant.

Returns:
Sample rate constant for this frame.

Here is the call graph for this function:

int mp3_frame_header::GetBitrateConstant void   )  const
 

Determine the bitrate constant.

Returns:
Bit rate constant for this frame.

Here is the call graph for this function:

string mp3_frame_header::GetMPEGVersionDesc void   )  const
 

Gets MPEG version description.

Returns:
String with MPEG version description.

Here is the call graph for this function:

string mp3_frame_header::GetLayerVersionDesc void   )  const
 

Gets layer version description.

Returns:
String with layer version description.

Here is the call graph for this function:

int mp3_frame_header::GetBitrateDesc void   )  const
 

Gets bitrate description.

Returns:
String with bitrate description.

Here is the call graph for this function:

int mp3_frame_header::GetSamplerateDesc void   )  const
 

Gets samplerate description.

Returns:
String with samplerate description.

Here is the call graph for this function:

string mp3_frame_header::GetChanmodeDesc void   )  const
 

Gets channel mode description.

Returns:
String with channel mode description.

Here is the call graph for this function:

string mp3_frame_header::GetChanmodeExDesc void   )  const
 

Gets extended channel mode description.

Returns:
String with extended channel mode description.

Here is the call graph for this function:

string mp3_frame_header::GetEmphasisDesc void   )  const
 

Gets emphasis description.

Returns:
String with emphasis description.

Here is the call graph for this function:

bool mp3_frame_header::GetCRC void   )  const
 

Gets the CRC flag from the frame header.

Returns:
True if the gots CRC, else false.
Note:
0000 0000 0000 0001 0000 0000 0000 0000 (c) Binary mask.

0x10000 (c) Hexadecimal mask.

bool mp3_frame_header::GetPrivate void   )  const
 

Gets the private flag from the frame header.

Returns:
True if is private, else false.
Note:
0000 0000 0000 0000 0000 0001 0000 0000 (p) Binary mask.

0x100 (p) Hexadecimal mask.

bool mp3_frame_header::GetCopyright void   )  const
 

Gets the copyright flag from the frame header.

Returns:
True if is copyrighted, else false.
Note:
0000 0000 0000 0000 0000 0000 0000 1000 (r) Binary mask.

0x8 (r) Hexadecimal mask.

bool mp3_frame_header::GetOriginal void   )  const
 

Gets the original flag from the frame header.

Returns:
True if is original, else false.
Note:
0000 0000 0000 0000 0000 0000 0000 0100 (o) Binary mask.

0x4 (o) Hexadecimal mask.

int mp3_frame_header::GetMPEGVersion void   )  const [private]
 

Gets the MPEG version from the frame header.

Returns:
MPEG version index for description.
Note:
0000 0000 0001 1000 0000 0000 0000 0000 (vv) Binary mask.

0x180000 (vv) Hexadecimal mask.

int mp3_frame_header::GetLayerVersion void   )  const [private]
 

Gets the layer version from the frame header.

Returns:
Layer version index for description.
Note:
0000 0000 0000 0110 0000 0000 0000 0000 (ll) Binary mask.

0x60000 (ll) Hexadecimal mask.

int mp3_frame_header::GetBitrate void   )  const [private]
 

Gets the bitrate index from the frame header.

Returns:
Bit rate index for description.
Note:
0000 0000 0000 0000 1111 0000 0000 0000 (bbbb) Binary mask.

0x0F000 (bbbb) Hexadecimal mask.

int mp3_frame_header::GetSamplerate void   )  const [private]
 

Gets the samplerate index from the frame header.

Returns:
Sample rate index for description.
Note:
0000 0000 0000 0000 0000 1100 0000 0000 (yy) Binary mask.

0x0C00 (yy) Hexadecimal mask.

int mp3_frame_header::GetPadded void   )  const [private]
 

Gets the padded flag from the frame header.

Returns:
1 if is padded, else 0.
Note:
0000 0000 0000 0000 0000 0010 0000 0000 (d) Binary mask.

0x200 (d) Hexadecimal mask.

int mp3_frame_header::GetChanmode void   )  const [private]
 

Gets the channel mode index from the frame header.

Returns:
Channel mode index for description.
Note:
0000 0000 0000 0000 0000 0000 1100 0000 (mm) Binary mask.

0x0C0 (mm) Hexadecimal mask.

int mp3_frame_header::GetChanmodeEx void   )  const [private]
 

Gets the extended channel mode index from the frame header.

Returns:
Extended channel mode index for description.
Note:
0000 0000 0000 0000 0000 0000 0011 0000 (xx) Binary mask.

0x30 (xx) Hexadecimal mask.

int mp3_frame_header::GetEmphasis void   )  const [private]
 

Gets the emphasis index from the frame header.

Returns:
Emphasis index for description.
Note:
0000 0000 0000 0000 0000 0000 0000 0011 (ee) Binary mask.

0x3 (ee) Hexadecimal mask.


Member Data Documentation

const int mp3_frame_header::FRAME_SYNC = 0x0FFE00000 [static, private]
 

Frame Sync: 1111 1111 1110 0000 0000 0000 0000 0000.

const int mp3_frame_header::NUM_MPEG_VERSION = 4 [static, private]
 

Number of versions.

const int mp3_frame_header::MPEG_V1 = 3 [static, private]
 

Version 1.

const int mp3_frame_header::MPEG_V2 = 2 [static, private]
 

Version 2.

const int mp3_frame_header::MPEG_V25 = 0 [static, private]
 

Version 2.5.

const int mp3_frame_header::INVALID_MPEG = 1 [static, private]
 

Invalid version.

const int mp3_frame_header::NUM_LAYER_VERSION = 4 [static, private]
 

Number of layers.

const int mp3_frame_header::LAYER_I = 3 [static, private]
 

Layer I.

const int mp3_frame_header::LAYER_II = 2 [static, private]
 

Layer II.

const int mp3_frame_header::LAYER_III = 1 [static, private]
 

Layer III.

const int mp3_frame_header::INVALID_LAYER = 0 [static, private]
 

Invalid layer.

const int mp3_frame_header::SLOT_SIZE_LAYER_I = 4 [static, private]
 

Size of a slot - Layer I.

const int mp3_frame_header::SLOT_SIZE_LAYER_II_III = 1 [static, private]
 

Size of a slot - Layer II & III.

const int mp3_frame_header::SAMPLERATE_CONST_LAYER_I = 384 [static, private]
 

Sample rate constant - Layer I.

const int mp3_frame_header::SAMPLERATE_CONST_LAYER_II_III = 1152 [static, private]
 

Sample rate constant - Layer II & III.

const int mp3_frame_header::BITRATE_CONST_LAYER_I = 12 [static, private]
 

Bit rate constant - Layer I.

const int mp3_frame_header::BITRATE_CONST_LAYER_II_III = 144 [static, private]
 

Bit rate constant - Layer II & III.

const int mp3_frame_header::NUM_BITRATE = 16 [static, private]
 

Number of bit rates.

const int mp3_frame_header::FREE_BITRATE = 0 [static, private]
 

Free bitrate.

const int mp3_frame_header::INVALID_BITRATE = 15 [static, private]
 

Invalid bitrate.

const int mp3_frame_header::INVALID_BR_DESC = -1 [static, private]
 

Bit Rate desc for invalid bitrate.

const int mp3_frame_header::FREE_BR_DESC = 0 [static, private]
 

Bit Rate desc for free bitrate.

const int mp3_frame_header::NUM_SAMPLERATE = 4 [static, private]
 

Number of sample rates.

const int mp3_frame_header::INVALID_SAMPLERATE = 3 [static, private]
 

Invalid samplerate.

const int mp3_frame_header::INVALID_SR_DESC = -1 [static, private]
 

Sample Rate desc for invalid samplerate.

const int mp3_frame_header::NUM_CHANMODE = 4 [static, private]
 

Number of channel modes.

const int mp3_frame_header::CHANMODE_EX = 1 [static, private]
 

Channel mode extended.

const int mp3_frame_header::NUM_CHANMODE_EX = 4 [static, private]
 

Number of channel modes ex.

const int mp3_frame_header::NUM_EMPHASIS = 4 [static, private]
 

Number of emphasis.

const string mp3_frame_header::MPEG_VERSION_DESC [static, private]
 

Initial value:

{
    "MPEG Version 2.5",
    "Invalid value",
    "MPEG Version 2",
    "MPEG Version 1"
}
Array of mpeg versions.

  • 00 - MPEG Version 2.5 (later extension of MPEG 2)
  • 01 - reserved
  • 10 - MPEG Version 2 (ISO/IEC 13818-3)
  • 11 - MPEG Version 1 (ISO/IEC 11172-3)

const string mp3_frame_header::LAYER_VERSION_DESC [static, private]
 

Initial value:

{
    "Invalid value",
    "Layer III",
    "Layer II",
    "Layer I"
}
Array of channel modes.

  • 00 - reserved
  • 01 - Layer III
  • 10 - Layer II
  • 11 - Layer I

const int mp3_frame_header::BITRATE_DESC [static, private]
 

Array of bit rates.

BITS V1L1 V1L2 V1L3 V2L1 V2L2L3
0000 free free free free free
0001 32 32 32 32 8
0010 64 48 40 48 16
0011 96 56 48 56 24
0100 128 64 56 64 32
0101 160 80 64 80 40
0110 192 96 80 96 48
0111 224 112 96 112 56
1000 256 128 112 128 64
1001 288 160 128 144 80
1010 320 192 160 160 96
1011 356 224 192 176 112
1100 384 256 224 192 128
1101 416 320 256 224 144
1110 448 384 320 256 160
1111 bad bad bad bad bad

const int mp3_frame_header::SAMPLERATE_DESC [static, private]
 

Initial value:

{
    
    11025, 12000, 8000, INVALID_SR_DESC,
    
    INVALID_SR_DESC, INVALID_SR_DESC, INVALID_SR_DESC, INVALID_SR_DESC,
    
    22050, 24000, 16000, INVALID_SR_DESC,
    
    44100, 48000, 32000, INVALID_SR_DESC
}
Array of sample rates.

BITS MPEG v1 MPEG v2 MPEG v2.5
00 44100Hz 22050Hz 11025Hz
01 48000Hz 24000Hz 12000Hz
10 32000Hz 16000Hz 8000Hz
11 reserv. reserv. reserv.

const string mp3_frame_header::CHANMODE_DESC [static, private]
 

Initial value:

{
    "Stereo", 
    "Extended", 
    "Dual channel (Mono)", 
    "Mono"
}
Array of channel modes.

  • 00 - Stereo
  • 01 - Joint stereo
  • 10 - Dual channel (Mono)
  • 11 - Mono.

const string mp3_frame_header::CHANMODE_EX_DESC [static, private]
 

Initial value:

{
    
    "Invalid value", "Invalid value", "Invalid value", "Invalid value",
    
    "Joint stereo", "Intensity stereo", "Mid side stereo", "Intensity & mid side stereo",
    
    "Intensity stereo", "Intensity stereo", "Intensity stereo", "Intensity stereo",
    
    "Intensity stereo", "Intensity stereo", "Intensity stereo", "Intensity stereo"
}
Array of extended channel modes.

Layer I & II:
BITS Intensity stereo
00 bands 4 to 31
01 bands 8 to 31
10 bands 12 to 31
11 bands 16 to 31

Layer III:
BITS Intensity stereo Mid Side stereo
00 OFF OFF
01 ON OFF
10 OFF ON
11 ON ON

const string mp3_frame_header::EMPHASIS_DESC [static, private]
 

Initial value:

{
    "None", 
    "50/15 ms", 
    "reserved", 
    "CCIT J.17"
}
Array of emphasis.

  • 00 - None
  • 01 - 50/15 ms
  • 10 - reserved
  • 11 - CCIT J.17

int mp3_frame_header::m_FrameHeader [private]
 

MP3 frame header.


The documentation for this class was generated from the following files:
doxygen sourceforge id3lib