Commit c67dcbe7 authored by Christophe Massiot's avatar Christophe Massiot

* Fixed a warning in input_es.c ;

* Don't connect on INADDR_ANY, patch courtesy of Mathias Kretschmer
  <mathias@research.att.com>.
parent ce0e4dd1
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_es.c: Elementary Stream demux and packet management * input_es.c: Elementary Stream demux and packet management
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: input_es.c,v 1.10 2001/10/02 16:46:59 massiot Exp $ * $Id: input_es.c,v 1.11 2001/10/02 17:04:42 massiot Exp $
* *
* Author: Christophe Massiot <massiot@via.ecp.fr> * Author: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -125,8 +125,6 @@ void _M( input_getfunctions )( function_list_t * p_function_list ) ...@@ -125,8 +125,6 @@ void _M( input_getfunctions )( function_list_t * p_function_list )
*****************************************************************************/ *****************************************************************************/
static int ESProbe( probedata_t *p_data ) static int ESProbe( probedata_t *p_data )
{ {
input_thread_t * p_input = (input_thread_t *)p_data;
int i_score = 5; int i_score = 5;
if( TestMethod( INPUT_METHOD_VAR, "es" ) ) if( TestMethod( INPUT_METHOD_VAR, "es" ) )
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.133 2001/10/02 16:46:59 massiot Exp $ * $Id: input.c,v 1.134 2001/10/02 17:04:43 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -857,14 +857,14 @@ static void NetworkOpen( input_thread_t * p_input ) ...@@ -857,14 +857,14 @@ static void NetworkOpen( input_thread_t * p_input )
return; return;
} }
/* Join the m/c group if sock is a multicast address */ /* Join the multicast group if the socket is a multicast address */
if( IN_MULTICAST( ntohl(i_mc_group) ) ) if( IN_MULTICAST( ntohl(i_mc_group) ) )
{ {
struct ip_mreq imr; struct ip_mreq imr;
imr.imr_interface.s_addr = htonl(INADDR_ANY); imr.imr_interface.s_addr = htonl(INADDR_ANY);
imr.imr_multiaddr.s_addr = i_mc_group; imr.imr_multiaddr.s_addr = i_mc_group;
if( setsockopt( p_input->i_handle, IPPROTO_IP,IP_ADD_MEMBERSHIP, if( setsockopt( p_input->i_handle, IPPROTO_IP, IP_ADD_MEMBERSHIP,
(char*)&imr, sizeof(struct ip_mreq) ) == -1 ) (char*)&imr, sizeof(struct ip_mreq) ) == -1 )
{ {
intf_ErrMsg( "input error: failed to join IP multicast group (%s)", intf_ErrMsg( "input error: failed to join IP multicast group (%s)",
...@@ -884,15 +884,19 @@ static void NetworkOpen( input_thread_t * p_input ) ...@@ -884,15 +884,19 @@ static void NetworkOpen( input_thread_t * p_input )
return; return;
} }
/* And connect it */ /* Only connect if the user has passed a valid host */
if( connect( p_input->i_handle, (struct sockaddr *) &sock, if( sock.sin_addr.s_addr != INADDR_ANY )
sizeof( sock ) ) == (-1) )
{ {
intf_ErrMsg( "input error: can't connect socket (%s)", /* Connect the socket */
strerror(errno) ); if( connect( p_input->i_handle, (struct sockaddr *) &sock,
close( p_input->i_handle ); sizeof( sock ) ) == (-1) )
p_input->b_error = 1; {
return; 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_pace_control = 0; p_input->stream.b_pace_control = 0;
......
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