src/mp3_mpeg.c File Reference

Source - Mp3 file format, data. More...

#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "check.h"
#include "file.h"
#include "mp3_mpeg.h"

Go to the source code of this file.

Functions

ptrdiff_t mp3_next_frame (char *buffer, size_t len)
 locate the next mpeg frame in a buffer
unsigned int mp3_bitrate (mp3_frame *frame)
 return a mpeg audio frame bitrate
unsigned int mp3_samplerate (mp3_frame *frame)
 return a mpeg audio frame samplerate
unsigned int mp3_length (mp3_frame *frame, unsigned long filesize)
 estimate the duration of an mpeg audio media using a frame and filesize

Variables

const unsigned int bitrate_index [16][2][3]
 bitrate by layer, version and bitrate index
const unsigned int samplerate_index [4][3]
 bitrate by version and samplerate index

Detailed Description

Source - Mp3 file format, data.

Author:
Julien Blitte
Version:
0.1

Definition in file mp3_mpeg.c.


Function Documentation

unsigned int mp3_bitrate ( mp3_frame frame  ) 

return a mpeg audio frame bitrate

Parameters:
frame mpeg audio frame to analyze
Returns:
the bitrate of frame

Definition at line 121 of file mp3_mpeg.c.

References bitrate_index, and check.

Referenced by mp3_length().

unsigned int mp3_length ( mp3_frame frame,
const unsigned long  filesize 
)

estimate the duration of an mpeg audio media using a frame and filesize

Parameters:
frame mpeg audio frame used to compute media duration
filesize filesize used to compute media duration
Returns:
estimated media duration

Definition at line 177 of file mp3_mpeg.c.

References check, and mp3_bitrate().

ptrdiff_t mp3_next_frame ( char *  buffer,
const size_t  len 
)

locate the next mpeg frame in a buffer

Parameters:
buffer buffer in which to locate next frame - binary
len size of buffer
Returns:
next frame in buffer

Definition at line 52 of file mp3_mpeg.c.

References check.

unsigned int mp3_samplerate ( mp3_frame frame  ) 

return a mpeg audio frame samplerate

Parameters:
frame mpeg audio frame to analyze
Returns:
the samplerate of frame

Definition at line 128 of file mp3_mpeg.c.

References check, MP3_VER_1, MP3_VER_2, MP3_VER_2_5, and samplerate_index.


Variable Documentation

const unsigned int bitrate_index[16][2][3]
Initial value:
{
        { {0  , 0  , 0  }, { 0  , 0  , 0   } },
        { {32 , 32 , 32 }, { 32 , 8  , 8   } },
        { {64 , 48 , 40 }, { 48 , 16 , 16  } },
        { {96 , 56 , 48 }, { 56 , 24 , 24  } },
        { {128, 64 , 56 }, { 64 , 32 , 32  } },
        { {160, 80 , 64 }, { 80 , 40 , 40  } },
        { {192, 96 , 80 }, { 96 , 48 , 48  } },
        { {224, 112, 96 }, { 112, 56 , 56  } },
        { {256, 128, 112}, { 128, 64 , 64  } },
        { {288, 160, 128}, { 144, 80 , 80  } },
        { {320, 192, 160}, { 160, 96 , 96  } },
        { {352, 224, 192}, { 176, 112, 112 } },
        { {384, 256, 224}, { 192, 128, 128 } },
        { {416, 320, 256}, { 224, 144, 144 } },
        { {448, 384, 320}, { 256, 160, 160 } },
        { {0  , 0  , 0  }, { 0  , 0  , 0   } },
}

bitrate by layer, version and bitrate index

Definition at line 21 of file mp3_mpeg.c.

Referenced by mp3_bitrate().

const unsigned int samplerate_index[4][3]
Initial value:
{
        {44100, 22050, 11025 },
        {48000, 24000, 12000 },
        {32000, 16000, 8000  },
        {0,     0,     0     }
}

bitrate by version and samplerate index

Definition at line 44 of file mp3_mpeg.c.

Referenced by mp3_samplerate().

 All Classes Files Functions Variables Typedefs Defines

Generated on Mon Jan 11 00:15:07 2010 for db5fuse by  doxygen 1.6.1