* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-intf.h,v 1.43 2001/10/01 16:18:48 massiot Exp $
+ * $Id: input_ext-intf.h,v 1.44 2001/10/02 16:46:59 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* backwards (it's gonna be fun) */
void (* pf_seek)( struct input_thread_s *, off_t );
- /* Special callback functions */
- void (* pf_file_open ) ( struct input_thread_s * );
- void (* pf_file_close ) ( struct input_thread_s * );
-#if !defined( SYS_BEOS ) && !defined( SYS_NTO )
- void (* pf_network_open ) ( struct input_thread_s * );
- void (* pf_network_close ) ( struct input_thread_s * );
-#endif
-
char * p_source;
int i_handle; /* socket or file descriptor */
+ FILE * p_stream; /* if applicable */
int i_read_once; /* number of packet read by
* pf_read once */
void * p_method_data; /* data of the packet manager */
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: input_dvd.c,v 1.86 2001/09/30 01:26:44 stef Exp $
+ * $Id: input_dvd.c,v 1.87 2001/10/02 16:46:59 massiot Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
/* Initialize ES structures */
input_InitStream( p_input, sizeof( stream_ps_data_t ) );
- /* disc input method */
- p_input->stream.i_method = INPUT_METHOD_DVD;
-
#define title_inf p_dvd->p_ifo->vmg.title_inf
intf_WarnMsg( 2, "dvd info: number of titles: %d", title_inf.i_title_nb );
* input_es.c: Elementary Stream demux and packet management
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: input_es.c,v 1.9 2001/07/30 00:53:05 sam Exp $
+ * $Id: input_es.c,v 1.10 2001/10/02 16:46:59 massiot Exp $
*
* Author: Christophe Massiot <massiot@via.ecp.fr>
*
#define input p_function_list->functions.input
p_function_list->pf_probe = ESProbe;
input.pf_init = ESInit;
- input.pf_open = NULL; /* Set in ESInit */
+ input.pf_open = NULL;
input.pf_close = NULL;
input.pf_end = ESEnd;
input.pf_init_bit_stream = ESInitBitstream;
{
input_thread_t * p_input = (input_thread_t *)p_data;
- char * psz_name = p_input->p_source;
- int i_handle;
int i_score = 5;
if( TestMethod( INPUT_METHOD_VAR, "es" ) )
return( 999 );
}
- i_handle = open( psz_name, 0 );
- if( i_handle == -1 )
- {
- return( 0 );
- }
- close( i_handle );
-
return( i_score );
}
return;
}
- p_input->pf_open = p_input->pf_file_open;
- p_input->pf_close = p_input->pf_file_close;
-
/* FIXME : detect if InitStream failed */
input_InitStream( p_input, 0 );
input_AddProgram( p_input, 0, 0 );
p_es->i_type = MPEG1_VIDEO_ES;
p_es->i_cat = VIDEO_ES;
input_SelectES( p_input, p_es );
- p_input->stream.i_method = INPUT_METHOD_FILE;
p_input->stream.p_selected_area->i_tell = 0;
p_input->stream.pp_programs[0]->b_is_ok = 1;
vlc_mutex_unlock( &p_input->stream.stream_lock );
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input_ps.c,v 1.35 2001/10/01 16:18:48 massiot Exp $
+ * $Id: input_ps.c,v 1.36 2001/10/02 16:46:59 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
#define input p_function_list->functions.input
p_function_list->pf_probe = PSProbe;
input.pf_init = PSInit;
- input.pf_open = NULL; /* Set in PSInit */
+ input.pf_open = NULL;
input.pf_close = NULL;
input.pf_end = PSEnd;
input.pf_init_bit_stream = InitBitstream;
input_thread_t * p_input = (input_thread_t *)p_data;
char * psz_name = p_input->p_source;
- int i_handle;
int i_score = 10;
if( TestMethod( INPUT_METHOD_VAR, "ps" ) )
return( 999 );
}
- if( ( strlen(psz_name) > 5 ) && !strncasecmp( psz_name, "file:", 5 ) )
+ if( ( strlen(psz_name) > 5 ) && (!strncasecmp( psz_name, "file:", 5 )
+ || !strncasecmp( psz_name, "http:", 5 )) )
{
- /* If the user specified "file:" then it's probably a file */
+ /* If the user specified "file:" or "http:" then it's probably a
+ * PS file */
i_score = 100;
psz_name += 5;
}
- i_handle = open( psz_name, 0 );
- if( i_handle == -1 )
- {
- return( 0 );
- }
- close( i_handle );
-
return( i_score );
}
*****************************************************************************/
static void PSInit( input_thread_t * p_input )
{
- thread_ps_data_t * p_method;
packet_cache_t * p_packet_cache;
- p_method = (thread_ps_data_t *)malloc( sizeof(thread_ps_data_t) );
- if( p_method == NULL )
- {
- intf_ErrMsg( "Out of memory" );
- p_input->b_error = 1;
- return;
- }
- p_input->p_plugin_data = (void *)p_method;
-
/* creates the packet cache structure */
p_packet_cache = malloc( sizeof(packet_cache_t) );
if ( p_packet_cache == NULL )
}
p_input->p_method_data = (void *)p_packet_cache;
- /* Set callback */
- p_input->pf_open = p_input->pf_file_open;
- p_input->pf_close = p_input->pf_file_close;
-
/* Initialize packet cache mutex */
vlc_mutex_init( &p_packet_cache->lock );
}
p_packet_cache->largebuffer.l_index = 0;
- /* Re-open the socket as a buffered FILE stream */
- p_method->stream = fdopen( p_input->i_handle, "r" );
-
- if( p_method->stream == NULL )
+ if( p_input->p_stream == NULL )
{
- intf_ErrMsg( "Cannot open file (%s)", strerror(errno) );
- p_input->b_error = 1;
- return;
+ /* Re-open the socket as a buffered FILE stream */
+ p_input->p_stream = fdopen( p_input->i_handle, "r" );
+
+ if( p_input->p_stream == NULL )
+ {
+ intf_ErrMsg( "Cannot open file (%s)", strerror(errno) );
+ p_input->b_error = 1;
+ return;
+ }
}
- rewind( p_method->stream );
/* FIXME : detect if InitStream failed */
input_InitStream( p_input, sizeof( stream_ps_data_t ) );
stream_ps_data_t * p_demux_data =
(stream_ps_data_t *)p_input->stream.pp_programs[0]->p_demux_data;
+ rewind( p_input->p_stream );
+
/* Pre-parse the stream to gather stream_descriptor_t. */
p_input->stream.pp_programs[0]->b_is_ok = 0;
p_demux_data->i_PSM_version = EMPTY_PSM_VERSION;
break;
}
}
- rewind( p_method->stream );
+ rewind( p_input->p_stream );
vlc_mutex_lock( &p_input->stream.stream_lock );
- p_input->stream.i_method = INPUT_METHOD_FILE;
p_input->stream.p_selected_area->i_tell = 0;
if( p_demux_data->b_has_PSM )
static __inline__ int SafeRead( input_thread_t * p_input, byte_t * p_buffer,
size_t i_len )
{
- thread_ps_data_t * p_method;
int i_error;
- p_method = (thread_ps_data_t *)p_input->p_plugin_data;
- while( fread( p_buffer, i_len, 1, p_method->stream ) != 1 )
+ while( fread( p_buffer, i_len, 1, p_input->p_stream ) != 1 )
{
- if( feof( p_method->stream ) )
+ if( feof( p_input->p_stream ) )
{
return( 1 );
}
- if( (i_error = ferror( p_method->stream )) )
+ if( (i_error = ferror( p_input->p_stream )) )
{
intf_ErrMsg( "Read failed (%s)", strerror(i_error) );
return( -1 );
data_packet_t * p_data;
size_t i_packet_size;
int i_packet, i_error;
- thread_ps_data_t * p_method;
-
- p_method = (thread_ps_data_t *)p_input->p_plugin_data;
memset( pp_packets, 0, INPUT_READ_ONCE * sizeof(data_packet_t *) );
for( i_packet = 0; i_packet < INPUT_READ_ONCE; i_packet++ )
while( (i_startcode & 0xFFFFFF00) != 0x100L )
{
i_startcode <<= 8;
- if( (i_dummy = getc( p_method->stream )) != EOF )
+ if( (i_dummy = getc( p_input->p_stream )) != EOF )
{
i_startcode |= i_dummy;
}
*****************************************************************************/
static void PSSeek( input_thread_t * p_input, off_t i_position )
{
- thread_ps_data_t * p_method;
-
- p_method = (thread_ps_data_t *)p_input->p_plugin_data;
-
/* A little bourrin but should work for a while --Meuuh */
#if defined( WIN32 ) || defined( SYS_GNU0_2 )
- fseek( p_method->stream, (long)i_position, SEEK_SET );
+ fseek( p_input->p_stream, (long)i_position, SEEK_SET );
#else
- fseeko( p_method->stream, i_position, SEEK_SET );
+ fseeko( p_input->p_stream, i_position, SEEK_SET );
#endif
p_input->stream.p_selected_area->i_tell = i_position;
* input_ps.h: thread structure of the PS plugin
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ps.h,v 1.8 2001/05/31 03:12:49 sam Exp $
+ * $Id: input_ps.h,v 1.9 2001/10/02 16:46:59 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
-/*****************************************************************************
- * thread_ps_data_t: extension of input_thread_t
- *****************************************************************************/
-typedef struct thread_ps_data_s
-{
- /* We're necessarily reading a file. */
- FILE * stream;
-} thread_ps_data_t;
-
-
#define DATA_CACHE_SIZE 150
#define PES_CACHE_SIZE 150
#define SMALL_CACHE_SIZE 150
* input_ts.c: TS demux and netlist management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input_ts.c,v 1.33 2001/09/06 18:21:02 henri Exp $
+ * $Id: input_ts.c,v 1.34 2001/10/02 16:46:59 massiot Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
*****************************************************************************/
static int TSProbe ( probedata_t * );
static void TSInit ( struct input_thread_s * );
-static void TSFakeOpen ( struct input_thread_s * );
static void TSEnd ( struct input_thread_s * );
static int TSRead ( struct input_thread_s *,
data_packet_t * p_packets[INPUT_READ_ONCE] );
#define input p_function_list->functions.input
p_function_list->pf_probe = TSProbe;
input.pf_init = TSInit;
- input.pf_open = TSFakeOpen;
- input.pf_close = NULL; /* Will be set by pf_open */
+ input.pf_open = NULL;
+ input.pf_close = NULL;
input.pf_end = TSEnd;
input.pf_init_bit_stream = InitBitstream;
input.pf_set_area = NULL;
input_thread_t * p_input = (input_thread_t *)p_data;
char * psz_name = p_input->p_source;
- int i_handle;
- int i_score = 1;
+ int i_score = 2;
if( TestMethod( INPUT_METHOD_VAR, "ts" ) )
{
return( 900 );
}
- i_handle = open( psz_name, 0 );
- if( i_handle == -1 )
- {
- return( 0 );
- }
- close( i_handle );
-
return( i_score );
}
/* Initialize the stream */
input_InitStream( p_input, sizeof( stream_ts_data_t ) );
- /* input method type */
- /* FIXME: should test if you have network or file here */
- p_input->stream.i_method = INPUT_METHOD_NETWORK;
p_input->stream.p_selected_area->i_tell = 0;
/* Init */
}
-/*****************************************************************************
- * TSFakeOpen: open the stream and set pf_close
- *****************************************************************************/
-void TSFakeOpen( input_thread_t * p_input )
-{
-#if !defined( SYS_BEOS ) && !defined( SYS_NTO )
- char *psz_name = p_input->p_source;
-
- if( ( strlen(psz_name) > 3 ) && !strncasecmp( psz_name, "ts:", 3 ) )
- {
- /* If the user specified "ts:" he wants a network stream */
- p_input->pf_open = p_input->pf_network_open;
- p_input->pf_close = p_input->pf_network_close;
- }
- else
-#endif
- {
- p_input->pf_open = p_input->pf_file_open;
- p_input->pf_close = p_input->pf_file_close;
- }
-
- p_input->pf_open( p_input );
-}
-
/*****************************************************************************
* TSEnd: frees unused data
*****************************************************************************/
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input.c,v 1.132 2001/10/01 16:18:48 massiot Exp $
+ * $Id: input.c,v 1.133 2001/10/02 16:46:59 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
static void FileClose ( input_thread_t *p_input );
#if !defined( SYS_BEOS ) && !defined( SYS_NTO )
static void NetworkOpen ( input_thread_t *p_input );
+static void HTTPOpen ( input_thread_t *p_input );
static void NetworkClose ( input_thread_t *p_input );
#endif
p_input->stream.control.i_smp = main_GetIntVariable(
VDEC_SMP_VAR, VDEC_SMP_DEFAULT );
- /* Setup callbacks */
- p_input->pf_file_open = FileOpen;
- p_input->pf_file_close = FileClose;
-#if !defined( SYS_BEOS ) && !defined( SYS_NTO )
- p_input->pf_network_open = NetworkOpen;
- p_input->pf_network_close = NetworkClose;
-#endif
-
intf_WarnMsg( 1, "input: playlist item `%s'", p_input->p_source );
/* Create thread. */
p_input->c_loops = 0;
p_input->stream.c_packets_read = 0;
p_input->stream.c_packets_trashed = 0;
+ p_input->p_stream = NULL;
/* Set locks. */
vlc_mutex_init( &p_input->stream.stream_lock );
vlc_cond_init( &p_input->stream.stream_wait );
vlc_mutex_init( &p_input->stream.control.control_lock );
- /* Default, might get overwritten */
- p_input->pf_open = p_input->pf_file_open;
- p_input->pf_close = p_input->pf_file_close;
-
+ /* Find appropriate module. */
p_input->p_input_module = module_Need( MODULE_CAPABILITY_INPUT,
(probedata_t *)p_input );
#define f p_input->p_input_module->p_functions->input.functions.input
p_input->pf_init = f.pf_init;
- if( f.pf_open != NULL )
- {
- p_input->pf_open = f.pf_open;
- }
- if( f.pf_close != NULL )
- {
- p_input->pf_close = f.pf_close;
- }
p_input->pf_end = f.pf_end;
p_input->pf_init_bit_stream= f.pf_init_bit_stream;
p_input->pf_read = f.pf_read;
p_input->pf_seek = f.pf_seek;
#undef f
- /* We found the appropriate plugin, open the target */
- p_input->pf_open( p_input );
+ /* FIXME : this is waaaay too kludgy */
+ if( (strlen( p_input->p_source ) > 3) && !strncasecmp( p_input->p_source, "ts:", 3 ) )
+ {
+ /* Network stream */
+ NetworkOpen( p_input );
+ p_input->stream.i_method = INPUT_METHOD_NETWORK;
+ }
+ else if( ( strlen( p_input->p_source ) > 5 ) && !strncasecmp( p_input->p_source, "http:", 5 ) )
+ {
+ /* HTTP stream */
+ HTTPOpen( p_input );
+ p_input->stream.i_method = INPUT_METHOD_NETWORK;
+ }
+ else if( ( strlen( p_input->p_source ) > 4 ) && !strncasecmp( p_input->p_source, "dvd:", 4 ) )
+ {
+ /* DVD - this is THE kludge */
+ p_input->p_input_module->p_functions->input.functions.input.pf_open( p_input );
+ p_input->stream.i_method = INPUT_METHOD_DVD;
+ }
+ else
+ {
+ /* File input */
+ FileOpen( p_input );
+ p_input->stream.i_method = INPUT_METHOD_FILE;
+ }
if( p_input->b_error )
{
p_input->pf_end( p_input );
/* Close stream */
- p_input->pf_close( p_input );
+ if( (strlen( p_input->p_source ) > 3) && !strncasecmp( p_input->p_source, "ts:", 3 ) )
+ {
+ NetworkClose( p_input );
+ }
+ else if( ( strlen( p_input->p_source ) > 5 ) && !strncasecmp( p_input->p_source, "http:", 5 ) )
+ {
+ NetworkClose( p_input );
+ }
+ else if( ( strlen( p_input->p_source ) > 4 ) && !strncasecmp( p_input->p_source, "dvd:", 4 ) )
+ {
+ p_input->p_input_module->p_functions->input.functions.input.pf_close( p_input );
+ }
+ else
+ {
+ FileClose( p_input );
+ }
/* Release modules */
module_Unneed( p_input->p_input_module );
char *psz_name = p_input->p_source;
- /* FIXME: this code ought to be in the plugin so that code can
- * be shared with the *_Probe function */
if( ( i_stat = stat( psz_name, &stat_info ) ) == (-1) )
{
int i_size = strlen( psz_name );
}
/* port before broadcast address */
- if( *psz_port != ':' )
+ if( *psz_port != '\0' )
{
i_port = atoi( psz_port );
}
#ifdef WIN32
WSACleanup();
#endif
-
}
+
+/*****************************************************************************
+ * HTTPOpen : make an HTTP request
+ *****************************************************************************/
+static void HTTPOpen( input_thread_t * p_input )
+{
+ char *psz_server = NULL;
+ char *psz_path = NULL;
+ char *psz_proxy;
+ int i_port = 0;
+ int i_opt;
+ struct sockaddr_in sock;
+ char psz_buffer[256];
+
+#ifdef WIN32
+ WSADATA Data;
+ int i_err;
+#endif
+
+#ifdef WIN32
+ /* WinSock Library Init. */
+ i_err = WSAStartup( MAKEWORD( 1, 1 ), &Data );
+
+ if( i_err )
+ {
+ intf_ErrMsg( "input: can't initiate WinSocks, error %i", i_err );
+ return ;
+ }
#endif
+
+ /* Get the remote server */
+ if( p_input->p_source != NULL )
+ {
+ psz_server = p_input->p_source;
+
+ /* Skip the protocol name */
+ while( *psz_server && *psz_server != ':' )
+ {
+ psz_server++;
+ }
+
+ /* Skip the "://" part */
+ while( *psz_server && (*psz_server == ':' || *psz_server == '/') )
+ {
+ psz_server++;
+ }
+
+ /* Found a server name */
+ if( *psz_server )
+ {
+ char *psz_port = psz_server;
+
+ /* Skip the hostname part */
+ while( *psz_port && *psz_port != ':' && *psz_port != '/' )
+ {
+ psz_port++;
+ }
+
+ /* Found a port name */
+ if( *psz_port )
+ {
+ if( *psz_port == ':' )
+ {
+ /* Replace ':' with '\0' */
+ *psz_port = '\0';
+ psz_port++;
+ }
+
+ psz_path = psz_port;
+ while( *psz_path && *psz_path != '/' )
+ {
+ psz_path++;
+ }
+
+ if( *psz_path )
+ {
+ *psz_path = '\0';
+ psz_path++;
+ }
+ else
+ {
+ psz_path = NULL;
+ }
+
+ if( *psz_port != '\0' )
+ {
+ i_port = atoi( psz_port );
+ }
+ }
+ }
+ else
+ {
+ psz_server = NULL;
+ }
+ }
+
+ /* Check that we got a valid server */
+ if( psz_server == NULL )
+ {
+ intf_ErrMsg( "input error: No server given" );
+ p_input->b_error = 1;
+ return;
+ }
+
+ /* Check that we got a valid port */
+ if( i_port == 0 )
+ {
+ i_port = 80; /* FIXME */
+ }
+
+ intf_WarnMsg( 2, "input: server=%s port=%d path=%s", psz_server,
+ i_port, psz_path );
+
+ /* Open a SOCK_STREAM (TCP) socket, in the AF_INET domain, automatic (0)
+ * * protocol */
+ p_input->i_handle = socket( AF_INET, SOCK_STREAM, 0 );
+ if( p_input->i_handle == -1 )
+ {
+ intf_ErrMsg( "input error: can't create socket (%s)", strerror(errno) ); p_input->b_error = 1;
+ return;
+ }
+
+ /* We may want to reuse an already used socket */
+ i_opt = 1;
+ if( setsockopt( p_input->i_handle, SOL_SOCKET, SO_REUSEADDR,
+ (void *) &i_opt, sizeof( i_opt ) ) == -1 )
+ {
+ intf_ErrMsg( "input error: can't configure socket (SO_REUSEADDR: %s)",
+ strerror(errno));
+ close( p_input->i_handle );
+ p_input->b_error = 1;
+ return;
+ }
+
+ /* Check proxy */
+ if( (psz_proxy = main_GetPszVariable( "http_proxy", NULL )) != NULL )
+ {
+ /* http://myproxy.mydomain:myport/ */
+ int i_proxy_port = 0;
+
+ /* Skip the protocol name */
+ while( *psz_proxy && *psz_proxy != ':' )
+ {
+ psz_proxy++;
+ }
+
+ /* Skip the "://" part */
+ while( *psz_proxy && (*psz_proxy == ':' || *psz_proxy == '/') )
+ {
+ psz_proxy++;
+ }
+
+ /* Found a proxy name */
+ if( *psz_proxy )
+ {
+ char *psz_port = psz_proxy;
+
+ /* Skip the hostname part */
+ while( *psz_port && *psz_port != ':' && *psz_port != '/' )
+ {
+ psz_port++;
+ }
+
+ /* Found a port name */
+ if( *psz_port )
+ {
+ char * psz_junk;
+
+ /* Replace ':' with '\0' */
+ *psz_port = '\0';
+ psz_port++;
+
+ psz_junk = psz_port;
+ while( *psz_junk && *psz_junk != '/' )
+ {
+ psz_junk++;
+ }
+
+ if( *psz_junk )
+ {
+ *psz_junk = '\0';
+ }
+
+ if( *psz_port != '\0' )
+ {
+ i_proxy_port = atoi( psz_port );
+ }
+ }
+ }
+ else
+ {
+ intf_ErrMsg( "input error: http_proxy environment variable is invalid !" );
+ close( p_input->i_handle );
+ p_input->b_error = 1;
+ return;
+ }
+
+ /* Build socket for proxy connection */
+ if ( network_BuildRemoteAddr( &sock, psz_proxy ) == -1 )
+ {
+ intf_ErrMsg( "input error: can't build remote address" );
+ close( p_input->i_handle );
+ p_input->b_error = 1;
+ return;
+ }
+ sock.sin_port = htons( i_proxy_port );
+ }
+ else
+ {
+ /* No proxy, direct connection */
+ if ( network_BuildRemoteAddr( &sock, psz_server ) == -1 )
+ {
+ intf_ErrMsg( "input error: can't build remote address" );
+ close( p_input->i_handle );
+ p_input->b_error = 1;
+ return;
+ }
+ sock.sin_port = htons( i_port );
+ }
+
+ /* Connect the socket */
+ if( connect( p_input->i_handle, (struct sockaddr *) &sock,
+ sizeof( sock ) ) == (-1) )
+ {
+ intf_ErrMsg( "input error: can't connect socket (%s)",
+ strerror(errno) );
+ close( p_input->i_handle );
+ p_input->b_error = 1;
+ return;
+ }
+
+ p_input->stream.b_seekable = 0;
+ p_input->stream.b_pace_control = 1; /* TCP/IP... */
+
+ /* Prepare GET ... */
+ if( psz_proxy != NULL )
+ {
+ snprintf( psz_buffer, sizeof(psz_buffer),
+ "GET http://%s:%d/%s HTTP/1.0\r\n\r\n", psz_server,
+ i_port, psz_path );
+ }
+ else
+ {
+ snprintf( psz_buffer, sizeof(psz_buffer), "GET /%s HTTP/1.0\r\n\r\n",
+ psz_path );
+ }
+ psz_buffer[sizeof(psz_buffer) - 1] = '\0';
+
+ /* Send GET ... */
+ if( write( p_input->i_handle, psz_buffer, strlen( psz_buffer ) ) == (-1) )
+ {
+ intf_ErrMsg( "input error: can't send request (%s)", strerror(errno) );
+ close( p_input->i_handle );
+ p_input->b_error = 1;
+ return;
+ }
+
+ /* Read HTTP header - this is gonna be fun with plug-ins which do not
+ * use p_input->p_stream :-( */
+ if( (p_input->p_stream = fdopen( p_input->i_handle, "r+" )) == NULL )
+ {
+ intf_ErrMsg( "input error: can't reopen socket (%s)", strerror(errno) );
+ close( p_input->i_handle );
+ p_input->b_error = 1;
+ return;
+ }
+
+ while( !feof( p_input->p_stream ) && !ferror( p_input->p_stream ) )
+ {
+ if( fgets( psz_buffer, sizeof(psz_buffer), p_input->p_stream ) == NULL
+ || *psz_buffer == '\r' || *psz_buffer == '\0' )
+ {
+ break;
+ }
+ /* FIXME : check Content-Type one day */
+ }
+
+ intf_WarnMsg( 3, "input: successfully opened HTTP mode" );
+}
+
+#endif /* !defined( SYS_BEOS ) && !defined( SYS_NTO ) */
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_programs.c,v 1.61 2001/08/09 20:16:17 jlj Exp $
+ * $Id: input_programs.c,v 1.62 2001/10/02 16:46:59 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
int input_InitStream( input_thread_t * p_input, size_t i_data_len )
{
- p_input->stream.i_method = INPUT_METHOD_NONE;
p_input->stream.i_stream_id = 0;
/* initialized to 0 since we don't give the signal to the interface
* modules.c : Built-in and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.40 2001/07/17 09:48:08 massiot Exp $
+ * $Id: modules.c,v 1.41 2001/10/02 16:46:59 massiot Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
}
}
}
+ intf_WarnMsg( 3, "module: %s has score %d",
+ p_module->psz_name, i_totalscore );
/* If the high score was broken, we have a new champion */
if( i_totalscore > i_bestscore )