X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fdemux%2Fau.c;h=58da050f6175464eaebb058ac23be30221b76a0f;hb=588723d7c65ccdb0fa5cc39b3cae132176637300;hp=e3543b8caf4ee95c1fca0e8bcc12e55b9e6fc233;hpb=a90a19a6b0468ea9fedadc27cfc1118d70295263;p=vlc diff --git a/modules/demux/au.c b/modules/demux/au.c index e3543b8caf..58da050f61 100644 --- a/modules/demux/au.c +++ b/modules/demux/au.c @@ -1,7 +1,7 @@ /***************************************************************************** * au.c : au file input module for vlc ***************************************************************************** - * Copyright (C) 2001-2003 VideoLAN + * Copyright (C) 2001-2007 the VideoLAN team * $Id$ * * Authors: Laurent Aimar @@ -18,16 +18,20 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include /* TODO: * - all adpcm things (I _NEED_ samples) @@ -43,8 +47,8 @@ static void Close( vlc_object_t * ); vlc_module_begin(); set_category( CAT_INPUT ); set_subcategory( SUBCAT_INPUT_DEMUX ); - set_description( _("AU demuxer") ); - set_capability( "demux2", 10 ); + set_description( N_("AU demuxer") ); + set_capability( "demux", 10 ); set_callbacks( Open, Close ); add_shortcut( "au" ); vlc_module_end(); @@ -89,7 +93,7 @@ struct demux_sys_t int i_header_size; }; -static int DemuxPCM( demux_t * ); +static int Demux( demux_t * ); static int Control ( demux_t *, int i_query, va_list args ); /***************************************************************************** @@ -101,18 +105,14 @@ static int Open( vlc_object_t *p_this ) demux_sys_t *p_sys; uint8_t hdr[20]; - uint8_t *p_peek; + const uint8_t *p_peek; int i_cat; int i_samples, i_modulo; - if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) - { - msg_Warn( p_demux, "cannot peek" ); - return VLC_EGENERIC; - } - if( strncmp( p_peek, ".snd", 4 ) ) + CHECK_PEEK( p_peek, 4 ); + + if( memcmp( p_peek, ".snd", 4 ) ) { - msg_Warn( p_demux, "AU module discarded" ); return VLC_EGENERIC; } @@ -132,7 +132,7 @@ static int Open( vlc_object_t *p_this ) return VLC_EGENERIC; } - p_sys = p_demux->p_sys = malloc( sizeof( demux_sys_t ) ); + DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys; p_sys->i_time = 1; p_sys->i_header_size = GetDWBE( &hdr[0] ); @@ -280,19 +280,15 @@ static int Open( vlc_object_t *p_this ) (mtime_t)i_samples / (mtime_t)p_sys->fmt.audio.i_rate; - /* finish to set up p_demux */ - p_demux->pf_demux = DemuxPCM; - p_demux->pf_control = Control; - return VLC_SUCCESS; } /***************************************************************************** - * DemuxPCM: read packet and send them to decoders + * Demux: read packet and send them to decoders ***************************************************************************** * Returns -1 in case of error, 0 in case of EOF, 1 otherwise *****************************************************************************/ -static int DemuxPCM( demux_t *p_demux ) +static int Demux( demux_t *p_demux ) { demux_sys_t *p_sys = p_demux->p_sys; block_t *p_block; @@ -334,7 +330,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) { demux_sys_t *p_sys = p_demux->p_sys; - return demux2_vaControlHelper( p_demux->s, p_sys->i_header_size, -1, + return demux_vaControlHelper( p_demux->s, p_sys->i_header_size, -1, p_sys->fmt.i_bitrate, p_sys->fmt.audio.i_blockalign, i_query, args ); }