Commit 51f7848f authored by Gildas Bazin's avatar Gildas Bazin

* All: moved the check for "video" and "audio" config variables to
   input_SelectES(). That allows --no-video and --no-audio to automagically
   work for all demuxers.
parent ec166301
/* es.c: functions to find and select ES
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: es.c,v 1.2 2002/08/30 22:22:24 massiot Exp $
* $Id: es.c,v 1.3 2002/11/05 18:25:43 gbazin Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -254,13 +254,10 @@ void DVDLaunchDecoders( input_thread_t * p_input )
p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
/* Select Video stream (always 0) */
if( config_GetInt( p_input, "video" ) )
{
input_SelectES( p_input, p_input->stream.pp_es[0] );
}
input_SelectES( p_input, p_input->stream.pp_es[0] );
/* Select audio stream */
if( p_dvd->i_audio_nb > 0 && config_GetInt( p_input, "audio" ) )
if( p_dvd->i_audio_nb > 0 )
{
/* For audio: first one if none or a not existing one specified */
i_audio = config_GetInt( p_input, "audio-channel" );
......@@ -295,7 +292,7 @@ void DVDLaunchDecoders( input_thread_t * p_input )
}
/* Select subtitle */
if( p_dvd->i_spu_nb > 0 && config_GetInt( p_input, "video" ) )
if( p_dvd->i_spu_nb )
{
/* for spu, default is none */
i_spu = config_GetInt( p_input, "spu-channel" );
......
......@@ -2,7 +2,7 @@
* es.c: functions to handle elementary streams.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: es.c,v 1.3 2002/08/30 22:22:24 massiot Exp $
* $Id: es.c,v 1.4 2002/11/05 18:25:43 gbazin Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -236,16 +236,12 @@ void dvdplay_LaunchDecoders( input_thread_t * p_input )
dvdplay_audio_info( p_dvd->vmg, &i_audio_nr, &i_audio );
dvdplay_subp_info( p_dvd->vmg, &i_subp_nr, &i_subp );
if( config_GetInt( p_input, "video" ) )
{
input_SelectES( p_input, p_input->stream.pp_es[0] );
}
input_SelectES( p_input, p_input->stream.pp_es[0] );
// if( !i_audio ) i_audio = 1;
if( i_audio > p_dvd->i_audio_nb ) i_audio = 1;
if( config_GetInt( p_input, "audio" )
&&( i_audio > 0 ) && ( p_dvd->i_audio_nb > 0 ) )
if( ( i_audio > 0 ) && ( p_dvd->i_audio_nb > 0 ) )
{
if( config_GetInt( p_input, "audio-type" ) == REQUESTED_A52 )
{
......@@ -279,8 +275,7 @@ void dvdplay_LaunchDecoders( input_thread_t * p_input )
}
}
if( config_GetInt( p_input, "video" )
&& ( i_subp > 0 ) && ( p_dvd->i_spu_nb > 0 ) )
if( ( i_subp > 0 ) && ( p_dvd->i_spu_nb > 0 ) )
{
i_subp += p_dvd->i_audio_nb;
input_SelectES( p_input, p_input->stream.pp_es[i_subp] );
......
......@@ -6,7 +6,7 @@
* It depends on: libdvdread for ifo files and block reading.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input.c,v 1.6 2002/10/26 15:24:19 gbazin Exp $
* $Id: input.c,v 1.7 2002/11/05 18:25:43 gbazin Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -1198,64 +1198,51 @@ static void DvdReadFindCell( thread_dvd_data_t * p_dvd )
*****************************************************************************/
static void DvdReadLauchDecoders( input_thread_t * p_input )
{
thread_dvd_data_t * p_dvd;
p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
if( config_GetInt( p_input, "video" ) )
thread_dvd_data_t * p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
int i_audio, i_spu;
input_SelectES( p_input, p_input->stream.pp_es[0] );
/* For audio: first one if none or a not existing one specified */
i_audio = config_GetInt( p_input, "audio-channel" );
if( i_audio < 0 /*|| i_audio > i_audio_nb*/ )
{
input_SelectES( p_input, p_input->stream.pp_es[0] );
config_PutInt( p_input, "audio-channel", 1 );
i_audio = 1;
}
if( config_GetInt( p_input, "audio" ) )
if( i_audio > 0/* && i_audio_nb > 0*/ )
{
/* For audio: first one if none or a not existing one specified */
int i_audio = config_GetInt( p_input, "audio-channel" );
if( i_audio < 0 /*|| i_audio > i_audio_nb*/ )
if( config_GetInt( p_input, "audio-type" ) == REQUESTED_A52 )
{
config_PutInt( p_input, "audio-channel", 1 );
i_audio = 1;
}
if( i_audio > 0/* && i_audio_nb > 0*/ )
{
if( config_GetInt( p_input, "audio-type" )
== REQUESTED_A52 )
int i_a52 = i_audio;
while( ( p_input->stream.pp_es[i_a52]->i_fourcc !=
VLC_FOURCC('a','5','2','b') ) && ( i_a52 <=
p_dvd->p_vts_file->vtsi_mat->nr_of_vts_audio_streams ) )
{
int i_a52 = i_audio;
while( ( p_input->stream.pp_es[i_a52]->i_fourcc !=
VLC_FOURCC('a','5','2','b') ) && ( i_a52 <=
p_dvd->p_vts_file->vtsi_mat->nr_of_vts_audio_streams ) )
{
i_a52++;
}
if( p_input->stream.pp_es[i_a52]->i_fourcc
== VLC_FOURCC('a','5','2','b') )
{
input_SelectES( p_input,
p_input->stream.pp_es[i_a52] );
}
i_a52++;
}
else
if( p_input->stream.pp_es[i_a52]->i_fourcc
== VLC_FOURCC('a','5','2','b') )
{
input_SelectES( p_input,
p_input->stream.pp_es[i_audio] );
input_SelectES( p_input, p_input->stream.pp_es[i_a52] );
}
}
else
{
input_SelectES( p_input, p_input->stream.pp_es[i_audio] );
}
}
if( config_GetInt( p_input, "video" ) )
/* for spu, default is none */
i_spu = config_GetInt( p_input, "spu-channel" );
if( i_spu < 0 /*|| i_spu > i_spu_nb*/ )
{
/* for spu, default is none */
int i_spu = config_GetInt( p_input, "spu-channel" );
if( i_spu < 0 /*|| i_spu > i_spu_nb*/ )
{
config_PutInt( p_input, "spu-channel", 0 );
i_spu = 0;
}
if( i_spu > 0 /*&& i_spu_nb > 0*/ )
{
i_spu += p_dvd->p_vts_file->vtsi_mat->nr_of_vts_audio_streams;
input_SelectES( p_input, p_input->stream.pp_es[i_spu] );
}
config_PutInt( p_input, "spu-channel", 0 );
i_spu = 0;
}
if( i_spu > 0 /*&& i_spu_nb > 0*/ )
{
i_spu += p_dvd->p_vts_file->vtsi_mat->nr_of_vts_audio_streams;
input_SelectES( p_input, p_input->stream.pp_es[i_spu] );
}
}
......@@ -400,15 +400,14 @@ int SatelliteSetProgram( input_thread_t * p_input,
{
case MPEG1_VIDEO_ES:
case MPEG2_VIDEO_ES:
if ( config_GetInt( p_input, "video" ) )
if ( input_SelectES( p_input , p_es ) == 0 )
{
ioctl_SetDMXFilter( p_es->i_id, &p_es->i_demux_fd, 1);
input_SelectES( p_input , p_es );
}
break;
case MPEG1_AUDIO_ES:
case MPEG2_AUDIO_ES:
if ( config_GetInt( p_input, "audio" ) )
if ( input_SelectES( p_input , p_es ) == 0 )
{
ioctl_SetDMXFilter( p_es->i_id, &p_es->i_demux_fd, 2);
input_SelectES( p_input , p_es );
......
......@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999-2002 VideoLAN
* $Id: input_programs.c,v 1.95 2002/10/29 13:22:48 sam Exp $
* $Id: input_programs.c,v 1.96 2002/11/05 18:25:43 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -563,6 +563,21 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
return -1;
}
if( ((p_es->i_cat == VIDEO_ES) || (p_es->i_cat == SPU_ES))
&& !config_GetInt( p_input, "video" ) )
{
msg_Dbg( p_input,
"video is disabled, not selecting ES 0x%x", p_es->i_id );
return -1;
}
if( (p_es->i_cat == AUDIO_ES) && !config_GetInt( p_input, "audio" ) )
{
msg_Dbg( p_input,
"audio is disabled, not selecting ES 0x%x", p_es->i_id );
return -1;
}
msg_Dbg( p_input, "selecting ES 0x%x", p_es->i_id );
if( p_es->p_decoder_fifo != NULL )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment