* input_ts.c: TS demux and netlist management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input_ts.c,v 1.2 2001/02/14 15:58:29 henri Exp $
+ * $Id: input_ts.c,v 1.5 2001/02/20 07:49:13 sam Exp $
*
* Authors:
*
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
+#define MODULE_NAME ts
+#include "modules_inner.h"
+
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <sys/uio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
#include "config.h"
#include "common.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_open = input_FileOpen;
input.pf_close = input_FileClose;
input.pf_end = TSEnd;
+ input.pf_set_area = NULL;
input.pf_read = TSRead;
input.pf_demux = input_DemuxTS;
input.pf_new_packet = input_NetlistNewPacket;
*****************************************************************************/
static int TSProbe( probedata_t * p_data )
{
+ input_thread_t * p_input = (input_thread_t *)p_data;
+
+ char * psz_name = p_input->p_source;
+ int i_handle;
+ int i_score = 1;
+
if( TestMethod( INPUT_METHOD_VAR, "ts" ) )
{
return( 999 );
}
- /* verify that the first byte is 0x47 */
- return 0;
+ if( ( strlen(psz_name) > 5 ) && !strncasecmp( psz_name, "file:", 5 ) )
+ {
+ /* If the user specified "file:" then it's probably a file */
+ psz_name += 5;
+ }
+
+ i_handle = open( psz_name, 0 );
+ if( i_handle == -1 )
+ {
+ return( 0 );
+ }
+ close( i_handle );
+
+ return( i_score );
}
/*****************************************************************************