]> git.sesse.net Git - vlc/blobdiff - modules/demux/xa.c
* backport of [11296]
[vlc] / modules / demux / xa.c
index cc40282c0c53a7dff52d1d6168726f2992fcaa98..dfa9ce2116a2461dfcae7e2d456361fb3e964aac 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2005 VideoLAN
  * $Id$
  *
- * Authors: Remi Denis-Courmont <rem # via.ecp.fr>
+ * Authors: Remi Denis-Courmont <rem # videolan.org>
  *
  * 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
@@ -107,17 +107,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 +195,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 demux2_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 );