* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input.c,v 1.103 2001/04/28 23:19:19 henri Exp $
+ * $Id: input.c,v 1.109 2001/05/25 13:20:10 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
#include "main.h"
- /* #include <netutils.h> */
-
/*****************************************************************************
* Local prototypes
p_input->stream.i_area_nb = 0;
p_input->stream.pp_areas = NULL;
p_input->stream.p_selected_area = NULL;
+ p_input->stream.p_new_area = NULL;
/* By default there is one areas in a stream */
input_AddArea( p_input );
p_input->stream.p_selected_area = p_input->stream.pp_areas[0];
p_input->stream.control.b_mute = 0;
p_input->stream.control.b_bw = 0;
- /* Initialize default settings for spawned decoders */
- p_input->p_default_aout = p_main->p_aout;
- p_input->p_default_vout = p_main->p_vout;
-
/* Create thread and set locks. */
vlc_mutex_init( &p_input->stream.stream_lock );
vlc_cond_init( &p_input->stream.stream_wait );
vlc_mutex_lock( &p_input->stream.stream_lock );
+ if( p_input->stream.p_new_area )
+ {
+ p_input->pf_set_area( p_input, p_input->stream.p_new_area );
+ p_input->stream.p_new_area = NULL;
+ }
+
if( p_input->stream.p_selected_area->i_seek != NO_SEEK )
{
if( p_input->stream.b_seekable && p_input->pf_seek != NULL )
p_input->stream.p_selected_area->i_seek = NO_SEEK;
}
+ if( p_input->stream.p_removed_es )
+ {
+ input_UnselectES( p_input, p_input->stream.p_removed_es );
+ p_input->stream.p_removed_es = NULL;
+ }
+
+ if( p_input->stream.p_newly_selected_es )
+ {
+ input_SelectES( p_input, p_input->stream.p_newly_selected_es );
+ p_input->stream.p_newly_selected_es = NULL;
+ }
+
vlc_mutex_unlock( &p_input->stream.stream_lock );
i_error = p_input->pf_read( p_input, pp_packets );
{
/* End of file - we do not set b_die because only the
* interface is allowed to do so. */
- intf_WarnMsg( 1, "input: EOF reached" );
+ intf_WarnMsg( 3, "input: EOF reached" );
p_input->b_eof = 1;
}
else
p_input->c_packets_trashed = 0;
#endif
- p_input->p_input_module = module_Need( p_main->p_bank,
- MODULE_CAPABILITY_INPUT,
+ p_input->p_input_module = module_Need( MODULE_CAPABILITY_INPUT,
(probedata_t *)p_input );
if( p_input->p_input_module == NULL )
{
/* We barfed -- exit nicely */
p_input->pf_close( p_input );
- module_Unneed( p_main->p_bank, p_input->p_input_module );
+ module_Unneed( p_input->p_input_module );
return( -1 );
}
{
/* We barfed -- exit nicely */
p_input->pf_close( p_input );
- module_Unneed( p_main->p_bank, p_input->p_input_module );
+ module_Unneed( p_input->p_input_module );
return( -1 );
}
p_input->pf_close( p_input );
/* Release modules */
- module_Unneed( p_main->p_bank, p_input->p_input_module );
+ module_Unneed( p_input->p_input_module );
}
p_input->stream.p_selected_area->i_tell = 0;
vlc_mutex_unlock( &p_input->stream.stream_lock );
- intf_Msg( "input: opening file `%s'", p_input->p_source );
+ intf_WarnMsg( 1, "input: opening file `%s'", p_input->p_source );
#ifndef WIN32
if( (p_input->i_handle = open( psz_name,
/*O_NONBLOCK | O_LARGEFILE*/0 )) == (-1) )
*****************************************************************************/
void input_FileClose( input_thread_t * p_input )
{
- intf_Msg( "input: closing file `%s'", p_input->p_source );
+ intf_WarnMsg( 1, "input: closing file `%s'", p_input->p_source );
close( p_input->i_handle );
return;
void input_NetworkOpen( input_thread_t * p_input )
{
char *psz_server = NULL;
+ char *psz_broadcast = NULL;
int i_port = 0;
int i_opt;
struct sockaddr_in sock;
- char * psz_broadcast;
-
- /* Are we broadcasting ? */
- psz_broadcast = main_GetPszVariable( INPUT_BROADCAST_VAR, NULL );
/* Get the remote server */
if( p_input->p_source != NULL )
*psz_port = '\0';
psz_port++;
- i_port = atoi( psz_port );
+ psz_broadcast = psz_port;
+ while( *psz_broadcast && *psz_broadcast != ':' )
+ {
+ psz_broadcast++;
+ }
+
+ if( *psz_broadcast )
+ {
+ *psz_broadcast = '\0';
+ psz_broadcast++;
+ while( *psz_broadcast && *psz_broadcast == ':' )
+ {
+ psz_broadcast++;
+ }
+ }
+ else
+ {
+ psz_broadcast = NULL;
+ }
+
+ /* port before broadcast address */
+ if( *psz_port != ':' )
+ {
+ i_port = atoi( psz_port );
+ }
}
}
else
{
i_port = main_GetIntVariable( INPUT_PORT_VAR, INPUT_PORT_DEFAULT );
}
-
+
+ if( psz_broadcast == NULL )
+ {
+ /* Are we broadcasting ? */
+ psz_broadcast = main_GetPszVariable( INPUT_BROADCAST_VAR, NULL );
+ }
+
+ intf_WarnMsg( 2, "input: server: %s port: %d broadcast: %s",
+ psz_server, i_port, psz_broadcast );
+
/* Open a SOCK_DGRAM (UDP) socket, in the AF_INET domain, automatic (0)
* protocol */
p_input->i_handle = socket( AF_INET, SOCK_DGRAM, 0 );