You now have to specify the broadcast address as an argument.
Btw, thanks to sam, you can now use ts://server:port style, which gives
for broadcast :
vlc --broadcast broadcast_addr ts://server[:port]
* modules.
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: netutils.h,v 1.10 2001/04/11 02:01:24 henri Exp $
+ * $Id: netutils.h,v 1.11 2001/04/27 18:07:56 henri Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Henri Fallon <henri@videolan.org>
/*****************************************************************************
* Prototypes
*****************************************************************************/
-int network_BuildLocalAddr ( struct sockaddr_in *, int, boolean_t );
+int network_BuildLocalAddr ( struct sockaddr_in *, int, char * );
int network_BuildRemoteAddr( struct sockaddr_in *, char * );
int network_ChannelJoin( int i_channel_id );
int network_ChannelCreate( void );
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input.c,v 1.100 2001/04/27 16:08:26 sam Exp $
+ * $Id: input.c,v 1.101 2001/04/27 18:07:56 henri Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
*****************************************************************************/
void input_NetworkOpen( input_thread_t * p_input )
{
- char *psz_server = NULL;
- int i_port = 0;
-
+ char *psz_server = NULL;
+ int i_port = 0;
int i_opt;
struct sockaddr_in sock;
- boolean_t b_broadcast;
+ char * psz_broadcast;
+
+ /* Are we broadcasting ? */
+ psz_broadcast = main_GetPszVariable( INPUT_BROADCAST_VAR, NULL );
/* Get the remote server */
if( p_input->p_source != NULL )
return;
}
- /* Get details about what we are supposed to do */
- b_broadcast = (boolean_t)main_GetIntVariable( INPUT_BROADCAST_VAR, 0 );
-
- /* TODO : here deal with channel stuff */
-
/* Build the local socket */
- if ( network_BuildLocalAddr( &sock, i_port, b_broadcast ) == -1 )
+ if ( network_BuildLocalAddr( &sock, i_port, psz_broadcast )
+ == -1 )
{
close( p_input->i_handle );
p_input->b_error = 1;
if( connect( p_input->i_handle, (struct sockaddr *) &sock,
sizeof( sock ) ) == (-1) )
{
- intf_ErrMsg("input error: can't connect socket" );
+ intf_ErrMsg( "NetworkOpen: can't connect socket : %s",
+ strerror(errno) );
close( p_input->i_handle );
p_input->b_error = 1;
return;
void input_NetworkClose( input_thread_t * p_input )
{
close( p_input->i_handle );
- /* FIXME: deal with channels */
}
#endif
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: main.c,v 1.87 2001/04/20 05:40:03 stef Exp $
+ * $Id: main.c,v 1.88 2001/04/27 18:07:56 henri Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
{ "channels", 0, 0, OPT_CHANNELS },
{ "server", 1, 0, OPT_SERVER },
{ "port", 1, 0, OPT_PORT },
- { "broadcast", 0, 0, OPT_BROADCAST },
+ { "broadcast", 1, 0, OPT_BROADCAST },
/* Synchro options */
{ "synchro", 1, 0, OPT_SYNCHRO },
main_PutPszVariable( INPUT_PORT_VAR, optarg );
break;
case OPT_BROADCAST: /* --broadcast */
- main_PutIntVariable( INPUT_BROADCAST_VAR, 1 );
+ main_PutPszVariable( INPUT_BROADCAST_VAR, optarg );
break;
/* Synchro options */
"\n " INPUT_SERVER_VAR "=<hostname> \tvideo server"
"\n " INPUT_PORT_VAR "=<port> \tvideo server port"
"\n " INPUT_IFACE_VAR "=<interface> \tnetwork interface"
- "\n " INPUT_BROADCAST_VAR "={1|0} \tbroadcast mode"
+ "\n " INPUT_BROADCAST_VAR "=<addr> \tbroadcast mode"
"\n " INPUT_CHANNEL_SERVER_VAR "=<hostname> \tchannel server"
"\n " INPUT_CHANNEL_PORT_VAR "=<port> \tchannel server port" );
* netutils.c: various network functions
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: netutils.c,v 1.26 2001/04/27 16:08:26 sam Exp $
+ * $Id: netutils.c,v 1.27 2001/04/27 18:07:57 henri Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Benoit Steiner <benny@via.ecp.fr>
* network_BuildLocalAddr : fill a sockaddr_in structure for local binding
*****************************************************************************/
int network_BuildLocalAddr( struct sockaddr_in * p_socket, int i_port,
- boolean_t b_broadcast )
+ char * psz_broadcast )
{
char psz_hostname[INPUT_MAX_SOURCE_LENGTH];
struct hostent * p_hostent;
memset( p_socket, 0, sizeof( struct sockaddr_in ) );
p_socket->sin_family = AF_INET; /* family */
p_socket->sin_port = htons( i_port );
- if( !b_broadcast )
+ if( psz_broadcast == NULL )
{
/* Try to get our own IP */
if( gethostname( psz_hostname, sizeof(psz_hostname) ) )
}
else
- {
- /* Instead of trying to find the broadcast address using non-portable
- * ioctl, let's bind INADDR_ANY */
- strncpy(psz_hostname,"0.0.0.0",sizeof(psz_hostname));
+ {
+ /* I didn't manage to make INADDR_ANYT work, even with setsockopt
+ * so, as it's kludgy to try and determine the broadcast addr
+ * it is passed as an argument in the command line */
+ strncpy( psz_hostname, psz_broadcast, INPUT_MAX_SOURCE_LENGTH );
}
/* Try to convert address directly from in_addr - this will work if
char i_answer;
fd_set s_rfds;
unsigned int i_rc;
-
+
+ if( ! p_main->b_channels )
+ {
+ intf_ErrMsg( "Channels disabled. To enable them, use the --channels"
+ " option" );
+ return( -1 );
+ }
/* debug */
intf_DbgMsg( "ChannelJoin : %d", i_channel_id );
/* If last change is too recent, wait a while */