vlc | branch: master | Luca Barbato <[email protected]> | Sat May 18 16:41:32 2019 +0200| [d041a6cd3c7c7d29c8b36aeeab528d417738b532] | committer: Felix Paul Kühne
upnp: implement getPreferedAdapter for macOS Signed-off-by: Felix Paul Kühne <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d041a6cd3c7c7d29c8b36aeeab528d417738b532 --- modules/services_discovery/Makefile.am | 3 +++ modules/services_discovery/upnp-wrapper.hpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/modules/services_discovery/Makefile.am b/modules/services_discovery/Makefile.am index 4f234c5fff..0f64efc96d 100644 --- a/modules/services_discovery/Makefile.am +++ b/modules/services_discovery/Makefile.am @@ -40,6 +40,9 @@ libupnp_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(sddir)' libupnp_plugin_la_LIBADD = $(UPNP_LIBS) EXTRA_LTLIBRARIES += libupnp_plugin.la sd_LTLIBRARIES += $(LTLIBupnp) +if HAVE_OSX +libupnp_plugin_la_LDFLAGS += -Wl,-framework,CoreFoundation,-framework,SystemConfiguration +endif libpulselist_plugin_la_SOURCES = services_discovery/pulse.c libpulselist_plugin_la_CFLAGS = $(AM_CFLAGS) $(PULSE_CFLAGS) diff --git a/modules/services_discovery/upnp-wrapper.hpp b/modules/services_discovery/upnp-wrapper.hpp index 417f15a6dd..0d1033e4e0 100644 --- a/modules/services_discovery/upnp-wrapper.hpp +++ b/modules/services_discovery/upnp-wrapper.hpp @@ -334,11 +334,39 @@ done: #ifdef UPNP_ENABLE_IPV6 +#ifdef __APPLE__ +#include <TargetConditionals.h> +#endif + +#if defined(TARGET_OS_MAC) && TARGET_OS_MAC +#include <SystemConfiguration/SystemConfiguration.h> +#include "vlc_charset.h" + inline char *getPreferedAdapter() { + SCDynamicStoreRef session = SCDynamicStoreCreate(NULL, CFSTR("session"), NULL, NULL); + CFDictionaryRef q = (CFDictionaryRef) SCDynamicStoreCopyValue(session, CFSTR("State:/Network/Global/IPv4")); + char *returnValue = NULL; + + if (q != NULL) { + const void *val; + if (CFDictionaryGetValueIfPresent(q, CFSTR("PrimaryInterface"), &val)) { + returnValue = FromCFString((CFStringRef)val, kCFStringEncodingUTF8); + } + } + CFRelease(q); + CFRelease(session); + + return returnValue; +} +#else + +inline char *getIpv4ForMulticast() +{ return NULL; } +#endif #else inline char *getIpv4ForMulticast() _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
