X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fdemux%2Fxa.c;h=65a3f2eca904e3fb666047b939aa95a0524359e9;hb=b1fdae4f897451b066f0c6f29c21c57491ea1f6d;hp=206113cb4ad6e6c053a44c7e15b70863c1ea5383;hpb=8499b6cda49a4461cf8546a3cfdd845c1c870d4d;p=vlc diff --git a/modules/demux/xa.c b/modules/demux/xa.c index 206113cb4a..65a3f2eca9 100644 --- a/modules/demux/xa.c +++ b/modules/demux/xa.c @@ -1,10 +1,10 @@ /***************************************************************************** - * xa.c : xa file input module for vlc + * xa.c : xa file demux module for vlc ***************************************************************************** - * Copyright (C) 2005 VideoLAN + * Copyright (C) 2005 Rémi Denis-Courmont * $Id$ * - * Authors: Remi Denis-Courmont + * Authors: Rémi Denis-Courmont * * 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 @@ -18,19 +18,22 @@ * * 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 -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif -#include +#include +#include +#include + +#include /***************************************************************************** * Module descriptor @@ -38,13 +41,13 @@ static int Open ( vlc_object_t * ); static void Close( vlc_object_t * ); -vlc_module_begin(); - set_description( _("XA demuxer") ); - set_category( CAT_INPUT ); - set_subcategory( SUBCAT_INPUT_DEMUX ); - set_capability( "demux2", 10 ); - set_callbacks( Open, Close ); -vlc_module_end(); +vlc_module_begin () + set_description( N_("XA demuxer") ) + set_category( CAT_INPUT ) + set_subcategory( SUBCAT_INPUT_DEMUX ) + set_capability( "demux", 10 ) + set_callbacks( Open, Close ) +vlc_module_end () /***************************************************************************** * Local prototypes @@ -63,18 +66,18 @@ struct demux_sys_t date_t pts; }; -typedef struct xa_header +typedef struct xa_header_t { - uint8_t xa_id[4]; - uint32_t iSize; + char xa_id[4]; + uint32_t iSize; - uint16_t wFormatTag; - uint16_t nChannels; - uint32_t nSamplesPerSec; - uint32_t nAvgBytesPerSec; - uint16_t nBlockAlign; - uint16_t wBitsPerSample; -} xa_header; + uint16_t wFormatTag; + uint16_t nChannels; + uint32_t nSamplesPerSec; + uint32_t nAvgBytesPerSec; + uint16_t nBlockAlign; + uint16_t wBitsPerSample; +} xa_header_t; /***************************************************************************** @@ -84,8 +87,8 @@ static int Open( vlc_object_t * p_this ) { demux_t *p_demux = (demux_t*)p_this; demux_sys_t *p_sys; - xa_header p_xa; - uint8_t *p_buf; + xa_header_t p_xa; + const uint8_t *p_buf; /* XA file heuristic */ if( stream_Peek( p_demux->s, &p_buf, sizeof( p_xa ) ) @@ -107,17 +110,16 @@ static int Open( vlc_object_t * p_this ) /* skip XA header -- cannot fail */ stream_Read( p_demux->s, NULL, sizeof( p_xa ) ); - es_format_Init( &p_sys->fmt, AUDIO_ES, 0 ); + es_format_Init( &p_sys->fmt, AUDIO_ES, VLC_FOURCC('X','A','J',0) ); - msg_Dbg( p_demux, "assuming EA ADPCM audio format" ); - p_sys->fmt.i_codec = VLC_FOURCC('X','A','J',0); + msg_Dbg( p_demux, "assuming EA ADPCM audio codec" ); p_sys->fmt.audio.i_rate = GetDWLE( &p_xa.nSamplesPerSec ); p_sys->fmt.audio.i_bytes_per_frame = 15 * GetWLE( &p_xa.nChannels ); p_sys->fmt.audio.i_frame_length = 28; /* 28 samples of 4 bits each */ p_sys->fmt.audio.i_channels = GetWLE ( &p_xa.nChannels ); p_sys->fmt.audio.i_blockalign = p_sys->fmt.audio.i_bytes_per_frame; - p_sys->fmt.audio.i_bitspersample = 4; + p_sys->fmt.audio.i_bitspersample = 16; p_sys->fmt.i_bitrate = (p_sys->fmt.audio.i_rate * p_sys->fmt.audio.i_bytes_per_frame * 8) / p_sys->fmt.audio.i_frame_length; @@ -196,10 +198,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) { demux_sys_t *p_sys = p_demux->p_sys; - if( i_query == DEMUX_SET_POSITION ) - return -1; /* FIXME: progressive encoding - seeking not supported */ - - return demux2_vaControlHelper( p_demux->s, 0, -1, + return demux_vaControlHelper( p_demux->s, p_sys->i_data_offset, + p_sys->i_data_size ? p_sys->i_data_offset + + p_sys->i_data_size : -1, p_sys->fmt.i_bitrate, p_sys->fmt.audio.i_blockalign, i_query, args );