Commit 80a2e686 authored by Laurent Aimar's avatar Laurent Aimar

* all : added mpeg 2.5 support.

parent df56b0c1
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mpga.c : MPEG-I/II Audio input module for vlc * mpga.c : MPEG-I/II Audio input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: mpga.c,v 1.3 2003/09/07 22:48:29 fenrir Exp $ * $Id: mpga.c,v 1.4 2003/09/10 21:56:44 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -44,7 +44,6 @@ vlc_module_begin(); ...@@ -44,7 +44,6 @@ vlc_module_begin();
vlc_module_end(); vlc_module_end();
/* TODO: /* TODO:
* - mpeg 2.5
* - free bitrate * - free bitrate
*/ */
...@@ -64,12 +63,12 @@ struct demux_sys_t ...@@ -64,12 +63,12 @@ struct demux_sys_t
static int HeaderCheck( uint32_t h ) static int HeaderCheck( uint32_t h )
{ {
if( ((( h >> 20 )&0x0FFF) != 0x0FFF ) /* header sync */ if( ((( h >> 21 )&0x07FF) != 0x07FF ) /* header sync */
|| (((h >> 17)&0x03) == 0 ) /* valid layer ?*/ || (((h >> 17)&0x03) == 0 ) /* valid layer ?*/
|| (((h >> 12)&0x0F) == 0x0F ) || (((h >> 12)&0x0F) == 0x0F )
|| (((h >> 12)&0x0F) == 0x00 ) /* valid bitrate ? */ || (((h >> 12)&0x0F) == 0x00 ) /* valid bitrate ? */
|| (((h >> 10) & 0x03) == 0x03 ) /* valide sampling freq ? */ || (((h >> 10) & 0x03) == 0x03 ) /* valide sampling freq ? */
|| ((h & 0x03) == 0x02 )) /* valid emphasis ? */ || ((h & 0x03) == 0x02 )) /* valid emphasis ? */
{ {
return( VLC_FALSE ); return( VLC_FALSE );
} }
...@@ -99,7 +98,8 @@ static int mpga_bitrate[2][3][16] = ...@@ -99,7 +98,8 @@ static int mpga_bitrate[2][3][16] =
#define MPGA_VERSION( h ) ( 1 - (((h)>>19)&0x01) ) #define MPGA_VERSION( h ) ( 1 - (((h)>>19)&0x01) )
#define MPGA_LAYER( h ) ( 3 - (((h)>>17)&0x03) ) #define MPGA_LAYER( h ) ( 3 - (((h)>>17)&0x03) )
#define MPGA_SAMPLE_RATE(h) mpga_sample_rate[MPGA_VERSION(h)][((h)>>10)&0x03] #define MPGA_SAMPLE_RATE(h) \
( mpga_sample_rate[MPGA_VERSION(h)][((h)>>10)&0x03] / ( ((h>>20)&0x01) ? 1 : 2) )
#define MPGA_CHANNELS(h) ( (((h)>>6)&0x03) == 3 ? 1 : 2) #define MPGA_CHANNELS(h) ( (((h)>>6)&0x03) == 3 ? 1 : 2)
#define MPGA_BITRATE(h) mpga_bitrate[MPGA_VERSION(h)][MPGA_LAYER(h)][((h)>>12)&0x0f] #define MPGA_BITRATE(h) mpga_bitrate[MPGA_VERSION(h)][MPGA_LAYER(h)][((h)>>12)&0x0f]
#define MPGA_PADDING(h) ( ((h)>>9)&0x01 ) #define MPGA_PADDING(h) ( ((h)>>9)&0x01 )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mpegaudio.c * mpegaudio.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: mpegaudio.c,v 1.8 2003/09/02 20:19:26 gbazin Exp $ * $Id: mpegaudio.c,v 1.9 2003/09/10 21:56:44 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org> * Eric Petit <titer@videolan.org>
...@@ -228,7 +228,7 @@ static void PacketizeThread( packetizer_t *p_pack ) ...@@ -228,7 +228,7 @@ static void PacketizeThread( packetizer_t *p_pack )
RealignBits( &p_pack->bit_stream ); RealignBits( &p_pack->bit_stream );
while( ShowBits( &p_pack->bit_stream, 12 ) != 0x0fff && while( ShowBits( &p_pack->bit_stream, 11 ) != 0x07ff &&
!p_pack->p_fifo->b_die && !p_pack->p_fifo->b_error ) !p_pack->p_fifo->b_die && !p_pack->p_fifo->b_error )
{ {
//msg_Warn( p_pack->p_fifo, "trash..." ); //msg_Warn( p_pack->p_fifo, "trash..." );
...@@ -268,6 +268,12 @@ static void PacketizeThread( packetizer_t *p_pack ) ...@@ -268,6 +268,12 @@ static void PacketizeThread( packetizer_t *p_pack )
i_channels = ( i_mode == 3 ) ? 1 : 2; i_channels = ( i_mode == 3 ) ? 1 : 2;
i_bitrate = mpegaudio_bitrate[i_version][i_layer][i_bitrate_index]; i_bitrate = mpegaudio_bitrate[i_version][i_layer][i_bitrate_index];
i_samplerate = mpegaudio_samplerate[i_version][i_samplerate_index]; i_samplerate = mpegaudio_samplerate[i_version][i_samplerate_index];
if( ( i_sync & 0x01 ) == 0x00 )
{
/* mpeg 2.5 */
i_samplerate /= 2;
}
switch( i_layer ) switch( i_layer )
{ {
case 0: case 0:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment