Commit cb8ef93c authored by Johan Bilien's avatar Johan Bilien

* made file access plugin use input_SetProgram so that we may change
  program when reading a file
* fixed a bug in input_SetProgram
* added --input_program <int> option, to choose the program from
  the command line
parent 0393b253
......@@ -2,7 +2,7 @@
* file.c: file input (file: access plug-in)
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: file.c,v 1.2 2002/03/15 04:41:54 sam Exp $
* $Id: file.c,v 1.3 2002/04/08 14:53:05 jobi Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -81,7 +81,7 @@ static void input_getfunctions( function_list_t * p_function_list )
input.pf_open = FileOpen;
input.pf_read = input_FDRead;
input.pf_close = input_FDClose;
input.pf_set_program = FileSetProgram;
input.pf_set_program = input_SetProgram;
input.pf_set_area = NULL;
input.pf_seek = input_FDSeek;
#undef input
......
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input.c,v 1.192 2002/04/04 22:51:01 massiot Exp $
* $Id: input.c,v 1.193 2002/04/08 14:53:05 jobi Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -301,6 +301,9 @@ static int RunThread( input_thread_t *p_input )
if( p_input->pf_set_program != NULL )
{
/* Reinitialize buffer manager. */
input_AccessReinit( p_input );
p_input->pf_set_program( p_input,
p_input->stream.p_new_program );
......
......@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_programs.c,v 1.77 2002/03/28 03:53:15 jobi Exp $
* $Id: input_programs.c,v 1.78 2002/04/08 14:53:05 jobi Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -293,63 +293,65 @@ input_area_t * input_AddArea( input_thread_t * p_input )
int input_SetProgram( input_thread_t * p_input, pgrm_descriptor_t * p_new_prg )
{
int i_es_index;
int i_required_audio_es;
int i_required_spu_es;
int i_audio_es = 0;
int i_spu_es = 0;
if ( p_input->stream.p_selected_program )
{
for ( i_es_index = 0 ;
i_es_index < p_input->stream.i_selected_es_number;
for ( i_es_index = 1 ; /* 0 should be the PMT */
i_es_index < p_input->stream.p_selected_program->
i_es_number ;
i_es_index ++ )
{
intf_WarnMsg( 4, "Unselecting ES %d",
p_input->stream.pp_selected_es[i_es_index]->i_id );
input_UnselectES( p_input ,
p_input->stream.pp_selected_es[i_es_index] );
}
}
for (i_es_index = 0 ; i_es_index < p_new_prg->i_es_number ; i_es_index ++ )
{
int i_required_audio_es;
int i_required_spu_es;
int i_audio_es = 0;
int i_spu_es = 0;
/* Get the number of the required audio stream */
if( p_main->b_audio )
{
/* Default is the first one */
i_required_audio_es = config_GetIntVariable( "input_channel" );
if( i_required_audio_es < 0 )
#define p_es p_input->stream.p_selected_program->pp_es[i_es_index]
if ( p_es->p_decoder_fifo )
{
i_required_audio_es = 1;
input_UnselectES( p_input , p_es );
}
#undef p_es
}
else
}
/* Get the number of the required audio stream */
if( p_main->b_audio )
{
/* Default is the first one */
i_required_audio_es = config_GetIntVariable( "input_channel" );
if( i_required_audio_es < 0 )
{
i_required_audio_es = 0;
i_required_audio_es = 1;
}
}
else
{
i_required_audio_es = 0;
}
/* Same thing for subtitles */
if( p_main->b_video )
{
/* for spu, default is none */
i_required_spu_es = config_GetIntVariable( "input_subtitle" );
if( i_required_spu_es < 0 )
{
i_required_spu_es = 0;
}
}
else
/* Same thing for subtitles */
if( p_main->b_video )
{
/* for spu, default is none */
i_required_spu_es = config_GetIntVariable( "input_subtitle" );
if( i_required_spu_es < 0 )
{
i_required_spu_es = 0;
}
}
else
{
i_required_spu_es = 0;
}
for (i_es_index = 0 ; i_es_index < p_new_prg->i_es_number ; i_es_index ++ )
{
switch( p_new_prg->pp_es[i_es_index]->i_cat )
{
case MPEG1_VIDEO_ES:
case MPEG2_VIDEO_ES:
intf_WarnMsg( 4, "Selecting ES %x",
case MPEG1_VIDEO_ES:
case MPEG2_VIDEO_ES:
intf_WarnMsg( 4, "Selecting ES %x",
p_new_prg->pp_es[i_es_index]->i_id );
input_SelectES( p_input,
input_SelectES( p_input,
p_new_prg->pp_es[i_es_index] );
break;
case MPEG1_AUDIO_ES:
......@@ -357,9 +359,9 @@ int input_SetProgram( input_thread_t * p_input, pgrm_descriptor_t * p_new_prg )
i_audio_es += 1;
if( i_audio_es == i_required_audio_es )
{
intf_WarnMsg( 4, "Selecting ES %x",
p_new_prg->pp_es[i_es_index]->i_id );
input_SelectES( p_input,
intf_WarnMsg( 4, "Selecting ES %x",
p_new_prg->pp_es[i_es_index]->i_id );
input_SelectES( p_input,
p_new_prg->pp_es[i_es_index]);
}
break;
......@@ -368,9 +370,9 @@ int input_SetProgram( input_thread_t * p_input, pgrm_descriptor_t * p_new_prg )
i_audio_es += 1;
if( i_audio_es == i_required_audio_es )
{
intf_WarnMsg( 4, "Selecting ES %x",
intf_WarnMsg( 4, "Selecting ES %x",
p_new_prg->pp_es[i_es_index]->i_id );
input_SelectES( p_input,
input_SelectES( p_input,
p_new_prg->pp_es[i_es_index] );
}
break;
......@@ -379,9 +381,9 @@ int input_SetProgram( input_thread_t * p_input, pgrm_descriptor_t * p_new_prg )
i_spu_es += 1;
if( i_spu_es == i_required_spu_es )
{
intf_WarnMsg( 4, "Selecting ES %x",
intf_WarnMsg( 4, "Selecting ES %x",
p_new_prg->pp_es[i_es_index]->i_id );
input_SelectES( p_input,
input_SelectES( p_input,
p_new_prg->pp_es[i_es_index] );
}
break;
......@@ -390,7 +392,7 @@ int input_SetProgram( input_thread_t * p_input, pgrm_descriptor_t * p_new_prg )
}
}
p_input->stream.p_selected_program = p_new_prg;
......@@ -692,7 +694,7 @@ int input_UnselectES( input_thread_t * p_input, es_descriptor_t * p_es )
}
input_EndDecoder( p_input, p_es );
free( p_es->p_pes );
p_es->p_pes = NULL;
if( ( p_es->p_decoder_fifo == NULL ) &&
( p_input->stream.i_selected_es_number > 0 ) )
......
......@@ -2,7 +2,7 @@
* mpeg_system.c: TS, PS and PES management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: mpeg_system.c,v 1.88 2002/04/04 22:51:01 massiot Exp $
* $Id: mpeg_system.c,v 1.89 2002/04/08 14:53:05 jobi Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -1586,12 +1586,19 @@ static void input_DecodePAT( input_thread_t * p_input, es_descriptor_t * p_es )
p_stream_data->i_pat_version = p_psi->i_version_number;
}
#undef p_psi
#undef p_psi
/* FIXME This has nothing to do here */
if( !p_input->stream.p_selected_program )
{
input_SetProgram( p_input, p_input->stream.pp_programs[0] );
pgrm_descriptor_t * p_pgrm_to_select;
u16 i_id = config_GetIntVariable( "input_program" );
p_pgrm_to_select = input_FindProgram( p_input, i_id );
if ( p_pgrm_to_select )
input_SetProgram( p_input, p_pgrm_to_select );
else /* take the first one */
input_SetProgram( p_input, p_input->stream.pp_programs[0] );
}
}
......
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: main.c,v 1.176 2002/04/07 23:08:44 massiot Exp $
* $Id: main.c,v 1.177 2002/04/08 14:53:05 jobi Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -210,6 +210,10 @@
#define IFACE_TEXT "network interface"
#define IFACE_LONGTEXT NULL
#define INPUT_PROGRAM_TEXT "choose program (SID)"
#define INPUT_PROGRAM_LONGTEXT "choose the program to select by giving its"\
"Service ID"
#define INPUT_AUDIO_TEXT "choose audio"
#define INPUT_AUDIO_LONGTEXT NULL
......@@ -337,6 +341,8 @@ ADD_STRING ( "channel_server", "localhost", NULL, CHAN_SERV_TEXT, CHAN_SERV_LON
ADD_INTEGER ( "channel_port", 6010, NULL, CHAN_PORT_TEXT, CHAN_PORT_LONGTEXT )
ADD_STRING ( "iface", "eth0", NULL, IFACE_TEXT, IFACE_LONGTEXT )
ADD_INTEGER ( "input_program", 0, NULL, INPUT_PROGRAM_TEXT,
INPUT_PROGRAM_LONGTEXT )
ADD_INTEGER ( "input_audio", -1, NULL, INPUT_AUDIO_TEXT, INPUT_AUDIO_LONGTEXT )
ADD_INTEGER ( "input_channel", -1, NULL, INPUT_CHAN_TEXT, INPUT_CHAN_LONGTEXT )
ADD_INTEGER ( "input_subtitle", -1, NULL, INPUT_SUBT_TEXT, INPUT_SUBT_LONGTEXT )
......
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