* input_ts.c: TS demux and netlist management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input_ts.c,v 1.4 2001/02/20 02:53:13 stef Exp $
+ * $Id: input_ts.c,v 1.9 2001/03/07 01:36:41 sam Exp $
*
* Authors:
*
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
+#define MODULE_NAME ts
+#include "modules_inner.h"
+
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <sys/uio.h>
#include <sys/types.h>
+#include <sys/uio.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
-void input_getfunctions( function_list_t * p_function_list )
+void _M( input_getfunctions )( function_list_t * p_function_list )
{
#define input p_function_list->functions.input
p_function_list->pf_probe = TSProbe;
input.pf_init = TSInit;
+#ifdef SYS_BEOS
input.pf_open = input_FileOpen;
input.pf_close = input_FileClose;
+#else
+ input.pf_open = input_NetworkOpen;
+ input.pf_close = input_NetworkClose;
+#endif
input.pf_end = TSEnd;
input.pf_set_area = NULL;
input.pf_read = TSRead;
{
/* Initialize netlist and TS structures */
thread_ts_data_t * p_method;
- pgrm_ts_data_t * p_pgrm_demux;
- es_descriptor_t * kludge1;
+ es_descriptor_t * p_pat_es;
+ es_ts_data_t * p_demux_data;
+ stream_ts_data_t * p_stream_data;
/* Initialise structure */
p_method = malloc( sizeof( thread_ts_data_t ) );
/* Initialize the stream */
input_InitStream( p_input, sizeof( stream_ts_data_t ) );
- /* FIXME : PSIDemux and PSIDecode */
- /* Add audio and video programs */
- /* p_input->stream.pp_programs[0] = */
- input_AddProgram( p_input, 0, sizeof( pgrm_ts_data_t ) );
- p_pgrm_demux =
- (pgrm_ts_data_t *)p_input->stream.pp_programs[0]->p_demux_data;
- p_pgrm_demux->i_pcr_pid = 0x78;
-
- kludge1 = input_AddES( p_input, p_input->stream.pp_programs[0],
- 0x78, sizeof( es_ts_data_t ) );
-
- // kludge
- kludge1->i_type = MPEG2_VIDEO_ES;
-
- input_SelectES( p_input, kludge1 );
-
- vlc_mutex_lock( &(p_input->stream.stream_lock) );
- p_input->stream.pp_programs[0]->b_is_ok = 1;
- vlc_mutex_unlock( &(p_input->stream.stream_lock) );
-
-//debug
-intf_ErrMsg("End of TSINIT");
+ /* Init */
+ p_stream_data = (stream_ts_data_t *)p_input->stream.p_demux_data;
+ p_stream_data->i_pat_version = PAT_UNINITIALIZED ;
+
+ /* We'll have to catch the PAT in order to continue
+ * Then the input will catch the PMT and then the others ES
+ * The PAT es is indepedent of any program. */
+ p_pat_es = input_AddES( p_input, NULL,
+ 0x00, sizeof( es_ts_data_t ) );
+ p_demux_data=(es_ts_data_t *)p_pat_es->p_demux_data;
+ p_demux_data->b_psi = 1;
+ p_demux_data->i_psi_type = PSI_IS_PAT;
+ p_demux_data->p_psi_section = malloc(sizeof(psi_section_t));
+ p_demux_data->p_psi_section->b_is_complete = 1;
+
}
/*****************************************************************************
*****************************************************************************/
static void TSEnd( input_thread_t * p_input )
{
+ es_descriptor_t * p_pat_es;
+
+ p_pat_es = input_FindES( p_input, 0x00 );
+ if( p_pat_es != NULL )
+ input_DelES( p_input, p_pat_es );
+ free(p_input->p_plugin_data);
}
/*****************************************************************************
}
i_read = readv( p_input->i_handle, p_iovec, INPUT_READ_ONCE );
-
if( i_read == -1 )
{
intf_ErrMsg( "Could not readv" );