Commit fefa3b65 authored by Christophe Massiot's avatar Christophe Massiot

Major rewrite of the network layer. The following syntax ARE NO LONGER

SUPPORTED :
ts:toto:1234/meuh
--server toto --broadcast meuh --port 1234

The only supported syntax is :
udp[stream]:[//][serveraddr:[serverport]][@[bindaddr][:bindport]]
example : udpstream:toto@meuh:toto

In most cases, simply passing "udpstream:" should work, since it enables
unicast and broadcast reception on port 1234 from any server. Other
options are only used for fine tuning and multicast.

TODO :
* The GTK interface is broken (glade knowledge wanted !)
* Test this on all supported platforms (and fix them :)
[this won't work with current channel servers - fix needed]
parent f1632229
......@@ -4,7 +4,7 @@
* modules.
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: netutils.h,v 1.16 2001/11/12 04:12:37 sam Exp $
* $Id: netutils.h,v 1.17 2001/11/23 18:47:51 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Henri Fallon <henri@videolan.org>
......@@ -31,8 +31,7 @@
* Prototypes
*****************************************************************************/
struct sockaddr_in;
int network_BuildLocalAddr ( struct sockaddr_in *, int, char * );
int network_BuildRemoteAddr ( struct sockaddr_in *, char * );
int network_BuildAddr ( struct sockaddr_in *, char *, int );
int network_ChannelJoin ( int );
int network_ChannelCreate ( void );
......@@ -2,7 +2,7 @@
* input_ts.c: TS demux and netlist management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ts.c,v 1.36 2001/11/11 01:32:03 stef Exp $
* $Id: input_ts.c,v 1.37 2001/11/23 18:47:51 massiot Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
......@@ -133,9 +133,10 @@ static int TSProbe( probedata_t * p_data )
return( 999 );
}
if( ( strlen(psz_name) > 3 ) && !strncasecmp( psz_name, "ts:", 3 ) )
if( ( strlen(psz_name) >= 10 && !strncasecmp( psz_name, "udpstream:", 10 ) )
|| ( strlen(psz_name) >= 4 && !strncasecmp( psz_name, "udp:", 4 ) ) )
{
/* If the user specified "ts:" then it's probably a network stream */
/* If the user specified "udp:" then it's probably a network stream */
return( 999 );
}
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: main.c,v 1.125 2001/11/14 00:01:36 jlj Exp $
* $Id: main.c,v 1.126 2001/11/23 18:47:51 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -213,9 +213,6 @@ static const struct option longopts[] =
/* Input options */
{ "input", 1, 0, OPT_INPUT },
{ "server", 1, 0, OPT_SERVER },
{ "port", 1, 0, OPT_PORT },
{ "broadcast", 1, 0, OPT_BROADCAST },
{ "channels", 0, 0, OPT_CHANNELS },
{ "channelserver", 1, 0, OPT_CHANNELSERVER },
......@@ -792,16 +789,6 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
case OPT_CHANNELSERVER: /* --channelserver */
main_PutPszVariable( INPUT_CHANNEL_SERVER_VAR, optarg );
break;
case OPT_SERVER: /* --server */
main_PutPszVariable( INPUT_SERVER_VAR, optarg );
break;
case OPT_PORT: /* --port */
main_PutPszVariable( INPUT_PORT_VAR, optarg );
break;
case OPT_BROADCAST: /* --broadcast */
main_PutIntVariable( INPUT_BROADCAST_VAR, 1 );
main_PutPszVariable( INPUT_BCAST_ADDR_VAR, optarg );
break;
/* Synchro options */
case OPT_SYNCHRO:
......@@ -916,9 +903,6 @@ static void Usage( int i_fashion )
"\n --input \tinput method"
"\n --channels \tenable channels"
"\n --channelserver <host> \tchannel server address"
"\n --server <host> \tvideo server address"
"\n --port <port> \tvideo server port"
"\n --broadcast \tlisten to a broadcast"
"\n"
"\n -h, --help \tprint help and exit"
"\n -H, --longhelp \tprint long help and exit"
......@@ -974,10 +958,7 @@ static void Usage( int i_fashion )
/* Input parameters */
intf_MsgImm( "\nInput parameters:"
"\n " INPUT_SERVER_VAR "=<hostname> \tvideo server"
"\n " INPUT_PORT_VAR "=<port> \tvideo server port"
"\n " INPUT_IFACE_VAR "=<interface> \tnetwork interface"
"\n " INPUT_BCAST_ADDR_VAR "=<addr> \tbroadcast mode"
"\n " INPUT_CHANNEL_SERVER_VAR "=<hostname> \tchannel server"
"\n " INPUT_CHANNEL_PORT_VAR "=<port> \tchannel server port" );
......
......@@ -2,7 +2,7 @@
* netutils.c: various network functions
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: netutils.c,v 1.48 2001/11/21 22:33:03 jlj Exp $
* $Id: netutils.c,v 1.49 2001/11/23 18:47:51 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Benoit Steiner <benny@via.ecp.fr>
......@@ -109,10 +109,10 @@ static int GetAdapterInfo ( int i_adapter, char *psz_string );
#endif
/*****************************************************************************
* network_BuildLocalAddr : fill a sockaddr_in structure for local binding
* network_BuildAddr : fill a sockaddr_in structure
*****************************************************************************/
int network_BuildLocalAddr( struct sockaddr_in * p_socket, int i_port,
char * psz_broadcast )
int network_BuildAddr( struct sockaddr_in * p_socket,
char * psz_address, int i_port )
{
#if defined( SYS_BEOS )
intf_ErrMsg( "error: networking is not yet supported under BeOS" );
......@@ -123,7 +123,7 @@ int network_BuildLocalAddr( struct sockaddr_in * p_socket, int i_port,
memset( p_socket, 0, sizeof( struct sockaddr_in ) );
p_socket->sin_family = AF_INET; /* family */
p_socket->sin_port = htons( i_port );
if( psz_broadcast == NULL )
if( psz_address == NULL )
{
p_socket->sin_addr.s_addr = INADDR_ANY;
}
......@@ -134,15 +134,15 @@ int network_BuildLocalAddr( struct sockaddr_in * p_socket, int i_port,
/* Try to convert address directly from in_addr - this will work if
* psz_broadcast is dotted decimal. */
#ifdef HAVE_ARPA_INET_H
if( !inet_aton( psz_broadcast, &p_socket->sin_addr) )
if( !inet_aton( psz_address, &p_socket->sin_addr) )
#else
if( (p_socket->sin_addr.s_addr = inet_addr( psz_broadcast )) == -1 )
if( (p_socket->sin_addr.s_addr = inet_addr( psz_address )) == -1 )
#endif
{
/* We have a fqdn, try to find its address */
if ( (p_hostent = gethostbyname( psz_broadcast )) == NULL )
if ( (p_hostent = gethostbyname( psz_address )) == NULL )
{
intf_ErrMsg( "BuildLocalAddr: unknown host %s", psz_broadcast );
intf_ErrMsg( "BuildLocalAddr: unknown host %s", psz_address );
return( -1 );
}
......@@ -155,48 +155,6 @@ int network_BuildLocalAddr( struct sockaddr_in * p_socket, int i_port,
#endif
}
/*****************************************************************************
* network_BuildRemoteAddr : fill a sockaddr_in structure for remote host
*****************************************************************************/
int network_BuildRemoteAddr( struct sockaddr_in * p_socket, char * psz_server )
{
#if defined( SYS_BEOS )
intf_ErrMsg( "error: networking is not yet supported under BeOS" );
return( 1 );
#else
struct hostent * p_hostent;
/* Reset structure */
memset( p_socket, 0, sizeof( struct sockaddr_in ) );
p_socket->sin_family = AF_INET; /* family */
p_socket->sin_port = htons( 0 ); /* This is for remote end */
/* Try to convert address directly from in_addr - this will work if
* psz_in_addr is dotted decimal. */
#ifdef HAVE_ARPA_INET_H
if( !inet_aton( psz_server, &p_socket->sin_addr) )
#else
if( (p_socket->sin_addr.s_addr = inet_addr( psz_server )) == -1 )
#endif
{
/* We have a fqdn, try to find its address */
if ( (p_hostent = gethostbyname(psz_server)) == NULL )
{
intf_ErrMsg( "BuildRemoteAddr: unknown host %s",
psz_server );
return( -1 );
}
/* Copy the first address of the host in the socket address */
memcpy( &p_socket->sin_addr, p_hostent->h_addr_list[0],
p_hostent->h_length );
}
return( 0 );
#endif
}
/*****************************************************************************
* network_ChannelCreate: initialize global channel method data
*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment