char *psz_dst_addr;
int i_dst_port;
- module_t *p_network;
- network_socket_t socket_desc;
+ int i_handle;
vlc_value_t val;
p_sys->p_thread->i_empty_depth = 0;
vlc_mutex_init( p_access, &p_sys->p_thread->blocks_lock );
- /* FIXME: use net_OpenUDP API */
- socket_desc.psz_server_addr = psz_dst_addr;
- socket_desc.i_server_port = i_dst_port;
- socket_desc.psz_bind_addr = "";
- socket_desc.i_bind_port = 0;
- socket_desc.i_handle = -1;
- socket_desc.v6only = 0;
-
var_Get( p_access, SOUT_CFG_PREFIX "ttl", &val );
- socket_desc.i_ttl = val.i_int;
-
- p_sys->p_thread->p_private = (void*)&socket_desc;
- p_network = module_Need( p_sys->p_thread, "network", "ipv4", VLC_TRUE );
- if( p_network != NULL )
- module_Unneed( p_sys->p_thread, p_network );
-
- if( socket_desc.i_handle == -1 )
+ i_handle = net_ConnectUDP( p_this, psz_dst_addr, i_dst_port, val.i_int );
+ if( i_handle == -1 )
{
- p_network = module_Need( p_sys->p_thread, "network", "ipv6", VLC_TRUE );
- if( p_network != NULL )
- module_Unneed( p_sys->p_thread, p_network );
-
- if( socket_desc.i_handle == -1 )
- {
- msg_Err( p_access, "failed to open a connection (udp)" );
- return VLC_EGENERIC;
- }
+ msg_Err( p_access, "failed to open a connection (udp)" );
+ return VLC_EGENERIC;
}
- p_sys->p_thread->i_handle = socket_desc.i_handle;
- net_StopRecv( socket_desc.i_handle );
+ p_sys->p_thread->i_handle = i_handle;
+ net_StopRecv( i_handle );
var_Get( p_access, SOUT_CFG_PREFIX "caching", &val );
p_sys->p_thread->i_caching = (int64_t)val.i_int * 1000;
var_Get( p_access, SOUT_CFG_PREFIX "group", &val );
p_sys->p_thread->i_group = val.i_int;
- p_sys->i_mtu = socket_desc.i_mtu;
+ p_sys->i_mtu = var_CreateGetInteger( p_this, "mtu" );
if( vlc_thread_create( p_sys->p_thread, "sout write thread", ThreadWrite,
VLC_THREAD_PRIORITY_HIGHEST, VLC_FALSE ) )
if( i_hlim < 1 )
{
- vlc_value_t val;
-
- if( var_Get( p_this, "ttl", &val ) != VLC_SUCCESS )
- {
- var_Create( p_this, "ttl", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
- var_Get( p_this, "ttl", &val );
- }
- i_hlim = val.i_int;
-
- if( i_hlim < 1 ) i_hlim = 1;
+ i_hlim = var_CreateGetInteger( p_this, "ttl" );
+ if( i_hlim < 1 )
+ i_hlim = 1;
}
memset( &hints, 0, sizeof( hints ) );
{
char *psz_address;
char psz_machine[NI_MAXNUMERICHOST];
- int i_port;
int i_rfd; /* Read socket */
int i_wfd; /* Write socket */
return VLC_ENOMEM;
}
p_address->psz_address = strdup( psz_addr );
- p_address->i_port = 9875;
- p_address->i_wfd = net_OpenUDP( p_sap, "", 0, psz_addr,
- p_address->i_port );
+ p_address->i_wfd = net_ConnectUDP( p_sap, psz_addr, SAP_PORT, 0 );
if( p_address->i_wfd != -1 )
{
char *ptr;
if( p_sap->b_control == VLC_TRUE )
{
- p_address->i_rfd = net_OpenUDP( p_sap, psz_addr,
- p_address->i_port, "", 0 );
+ p_address->i_rfd = net_OpenUDP( p_sap, psz_addr, SAP_PORT, "", 0 );
if( p_address->i_rfd != -1 )
net_StopSend( p_address->i_rfd );
p_address->i_buff = 0;
i_ret = net_Write( p_sap, p_session->p_address->i_wfd, NULL,
p_session->psz_data,
p_session->i_length );
- if( i_ret != p_session->i_length )
+ if( i_ret != (int)p_session->i_length )
{
msg_Warn( p_sap, "SAP send failed on address %s (%i %i)",
p_session->p_address->psz_address,
psz_group ? "a=x-plgroup:" : "",
psz_group ? psz_group : "", psz_group ? "\r\n" : "" ) == -1 )
return NULL;
-
+
msg_Dbg( p_sap, "Generated SDP (%i bytes):\n%s", strlen(psz_sdp),
psz_sdp );
return psz_sdp;
}
#ifdef EXTRA_DEBUG
msg_Dbg( p_sap,"%s:%i : Rate=%i, Interval = %i s",
- p_address->psz_address,p_address->i_port,
- i_rate,
- p_address->i_interval );
+ p_address->psz_address,SAP_PORT, i_rate, p_address->i_interval );
#endif
p_address->b_ready = VLC_TRUE;