X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcodec%2Fmpeg_audio.c;h=8cec9996b85736d75e93e3b811edac988915052e;hb=d6a720cb351211eb36303f18340a9889223f6f7e;hp=8918ff68a1a2edaabdd3dc96b5f415f9ec4ca3de;hpb=1e9f16e284a4bb84ac446bf18e6b5581754fc6d3;p=vlc diff --git a/modules/codec/mpeg_audio.c b/modules/codec/mpeg_audio.c index 8918ff68a1..8cec9996b8 100644 --- a/modules/codec/mpeg_audio.c +++ b/modules/codec/mpeg_audio.c @@ -1,13 +1,13 @@ /***************************************************************************** * mpeg_audio.c: parse MPEG audio sync info and packetize the stream ***************************************************************************** - * Copyright (C) 2001-2003 VideoLAN - * $Id: mpeg_audio.c,v 1.22 2003/11/16 21:07:30 gbazin Exp $ + * Copyright (C) 2001-2003 the VideoLAN team + * $Id$ * * Authors: Laurent Aimar * Eric Petit * Christophe Massiot - * Gildas Bazin + * Gildas Bazin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,14 +27,9 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include /* strdup() */ - #include #include -#include #include -#include #include "vlc_block_helper.h" @@ -109,7 +104,13 @@ static int SyncInfo( uint32_t i_header, unsigned int * pi_channels, *****************************************************************************/ vlc_module_begin(); set_description( _("MPEG audio layer I/II/III parser") ); + set_category( CAT_INPUT ); + set_subcategory( SUBCAT_INPUT_ACODEC ); +#if defined(SYS_DARWIN) || defined(UNDER_CE) + set_capability( "decoder", 5 ); +#else set_capability( "decoder", 100 ); +#endif set_callbacks( OpenDecoder, CloseDecoder ); add_submodule(); @@ -131,6 +132,13 @@ static int OpenDecoder( vlc_object_t *p_this ) return VLC_EGENERIC; } + /* HACK: Don't use this codec if we don't have an mpga audio filter */ + if( p_dec->i_object_type == VLC_OBJECT_DECODER && + !config_FindModule( p_this, "mpgatofixed32" ) ) + { + return VLC_EGENERIC; + } + /* Allocate the memory needed to store the decoder's structure */ if( ( p_dec->p_sys = p_sys = (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL ) @@ -148,6 +156,7 @@ static int OpenDecoder( vlc_object_t *p_this ) /* Set output properties */ p_dec->fmt_out.i_cat = AUDIO_ES; p_dec->fmt_out.i_codec = VLC_FOURCC('m','p','g','a'); + p_dec->fmt_out.audio.i_rate = 0; /* So end_date gets initialized */ /* Set callback */ p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **)) @@ -194,7 +203,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) return NULL; } - if( (*pp_block)->b_discontinuity ) + if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) { p_sys->i_state = STATE_NOSYNC; } @@ -261,7 +270,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) if( p_sys->i_frame_size == -1 ) { - msg_Dbg( p_dec, "emulated start code" ); + msg_Dbg( p_dec, "emulated startcode" ); block_SkipByte( &p_sys->bytestream ); p_sys->i_state = STATE_NOSYNC; break; @@ -335,7 +344,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) if( i_next_frame_size == -1 ) { - msg_Dbg( p_dec, "emulated start code on next frame" ); + msg_Dbg( p_dec, "emulated startcode on next frame" ); block_SkipByte( &p_sys->bytestream ); p_sys->i_state = STATE_NOSYNC; break; @@ -464,7 +473,7 @@ static uint8_t *GetOutBuffer( decoder_t *p_dec, void **pp_out_buffer ) if( p_dec->fmt_out.audio.i_rate != p_sys->i_rate ) { - msg_Info( p_dec, "MPGA channels:%d samplerate:%d bitrate:%d", + msg_Dbg( p_dec, "MPGA channels:%d samplerate:%d bitrate:%d", p_sys->i_channels, p_sys->i_rate, p_sys->i_bit_rate ); aout_DateInit( &p_sys->end_date, p_sys->i_rate ); @@ -473,7 +482,6 @@ static uint8_t *GetOutBuffer( decoder_t *p_dec, void **pp_out_buffer ) p_dec->fmt_out.audio.i_rate = p_sys->i_rate; p_dec->fmt_out.audio.i_channels = p_sys->i_channels; - p_dec->fmt_out.audio.i_bitrate = p_sys->i_bit_rate; p_dec->fmt_out.audio.i_frame_length = p_sys->i_frame_length; p_dec->fmt_out.audio.i_bytes_per_frame = p_sys->i_max_frame_size + MAD_BUFFER_GUARD; @@ -482,6 +490,8 @@ static uint8_t *GetOutBuffer( decoder_t *p_dec, void **pp_out_buffer ) p_dec->fmt_out.audio.i_physical_channels = p_sys->i_channels_conf & AOUT_CHAN_PHYSMASK; + p_dec->fmt_out.i_bitrate = p_sys->i_bit_rate * 1000; + if( p_sys->b_packetizer ) { block_t *p_sout_buffer = GetSoutBuffer( p_dec );