* au.c : au file input module for vlc
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
- * $Id: au.c,v 1.13 2004/01/29 15:11:17 fenrir Exp $
+ * $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
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_callbacks( Open, Close );
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( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) return VLC_EGENERIC;
+
if( strncmp( p_peek, ".snd", 4 ) )
{
- msg_Warn( p_demux, "AU module discarded" );
return VLC_EGENERIC;
}
}
p_sys = p_demux->p_sys = malloc( sizeof( demux_sys_t ) );
- p_sys->i_time = 0;
+ p_sys->i_time = 1;
p_sys->i_header_size = GetDWBE( &hdr[0] );
/* skip extra header data */
static int Control( demux_t *p_demux, int i_query, va_list args )
{
demux_sys_t *p_sys = p_demux->p_sys;
- double f, *pf;
- int64_t *pi64;
-
- switch( i_query )
- {
- case DEMUX_GET_POSITION:
- {
- int64_t i_tell = stream_Tell( p_demux->s );
- int64_t i_end = stream_Size( p_demux->s );
-
- pf = (double*) va_arg( args, double* );
-
- if( p_sys->i_header_size < i_end )
- {
- *pf = (double)( i_tell - p_sys->i_header_size ) /
- (double)(i_end - p_sys->i_header_size);
- return VLC_SUCCESS;
- }
- return VLC_EGENERIC;
- }
- case DEMUX_SET_POSITION:
- {
- int64_t i_end = stream_Size( p_demux->s );
-
- f = (double) va_arg( args, double );
-
- if( p_sys->i_header_size < i_end )
- {
- int64_t i_frame = (f * ( i_end - p_sys->i_header_size )) /
- p_sys->fmt.audio.i_blockalign;
-
- if( stream_Seek( p_demux->s, p_sys->i_header_size +
- i_frame * p_sys->fmt.audio.i_blockalign ) )
- {
- return VLC_EGENERIC;
- }
- p_sys->i_time = 1 + ( i_frame * p_sys->fmt.audio.i_blockalign / p_sys->i_frame_size ) * p_sys->i_frame_length;
- return VLC_SUCCESS;
- }
- return VLC_EGENERIC;
- }
-
- case DEMUX_GET_TIME:
- pi64 = (int64_t*)va_arg( args, int64_t * );
- *pi64 = p_sys->i_time;
- return VLC_SUCCESS;
- case DEMUX_GET_LENGTH:
- {
- int64_t i_size = stream_Size( p_demux->s ) - p_sys->i_header_size;
- if( i_size > 0 )
- {
- pi64 = (int64_t*)va_arg( args, int64_t * );
- *pi64 = i_size / p_sys->i_frame_size * p_sys->i_frame_length;
- return VLC_SUCCESS;
- }
- return VLC_EGENERIC;
- }
- case DEMUX_SET_TIME:
- case DEMUX_GET_FPS:
- default:
- return VLC_EGENERIC;
- }
+ return demux2_vaControlHelper( p_demux->s, p_sys->i_header_size, -1,
+ p_sys->fmt.i_bitrate, p_sys->fmt.audio.i_blockalign,
+ i_query, args );
}
-
-
-
-
-
-
-