* 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>
*
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 * );
* 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>
*
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 );
* 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>
*
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 * );
* -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: Stéphane Borel <stef@via.ecp.fr>
*
* Local prototypes
*****************************************************************************/
/* called from outside */
-static int DVDProbe ( probedata_t *p_data );
-static void DVDInit ( struct input_thread_s * );
-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 DVDRead ( struct input_thread_s *, data_packet_t ** );
-static void DVDSeek ( struct input_thread_s *, off_t );
-static int DVDRewind ( struct input_thread_s * );
+static int DVDProbe ( probedata_t *p_data );
+static void DVDInit ( struct input_thread_s * );
+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 * );
/* called only inside */
static int DVDChooseAngle( thread_dvd_data_t * );
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;
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.
* decrypted disc key are fast enough to check the key at each seek */
if( dvdcss_seek( p_dvd->dvdhandle, p_dvd->i_start,
- DVDCSS_SEEK_KEY ) < 0 )
+ DVDCSS_SEEK_KEY ) < 0 )
{
intf_ErrMsg( "dvd error: %s", dvdcss_error( p_dvd->dvdhandle ) );
return -1;
* 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>
*
static int ESProbe ( probedata_t * );
static int ESRead ( struct input_thread_s *,
data_packet_t * p_packets[INPUT_READ_ONCE] );
-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 void ESInit ( struct input_thread_s * );
+static void ESEnd ( struct input_thread_s * );
+static void ESSeek ( struct input_thread_s *, off_t );
+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 *,
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;
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
*****************************************************************************/
* 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>
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int PSProbe ( probedata_t * );
-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 void PSSeek ( struct input_thread_s *, off_t );
+static int PSProbe ( probedata_t * );
+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 DeletePES ( void *, struct pes_packet_s * );
+static void DeletePacket ( void *, struct data_packet_s * );
+static void DeletePES ( void *, struct pes_packet_s * );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
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;
input_AddProgram( p_input, 0, sizeof( stream_ps_data_t ) );
p_input->stream.p_selected_program =
- p_input->stream.pp_programs[0] ;
+ p_input->stream.pp_programs[0] ;
p_input->stream.p_new_program =
- p_input->stream.pp_programs[0] ;
+ p_input->stream.pp_programs[0] ;
if( p_input->stream.b_seekable )
{
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
*****************************************************************************/
}
#endif
- vlc_mutex_lock( &p_cache->lock );
+ vlc_mutex_lock( &p_cache->lock );
/* Checks whether the PES cache is empty */
if( p_cache->pes.l_index == 0 )
if( p_pes == NULL )
{
intf_DbgMsg( "Out of memory" );
- vlc_mutex_unlock( &p_cache->lock );
+ vlc_mutex_unlock( &p_cache->lock );
return NULL;
}
#ifdef TRACE_INPUT
* 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>
*
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;
* Local prototypes
*****************************************************************************/
/* called from outside */
-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 void VCDOpen ( struct input_thread_s *);
-static void VCDClose ( struct input_thread_s *);
-static void VCDEnd ( struct input_thread_s *);
-static void VCDSeek ( struct input_thread_s *, off_t );
-static int VCDRewind ( struct input_thread_s * );
+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 *);
+static void VCDSeek ( struct input_thread_s *, off_t );
+static int VCDRewind ( struct input_thread_s * );
static struct data_packet_s * NewPacket( void *, size_t );
static pes_packet_t * NewPES ( void * );
-static void DeletePacket ( void *, data_packet_t * );
-static void DeletePES ( void *, pes_packet_t *);
+static void DeletePacket ( void *, data_packet_t * );
+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
}
}
+/*****************************************************************************
+ * 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.
* 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>
*
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 )
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;
psz_name += 8;
i_stat = stat( psz_name, &stat_info );
}
- else if( ( i_size > 4 )
+ else if( ( i_size > 4 )
&& !strncasecmp( psz_name, "dvd:", 4 ) )
{
/* get rid of the 'dvd:' stuff and try again */
* 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>
*
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
****************************************************************************/
* 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>
*
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
*****************************************************************************