Commit 7917d2ef authored by Johan Bilien's avatar Johan Bilien

* added functions in inputs to change the current program (most of

  them do nothing)

All inputs should now have a pf_setprogram function. A default one is
provided in input_programs.c.
parent 6982da21
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.50 2001/12/05 03:31:04 jobi Exp $
* $Id: input_ext-intf.h,v 1.51 2001/12/07 16:47:47 jobi Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -275,6 +275,8 @@ typedef struct input_thread_s
void (* pf_delete_pes)( void *, struct pes_packet_s * );
/* Stream control capabilities */
int (* pf_set_program)( struct input_thread_s *,
struct pgrm_descriptor_s * );
int (* pf_set_area)( struct input_thread_s *,
struct input_area_s * );
int (* pf_rewind)( struct input_thread_s * );
......
......@@ -3,7 +3,7 @@
* but exported to plug-ins
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: input_ext-plugins.h,v 1.6 2001/11/25 22:52:21 gbazin Exp $
* $Id: input_ext-plugins.h,v 1.7 2001/12/07 16:47:47 jobi Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -58,6 +58,7 @@ struct pgrm_descriptor_s * input_FindProgram( struct input_thread_s *, u16 );
struct pgrm_descriptor_s * input_AddProgram ( struct input_thread_s *,
u16, size_t );
void input_DelProgram( struct input_thread_s *, struct pgrm_descriptor_s * );
int input_SetProgram( struct input_thread_s *, struct pgrm_descriptor_s * );
struct input_area_s * input_AddArea( struct input_thread_s * );
void input_DelArea ( struct input_thread_s *, struct input_area_s * );
struct es_descriptor_s * input_FindES( struct input_thread_s *, u16 );
......
......@@ -2,7 +2,7 @@
* modules.h : Module management functions.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.h,v 1.33 2001/12/03 16:18:37 sam Exp $
* $Id: modules.h,v 1.34 2001/12/07 16:47:47 jobi Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -128,6 +128,8 @@ typedef struct function_list_s
void ( * pf_delete_packet ) ( void *, struct data_packet_s * );
void ( * pf_delete_pes ) ( void *, struct pes_packet_s * );
int ( * pf_set_program ) ( struct input_thread_s *,
struct pgrm_descriptor_s * );
int ( * pf_set_area ) ( struct input_thread_s *,
struct input_area_s * );
......
......@@ -10,7 +10,7 @@
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.103 2001/12/05 03:31:04 jobi Exp $
* $Id: input_dvd.c,v 1.104 2001/12/07 16:47:47 jobi Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -111,6 +111,7 @@ static void DVDEnd ( struct input_thread_s * );
static void DVDOpen ( struct input_thread_s * );
static void DVDClose ( struct input_thread_s * );
static int DVDSetArea ( struct input_thread_s *, struct input_area_s * );
static int DVDSetProgram ( struct input_thread_s *, pgrm_descriptor_t * );
static int DVDRead ( struct input_thread_s *, data_packet_t ** );
static void DVDSeek ( struct input_thread_s *, off_t );
static int DVDRewind ( struct input_thread_s * );
......@@ -136,6 +137,7 @@ void _M( input_getfunctions )( function_list_t * p_function_list )
input.pf_init_bit_stream = InitBitstream;
input.pf_read = DVDRead;
input.pf_set_area = DVDSetArea;
input.pf_set_program = DVDSetProgram;
input.pf_demux = input_DemuxPS;
input.pf_new_packet = input_NetlistNewPacket;
input.pf_new_pes = input_NetlistNewPES;
......@@ -389,6 +391,15 @@ static void DVDEnd( input_thread_t * p_input )
input_NetlistEnd( p_input );
}
/*****************************************************************************
* DVDSetProgram: Does nothing, a DVD is mono-program
*****************************************************************************/
static int DVDSetProgram( input_thread_t * p_input,
pgrm_descriptor_t * p_program )
{
return 0;
}
/*****************************************************************************
* DVDSetArea: initialize input data for title x, chapter y.
* It should be called for each user navigation request.
......
......@@ -2,7 +2,7 @@
* input_es.c: Elementary Stream demux and packet management
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input_es.c,v 1.14 2001/11/28 15:08:05 massiot Exp $
* $Id: input_es.c,v 1.15 2001/12/07 16:47:47 jobi Exp $
*
* Author: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -82,7 +82,9 @@ static int ESRead ( struct input_thread_s *,
static void ESInit ( struct input_thread_s * );
static void ESEnd ( struct input_thread_s * );
static void ESSeek ( struct input_thread_s *, off_t );
static void ESDemux ( struct input_thread_s *, struct data_packet_s * );
static int ESSetProgram ( struct input_thread_s *, pgrm_descriptor_t * );
static void ESDemux ( struct input_thread_s *,
struct data_packet_s * );
static void ESNextDataPacket( struct bit_stream_s * );
static void ESInitBitstream( struct bit_stream_s *, struct decoder_fifo_s *,
void (* pf_bitstream_callback)( struct bit_stream_s *,
......@@ -104,6 +106,7 @@ void _M( input_getfunctions )( function_list_t * p_function_list )
input.pf_end = ESEnd;
input.pf_init_bit_stream = ESInitBitstream;
input.pf_set_area = NULL;
input.pf_set_program = ESSetProgram;
input.pf_read = ESRead;
input.pf_demux = ESDemux;
input.pf_new_packet = input_NetlistNewPacket;
......@@ -219,6 +222,15 @@ static void ESSeek( input_thread_t * p_input, off_t i_position )
p_input->stream.p_selected_area->i_tell = i_position;
}
/*****************************************************************************
* ESSetProgram: Does nothing
*****************************************************************************/
static int ESSetProgram( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm )
{
return( 0 );
}
/*****************************************************************************
* ESDemux: fakes a demultiplexer
*****************************************************************************/
......
......@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_ps.c,v 1.42 2001/12/05 03:31:04 jobi Exp $
* $Id: input_ps.c,v 1.43 2001/12/07 16:47:47 jobi Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
......@@ -92,10 +92,11 @@ static int PSRead ( struct input_thread_s *,
data_packet_t * p_packets[INPUT_READ_ONCE] );
static void PSInit ( struct input_thread_s * );
static void PSEnd ( struct input_thread_s * );
static int PSSetProgram ( struct input_thread_s * , pgrm_descriptor_t * );
static void PSSeek ( struct input_thread_s *, off_t );
static struct pes_packet_s * NewPES ( void * );
static struct data_packet_s * NewPacket ( void *, size_t );
static void DeletePacket( void *, struct data_packet_s * );
static void DeletePacket ( void *, struct data_packet_s * );
static void DeletePES ( void *, struct pes_packet_s * );
/*****************************************************************************
......@@ -112,6 +113,7 @@ void _M( input_getfunctions )( function_list_t * p_function_list )
input.pf_end = PSEnd;
input.pf_init_bit_stream = InitBitstream;
input.pf_set_area = NULL;
input.pf_set_program = PSSetProgram;
input.pf_read = PSRead;
input.pf_demux = input_DemuxPS;
input.pf_new_packet = NewPacket;
......@@ -576,6 +578,14 @@ static int PSRead( input_thread_t * p_input,
return( 0 );
}
/*****************************************************************************
* PSSetProgram: Does nothing since a PS Stream is mono-program
*****************************************************************************/
static int PSSetProgram( input_thread_t * p_input,
pgrm_descriptor_t * p_program)
{
return( 0 );
}
/*****************************************************************************
* PSSeek: changes the stream position indicator
*****************************************************************************/
......
......@@ -2,7 +2,7 @@
* input_ts.c: TS demux and netlist management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_ts.c,v 1.40 2001/12/03 17:34:08 stef Exp $
* $Id: input_ts.c,v 1.41 2001/12/07 16:47:47 jobi Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
......@@ -106,6 +106,7 @@ void _M( input_getfunctions )( function_list_t * p_function_list )
input.pf_end = TSEnd;
input.pf_init_bit_stream = InitBitstream;
input.pf_set_area = NULL;
input.pf_set_area = input_SetProgram;
input.pf_read = TSRead;
input.pf_demux = input_DemuxTS;
input.pf_new_packet = input_NetlistNewPacket;
......
......@@ -93,6 +93,7 @@ static int VCDProbe ( probedata_t *p_data );
static void VCDInit ( struct input_thread_s * );
static int VCDRead ( struct input_thread_s *, data_packet_t ** );
static int VCDSetArea ( struct input_thread_s *, struct input_area_s * );
static int VCDSetProgram ( struct input_thread_s *, pgrm_descriptor_t * );
static void VCDOpen ( struct input_thread_s *);
static void VCDClose ( struct input_thread_s *);
static void VCDEnd ( struct input_thread_s *);
......@@ -112,21 +113,22 @@ static void DeletePES ( void *, pes_packet_t *);
void _M( input_getfunctions )( function_list_t * p_function_list )
{
#define input p_function_list->functions.input
p_function_list->pf_probe = VCDProbe ;
input.pf_init = VCDInit ;
input.pf_open = VCDOpen ;
input.pf_close = VCDClose ;
input.pf_end = VCDEnd ;
p_function_list->pf_probe = VCDProbe;
input.pf_init = VCDInit;
input.pf_open = VCDOpen;
input.pf_close = VCDClose;
input.pf_end = VCDEnd;
input.pf_init_bit_stream = InitBitstream;
input.pf_read = VCDRead ;
input.pf_set_area = VCDSetArea ;
input.pf_read = VCDRead;
input.pf_set_area = VCDSetArea;
input.pf_set_program = VCDSetProgram;
input.pf_demux = input_DemuxPS;
input.pf_new_packet = NewPacket;
input.pf_new_pes = NewPES;
input.pf_delete_packet = DeletePacket;
input.pf_delete_pes = DeletePES;
input.pf_rewind = VCDRewind ;
input.pf_seek = VCDSeek ;
input.pf_rewind = VCDRewind;
input.pf_seek = VCDSeek;
#undef input
}
......@@ -409,6 +411,16 @@ static void VCDEnd( input_thread_t * p_input )
}
/*****************************************************************************
* VCDSetProgram: Does nothing since a VCD is mono_program
*****************************************************************************/
static int VCDSetProgram( input_thread_t * p_input,
pgrm_descriptor_t * p_program)
{
return 0;
}
/*****************************************************************************
* VCDSetArea: initialize input data for title x, chapter y.
* It should be called for each user navigation request.
......
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input.c,v 1.161 2001/11/28 15:08:06 massiot Exp $
* $Id: input.c,v 1.162 2001/12/07 16:47:47 jobi Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -265,6 +265,29 @@ static void RunThread( input_thread_t *p_input )
vlc_mutex_lock( &p_input->stream.stream_lock );
if( p_input->stream.p_new_program )
{
if( p_input->pf_set_program != NULL )
{
p_input->pf_set_program( p_input,
p_input->stream.p_new_program );
for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
{
pgrm_descriptor_t * p_pgrm
= p_input->stream.pp_programs[i];
/* Escape all decoders for the stream discontinuity they
* will encounter. */
input_EscapeDiscontinuity( p_input, p_pgrm );
/* Reinitialize synchro. */
p_pgrm->i_synchro_state = SYNCHRO_REINIT;
}
}
p_input->stream.p_new_program = NULL;
}
if( p_input->stream.p_new_area )
{
if( p_input->stream.b_seekable && p_input->pf_set_area != NULL )
......@@ -410,6 +433,7 @@ static int InitThread( input_thread_t * p_input )
p_input->pf_init_bit_stream= f.pf_init_bit_stream;
p_input->pf_read = f.pf_read;
p_input->pf_set_area = f.pf_set_area;
p_input->pf_set_program = f.pf_set_program;
p_input->pf_demux = f.pf_demux;
p_input->pf_new_packet = f.pf_new_packet;
p_input->pf_new_pes = f.pf_new_pes;
......
......@@ -2,7 +2,7 @@
* input_ext-intf.c: services to the interface
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_ext-intf.c,v 1.29 2001/11/28 15:08:06 massiot Exp $
* $Id: input_ext-intf.c,v 1.30 2001/12/07 16:47:47 jobi Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -333,6 +333,21 @@ int input_ChangeArea( input_thread_t * p_input, input_area_t * p_area )
return 0;
}
/****************************************************************************
* input_ChangeProgram: interface request an area change
****************************************************************************/
int input_ChangeProgram( input_thread_t * p_input,
pgrm_descriptor_t * p_program )
{
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.p_new_program = p_program;
vlc_mutex_unlock( &p_input->stream.stream_lock );
return 0;
}
/****************************************************************************
* input_ToggleGrayscale: change to grayscale or color output
****************************************************************************/
......
......@@ -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.67 2001/12/05 03:31:04 jobi Exp $
* $Id: input_programs.c,v 1.68 2001/12/07 16:47:47 jobi Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -302,6 +302,29 @@ input_area_t * input_AddArea( input_thread_t * p_input )
return p_input->stream.pp_areas[i_area_index];
}
/*****************************************************************************
* input_SetProgram: changes the current program
*****************************************************************************/
int input_SetProgram( input_thread_t * p_input, pgrm_descriptor_t * p_new_prg )
{
int i_es_index;
#define old_prg p_input->stream.p_selected_program
for ( i_es_index = 0 ; i_es_index < old_prg->i_es_number ; i_es_index ++ )
{
input_UnselectES( p_input , old_prg->pp_es[i_es_index] );
}
#undef old_prg
for (i_es_index = 0 ; i_es_index < p_new_prg->i_es_number ; i_es_index ++ )
{
input_SelectES( p_input , p_new_prg->pp_es[i_es_index] );
}
p_input->stream.p_selected_program = p_new_prg;
return( 0 );
}
/*****************************************************************************
* input_DelArea: destroy a area descriptor
*****************************************************************************
......
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