Commit 975a356c authored by Jean-Paul Saman's avatar Jean-Paul Saman

Merge branch 'master' of git@git.videolan.org:vlc

parents b4fdd335 e41bccdf
...@@ -386,24 +386,33 @@ static int Open( vlc_object_t *p_this ) ...@@ -386,24 +386,33 @@ static int Open( vlc_object_t *p_this )
if( var_GetBool( p_stream, SOUT_CFG_PREFIX"sap" ) ) if( var_GetBool( p_stream, SOUT_CFG_PREFIX"sap" ) )
{ {
/* Create the SDP */ /* Create the SDP */
static const struct addrinfo hints = {
.ai_family = AF_UNSPEC,
.ai_socktype = SOCK_DGRAM,
.ai_protocol = 0,
.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV
};
char *shost = var_GetNonEmptyString (p_access, "src-addr"); char *shost = var_GetNonEmptyString (p_access, "src-addr");
char *dhost = var_GetNonEmptyString (p_access, "dst-addr"); char *dhost = var_GetNonEmptyString (p_access, "dst-addr");
int sport = var_GetInteger (p_access, "src-port"); int sport = var_GetInteger (p_access, "src-port");
int dport = var_GetInteger (p_access, "dst-port"); int dport = var_GetInteger (p_access, "dst-port");
char port[6];
struct sockaddr_storage src, dst; struct sockaddr_storage src, dst;
socklen_t srclen = 0, dstlen = 0; socklen_t srclen = 0, dstlen = 0;
struct addrinfo *res; struct addrinfo *res;
if (vlc_getaddrinfo (VLC_OBJECT (p_stream), dhost, dport, NULL, &res) == 0)
snprintf (port, sizeof (port), "%d", dport);
if (getaddrinfo (dhost, port, &hints, &res) == 0)
{ {
memcpy (&dst, res->ai_addr, dstlen = res->ai_addrlen); memcpy (&dst, res->ai_addr, dstlen = res->ai_addrlen);
vlc_freeaddrinfo (res); freeaddrinfo (res);
} }
if (vlc_getaddrinfo (VLC_OBJECT (p_stream), shost, sport, NULL, &res) == 0) snprintf (port, sizeof (port), "%d", sport);
if (getaddrinfo (shost, port, &hints, &res) == 0)
{ {
memcpy (&src, res->ai_addr, srclen = res->ai_addrlen); memcpy (&src, res->ai_addr, srclen = res->ai_addrlen);
vlc_freeaddrinfo (res); freeaddrinfo (res);
} }
char *head = vlc_sdp_Start (VLC_OBJECT (p_stream), SOUT_CFG_PREFIX, char *head = vlc_sdp_Start (VLC_OBJECT (p_stream), SOUT_CFG_PREFIX,
......
...@@ -60,11 +60,11 @@ ...@@ -60,11 +60,11 @@
#ifndef HAVE_GAI_STRERROR #ifndef HAVE_GAI_STRERROR
static struct static const struct
{ {
int code; char code;
const char *msg; const char msg[41]
} const __gai_errlist[] = } gai_errlist[] =
{ {
{ 0, "Error 0" }, { 0, "Error 0" },
{ EAI_BADFLAGS, "Invalid flag used" }, { EAI_BADFLAGS, "Invalid flag used" },
...@@ -82,18 +82,18 @@ static struct ...@@ -82,18 +82,18 @@ static struct
{ 0, NULL } { 0, NULL }
}; };
static const char __gai_unknownerr[] = "Unrecognized error number"; static const char gai_unknownerr[] = "Unrecognized error number";
/**************************************************************************** /****************************************************************************
* Converts an EAI_* error code into human readable english text. * Converts an EAI_* error code into human readable english text.
****************************************************************************/ ****************************************************************************/
const char *vlc_gai_strerror (int errnum) const char *vlc_gai_strerror (int errnum)
{ {
for (unsigned i = 0; __gai_errlist[i].msg != NULL; i++) for (unsigned i = 0; gai_errlist[i].msg != NULL; i++)
if (errnum == __gai_errlist[i].code) if (errnum == gai_errlist[i].code)
return __gai_errlist[i].msg; return gai_errlist[i].msg;
return __gai_unknownerr; return gai_unknownerr;
} }
#else /* ifndef HAVE_GAI_STRERROR */ #else /* ifndef HAVE_GAI_STRERROR */
const char *vlc_gai_strerror (int errnum) const char *vlc_gai_strerror (int errnum)
...@@ -622,19 +622,13 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node, ...@@ -622,19 +622,13 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node,
if( hints.ai_family == AF_UNSPEC ) if( hints.ai_family == AF_UNSPEC )
{ {
vlc_value_t val;
var_Create( p_this, "ipv4", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_this, "ipv4", &val );
if( val.b_bool )
hints.ai_family = AF_INET;
#ifdef AF_INET6 #ifdef AF_INET6
var_Create( p_this, "ipv6", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); if (var_CreateGetBool (p_this, "ipv6"))
var_Get( p_this, "ipv6", &val );
if( val.b_bool )
hints.ai_family = AF_INET6; hints.ai_family = AF_INET6;
else
#endif #endif
if (var_CreateGetBool (p_this, "ipv4"))
hints.ai_family = AF_INET;
} }
/* /*
...@@ -683,21 +677,13 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node, ...@@ -683,21 +677,13 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node,
#if defined (HAVE_GETADDRINFO) #if defined (HAVE_GETADDRINFO)
# ifdef AI_IDN # ifdef AI_IDN
/* Run-time I18n Domain Names support */ /* Run-time I18n Domain Names support */
static bool b_idn = true; /* beware of thread-safety */
if (b_idn)
{
hints.ai_flags |= AI_IDN; hints.ai_flags |= AI_IDN;
int ret = getaddrinfo (psz_node, psz_service, &hints, res); int ret = getaddrinfo (psz_node, psz_service, &hints, res);
if (ret != EAI_BADFLAGS) if (ret != EAI_BADFLAGS)
return ret; return ret;
/* IDN not available: disable and retry without it */ /* IDN not available: disable and retry without it */
hints.ai_flags &= ~AI_IDN; hints.ai_flags &= ~AI_IDN;
b_idn = false;
msg_Info (p_this, "International Domain Names not supported");
}
# endif # endif
return getaddrinfo (psz_node, psz_service, &hints, res); return getaddrinfo (psz_node, psz_service, &hints, res);
#else #else
......
...@@ -131,14 +131,7 @@ void __vout_OSDMessage( vlc_object_t *p_caller, int i_channel, ...@@ -131,14 +131,7 @@ void __vout_OSDMessage( vlc_object_t *p_caller, int i_channel,
if( !config_GetInt( p_caller, "osd" ) ) return; if( !config_GetInt( p_caller, "osd" ) ) return;
if( p_caller->i_object_type == VLC_OBJECT_VOUT )
{
p_vout = (vout_thread_t*) p_caller;
vlc_object_yield( p_vout );
}
else
p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT, FIND_ANYWHERE ); p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT, FIND_ANYWHERE );
if( p_vout ) if( p_vout )
{ {
va_start( args, psz_format ); va_start( args, psz_format );
......
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