* asf.c : ASFv01 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: asf.c,v 1.26 2003/04/09 14:12:49 hartman Exp $
+ * $Id: asf.c,v 1.29 2003/05/22 21:42:43 gbazin Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
demux_sys_t *p_demux;
int i_stream;
+ vlc_bool_t b_seekable;
+
/* Initialize access plug-in structures. */
if( p_input->i_mtu == 0 )
{
p_demux->i_time = -1;
/* Now load all object ( except raw data ) */
- if( !ASF_ReadObjectRoot( p_input, &p_demux->root, p_input->stream.b_seekable ) )
+ if( p_input->stream.b_seekable && p_input->stream.i_method == INPUT_METHOD_FILE )
+ {
+ b_seekable = VLC_TRUE;
+ }
+ else
+ {
+ b_seekable = VLC_FALSE;
+ }
+ if( !ASF_ReadObjectRoot( p_input, &p_demux->root, b_seekable ) )
{
msg_Warn( p_input, "ASF v1.0 plugin discarded (not a valid file)" );
free( p_demux );
p_stream->p_sp = p_sp;
vlc_mutex_lock( &p_input->stream.stream_lock );
- p_stream->p_es =
- input_AddES( p_input,
- p_input->stream.p_selected_program,
- p_sp->i_stream_number,
- 0 );
+ p_stream->p_es = NULL;
vlc_mutex_unlock( &p_input->stream.stream_lock );
if( CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_audio ) )
}
p_stream->i_cat = AUDIO_ES;
+ p_stream->p_es = input_AddES( p_input,
+ p_input->stream.p_selected_program,
+ p_sp->i_stream_number, AUDIO_ES, NULL, 0 );
+
input_AddInfo( p_cat, _("Type"), _("Audio") );
msg_Dbg( p_input,
"adding new audio stream(codec:0x%x,ID:%d)",
if( CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_video ) )
{
p_stream->i_cat = VIDEO_ES;
+ p_stream->p_es = input_AddES( p_input,
+ p_input->stream.p_selected_program,
+ p_sp->i_stream_number, VIDEO_ES, NULL, 0 );
+
input_AddInfo( p_cat, _("Type"), _("Video") );
- msg_Dbg( p_input,
- "adding new video stream(ID:%d)",
- p_sp->i_stream_number );
+ msg_Dbg( p_input, "adding new video stream(ID:%d)",
+ p_sp->i_stream_number );
if( p_sp->p_type_specific_data )
{
p_stream->p_es->i_fourcc =
else
{
p_stream->i_cat = UNKNOWN_ES;
- msg_Dbg( p_input,
- "ignoring unknown stream(ID:%d)",
- p_sp->i_stream_number );
- p_stream->p_es->i_fourcc = VLC_FOURCC( 'u','n','d','f' );
+ msg_Dbg( p_input, "ignoring unknown stream(ID:%d)",
+ p_sp->i_stream_number );
}
- p_stream->p_es->i_cat = p_stream->i_cat;
vlc_mutex_lock( &p_input->stream.stream_lock );
- if( p_stream->p_es->i_fourcc != VLC_FOURCC( 'u','n','d','f' ) )
+ if( p_stream->p_es )
{
input_SelectES( p_input, p_stream->p_es );
}
}
/* FIXME I don't use i_media_object_number, sould I ? */
- if( p_stream->p_pes && i_media_object_offset == 0 ) {
+ if( p_stream->p_pes && i_media_object_offset == 0 )
+ {
/* send complete packet to decoder */
if( p_stream->p_pes->i_pes_size > 0 )
{
if( p_stream->p_es->p_decoder_fifo &&
( b_play_audio || p_stream->i_cat != AUDIO_ES ) )
{
+ p_stream->p_pes->i_rate =
+ p_input->stream.control.i_rate;
input_DecodePES( p_stream->p_es->p_decoder_fifo,
p_stream->p_pes );
}
}
}
- vlc_mutex_lock( &p_input->stream.stream_lock );
- if( p_input->stream.control.i_rate == DEFAULT_RATE )
- {
- b_play_audio = VLC_TRUE;
- }
- else
- {
- int i;
-
- b_play_audio = VLC_TRUE;
- for( i = 0; i < 128; i++ )
- {
- if( p_demux->stream[i] &&
- p_demux->stream[i]->i_cat == VIDEO_ES &&
- p_demux->stream[i]->p_es &&
- p_demux->stream[i]->p_es->p_decoder_fifo )
- {
- /* there is at least ine video track so no need to play audio */
- b_play_audio = VLC_FALSE;
- }
- }
- }
- vlc_mutex_unlock( &p_input->stream.stream_lock );
+ /* Check if we need to send the audio data to decoder */
+ b_play_audio = !p_input->stream.control.b_mute;
for( ;; )
{