diff --git a/configure.in b/configure.in
index c0542b255a803..dc7b11c942279 100644
--- a/configure.in
+++ b/configure.in
@@ -135,6 +135,7 @@ halstorage_not_found="== Could not find hal-storage. HAL support disabled. =="
hal_disabled="== HAL support disabled. =="
avahi_not_found="== Could not find libavahi-common or libavahi-client. Avahi support disabled. =="
avahi_disabled="== Avahi support disabled. =="
+mdnsembedded_not_found="== Could not find mDNSEmbedded - zeroconf will be disabled. =="
vdpau_not_found="== Could not find libvdpau. VDPAU support disabled. =="
vdpau_disabled="== VDPAU support manually disabled. =="
vaapi_not_found="== Could not find libva. VAAPI support disabled. =="
@@ -1262,6 +1263,12 @@ else
fi
fi
+if test "$target_platform" = "target_android" ; then
+ use_mdnsembedded=yes
+ AC_CHECK_LIB([mDNSEmbedded], [embedded_mDNSInit],,
+ use_mdnsembedded=no;AC_MSG_RESULT($mdnsembedded_not_found))
+fi
+
# X11
if test "$use_x11" = "yes" && test "$host_vendor" != "apple"; then
AC_MSG_NOTICE($x11_enabled)
@@ -2213,6 +2220,12 @@ else
final_message="$final_message\n Avahi:\tNo"
fi
+if test "$use_mdnsembedded" = "yes"; then
+ final_message="$final_message\n mDNSEmbedded:\tYes"
+else
+ final_message="$final_message\n mDNSEmbedded:\tNo"
+fi
+
if test "$use_nonfree" = "yes"; then
final_message="$final_message\n Non-free:\tYes"
HAVE_XBMC_NONFREE=1
diff --git a/tools/android/packaging/xbmc/AndroidManifest.xml b/tools/android/packaging/xbmc/AndroidManifest.xml
index 9c4bbb33c6ba6..d371cc3fd91b3 100644
--- a/tools/android/packaging/xbmc/AndroidManifest.xml
+++ b/tools/android/packaging/xbmc/AndroidManifest.xml
@@ -12,7 +12,7 @@
-
+
/dev/null
+
+if [ -f ispatched ]; then
+ rm ./ispatched
+else
+ patch -p1 < ../mDNSResponder-333.10.umundo.patch
+fi
+
+# #ifdef TARGET_OS_ANDROID
+# __android_log_print(ANDROID_LOG_VERBOSE, "umundo", "%s:%d: mDNSPlatformTimeInit returned %d\n", __FILE__, __LINE__, result);
+# #endif
+
+touch ispatched
+
+mDNSEmbedded=( mDNSShared/dnssd_clientshim.c mDNSPosix/mDNSPosix.c mDNSCore/mDNS.c mDNSCore/DNSCommon.c mDNSShared/mDNSDebug.c \
+ mDNSShared/GenLinkedList.c mDNSCore/uDNS.c mDNSShared/PlatformCommon.c mDNSPosix/mDNSUNP.c mDNSCore/DNSDigest.c mDNSCore/mDnsEmbedded.c )
+
+CC_COMMON_FLAGS="-I. -DANDROID -DTARGET_OS_ANDROID -fno-strict-aliasing -fno-omit-frame-pointer -fno-exceptions -fdata-sections -ffunction-sections"
+CC_COMMON_FLAGS="\
+ ${CC_COMMON_FLAGS} \
+ -ImDNSCore -ImDNSShared -fwrapv -W -Wall -DPID_FILE=\"/var/run/mdnsd.pid\" \
+ -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\" -DTARGET_OS_ANDROID -DNOT_HAVE_SA_LEN -DUSES_NETLINK -fpic\
+ -Wdeclaration-after-statement -Wno-unused-parameter -Wno-unused-but-set-variable -Os -llog"
+
+# build for x86
+
+#CC_X86_FLAGS="${CC_COMMON_FLAGS} \
+#-funwind-tables \
+#-finline-limit=300"
+
+#X86_SYSROOT="${ANDROID_NDK}/platforms/android-9/arch-x86"
+#X86_TOOLCHAIN_ROOT="${ANDROID_NDK}/toolchains/x86-4.6/prebuilt/darwin-x86"
+#X86_TOOL_PREFIX="i686-linux-android"
+#X86_COMMON_FLAGS="\
+#-isystem ${ANDROID_NDK}/platforms/android-9/arch-x86/usr/include \
+#-isystem ${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.6/include \
+#-isystem ${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include"
+
+#AR="${X86_TOOLCHAIN_ROOT}/bin/${X86_TOOL_PREFIX}-ar"
+#CC="${X86_TOOLCHAIN_ROOT}/bin/${X86_TOOL_PREFIX}-gcc"
+#LD="${X86_TOOLCHAIN_ROOT}/bin/${X86_TOOL_PREFIX}-ld"
+
+#if [ -d build ]; then
+# rm -rf build
+#fi
+
+#mkdir -p build/mDNSPosix &> /dev/null
+#mkdir -p build/mDNSCore &> /dev/null
+#mkdir -p build/mDNSShared &> /dev/null
+#mkdir -p build/prod &> /dev/null
+
+# compile all the files
+#OBJS=""
+#for file in ${mDNSEmbedded[@]}; do
+# if [ ! -f build/${file}.o ]; then
+# echo ${CC} --sysroot=${X86_SYSROOT} ${CC_X86_FLAGS} ${X86_COMMON_FLAGS} -c ${file} -o build/${file}.o
+# ${CC} --sysroot=${X86_SYSROOT} ${CC_X86_FLAGS} ${X86_COMMON_FLAGS} -c ${file} -o build/${file}.o
+# OBJS="$OBJS build/${file}.o"
+# fi
+#done
+
+# echo ${CC} --sysroot=${X86_SYSROOT} -shared -o build/prod/libmDNSEmbedded.so $OBJS
+# ${CC} --sysroot=${X86_SYSROOT} -shared -o build/prod/libmDNSEmbedded.so $OBJS
+#echo ${AR} rvs build/prod/libmDNSEmbedded.a $OBJS
+#${AR} rvs build/prod/libmDNSEmbedded.a $OBJS
+
+#mkdir -p ${DEST_DIR}/x86/lib &> /dev/null
+#cp build/prod/*.a ${DEST_DIR}/x86/lib
+
+
+# build for arm
+
+CC_ARMEABI_FLAGS="${CC_COMMON_FLAGS} \
+-D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5__ \
+-fsigned-char \
+-march=armv5te \
+-mtune=xscale \
+-msoft-float \
+-mfpu=vfp \
+-mfloat-abi=softfp \
+-fPIC \
+-finline-limit=64"
+
+ANDROID_NDK="/home/jenkins/android-dev/android-ndk-r8e"
+ARM_SYSROOT="${ANDROID_NDK}/platforms/android-14/arch-arm"
+ARMEABI_TOOLCHAIN_ROOT="${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/"
+ARMEABI_TOOL_PREFIX="arm-linux-androideabi"
+ARMEABI_COMMON_FLAGS="\
+-isystem ${ANDROID_NDK}/platforms/android-14/arch-arm/usr/include \
+-isystem ${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.7/include \
+-isystem ${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi/include"
+
+AR="${ARMEABI_TOOLCHAIN_ROOT}/bin/${ARMEABI_TOOL_PREFIX}-ar"
+CC="${ARMEABI_TOOLCHAIN_ROOT}/bin/${ARMEABI_TOOL_PREFIX}-gcc"
+LD="${ARMEABI_TOOLCHAIN_ROOT}/bin/${ARMEABI_TOOL_PREFIX}-ld"
+
+if [ -d build ]; then
+ rm -rf build
+fi
+
+mkdir -p build/mDNSPosix &> /dev/null
+mkdir -p build/mDNSCore &> /dev/null
+mkdir -p build/mDNSShared &> /dev/null
+mkdir -p build/prod &> /dev/null
+
+# compile all the files
+OBJS=""
+for file in ${mDNSEmbedded[@]}; do
+ if [ ! -f build/${file}.o ]; then
+ echo ${CC} --sysroot=${X86_SYSROOT} ${CC_ARMEABI_FLAGS} ${ARMEABI_COMMON_FLAGS} -c ${file} -o build/${file}.o
+ ${CC} --sysroot=${X86_SYSROOT} ${CC_ARMEABI_FLAGS} ${ARMEABI_COMMON_FLAGS} -c ${file} -o build/${file}.o
+ OBJS="$OBJS build/${file}.o"
+ fi
+done
+
+# echo ${CC} --sysroot=${X86_SYSROOT} -shared -o build/prod/libmDNSEmbedded.so $OBJS
+# ${CC} --sysroot=${X86_SYSROOT} -shared -o build/prod/libmDNSEmbedded.so $OBJS
+echo ${AR} rvs build/prod/libmDNSEmbedded.a $OBJS
+${AR} rvs build/prod/libmDNSEmbedded.a $OBJS
+
+mkdir -p ${DEST_DIR}/armeabi/lib &> /dev/null
+cp build/prod/*.a ${DEST_DIR}/armeabi/lib
diff --git a/tools/depends/target/mdnsresponder/mDNSResponder-333.10.umundo.patch b/tools/depends/target/mdnsresponder/mDNSResponder-333.10.umundo.patch
new file mode 100644
index 0000000000000..8c1dcfa3fd9e6
--- /dev/null
+++ b/tools/depends/target/mdnsresponder/mDNSResponder-333.10.umundo.patch
@@ -0,0 +1,385 @@
+diff -rupN mDNSResponder-333.10/mDNSCore/mDNSEmbeddedAPI.h mDNSResponder-333.10.patched/mDNSCore/mDNSEmbeddedAPI.h
+--- mDNSResponder-333.10/mDNSCore/mDNSEmbeddedAPI.h 2011-06-30 22:56:04.000000000 +0200
++++ mDNSResponder-333.10.patched/mDNSCore/mDNSEmbeddedAPI.h 2012-04-15 15:10:42.000000000 +0200
+@@ -1051,6 +1051,10 @@ enum
+ McastResolver_FlagNew = 2
+ };
+
++// everyone loves proprietary language extensions in the global namespace
++#ifdef _MSC_VER
++#undef interface
++#endif
+ typedef struct McastResolver
+ {
+ struct McastResolver *next;
+diff -rupN mDNSResponder-333.10/mDNSPosix/mDNSPosix.h mDNSResponder-333.10.patched/mDNSPosix/mDNSPosix.h
+--- mDNSResponder-333.10/mDNSPosix/mDNSPosix.h 2009-08-11 03:13:47.000000000 +0200
++++ mDNSResponder-333.10.patched/mDNSPosix/mDNSPosix.h 2012-04-15 15:10:42.000000000 +0200
+@@ -25,6 +25,10 @@
+ extern "C" {
+ #endif
+
++#ifdef TARGET_OS_ANDROID
++#include
++#endif
++
+ // PosixNetworkInterface is a record extension of the core NetworkInterfaceInfo
+ // type that supports extra fields needed by the Posix platform.
+ //
+diff -rupN mDNSResponder-333.10/mDNSShared/PlatformCommon.c mDNSResponder-333.10.patched/mDNSShared/PlatformCommon.c
+--- mDNSResponder-333.10/mDNSShared/PlatformCommon.c 2011-04-12 00:54:35.000000000 +0200
++++ mDNSResponder-333.10.patched/mDNSShared/PlatformCommon.c 2012-04-15 15:10:42.000000000 +0200
+@@ -27,6 +27,10 @@
+ #include "DNSCommon.h"
+ #include "PlatformCommon.h"
+
++#ifdef TARGET_OS_ANDROID
++#include
++#endif
++
+ #ifdef NOT_HAVE_SOCKLEN_T
+ typedef unsigned int socklen_t;
+ #endif
+@@ -143,13 +147,20 @@ mDNSexport void ReadDDNSSettingsFromConf
+ #if MDNS_DEBUGMSGS
+ mDNSexport void mDNSPlatformWriteDebugMsg(const char *msg)
+ {
++#ifdef TARGET_OS_ANDROID
++ __android_log_print(ANDROID_LOG_DEBUG, "bonjour", "%s", msg);
++#else
+ fprintf(stderr,"%s\n", msg);
+ fflush(stderr);
++#endif
+ }
+ #endif
+
+ mDNSexport void mDNSPlatformWriteLogMsg(const char *ident, const char *buffer, mDNSLogLevel_t loglevel)
+ {
++#ifdef TARGET_OS_ANDROID
++ __android_log_print(ANDROID_LOG_DEBUG, "bonjour", "%s", buffer);
++#else
+ #if APPLE_OSX_mDNSResponder && LogTimeStamps
+ extern mDNS mDNSStorage;
+ extern mDNSu32 mDNSPlatformClockDivisor;
+@@ -193,4 +204,5 @@ mDNSexport void mDNSPlatformWriteLogMsg(
+ #endif
+ syslog(syslog_level, "%s", buffer);
+ }
++#endif
+ }
+diff -rupN mDNSResponder-333.10/mDNSShared/dns_sd.h mDNSResponder-333.10.patched/mDNSShared/dns_sd.h
+--- mDNSResponder-333.10/mDNSShared/dns_sd.h 2011-08-31 03:44:17.000000000 +0200
++++ mDNSResponder-333.10.patched/mDNSShared/dns_sd.h 2012-04-15 15:10:42.000000000 +0200
+@@ -93,7 +93,7 @@
+ /* standard calling convention under Win32 is __stdcall */
+ /* Note: When compiling Intel EFI (Extensible Firmware Interface) under MS Visual Studio, the */
+ /* _WIN32 symbol is defined by the compiler even though it's NOT compiling code for Windows32 */
+-#if defined(_WIN32) && !defined(EFI32) && !defined(EFI64)
++#if defined(_WIN32) && !defined(EFI32) && !defined(EFI64) && !defined(DISC_BONJOUR_EMBED)
+ #define DNSSD_API __stdcall
+ #else
+ #define DNSSD_API
+diff -rupN mDNSResponder-333.10/mDNSShared/dnssd_clientshim.c mDNSResponder-333.10.patched/mDNSShared/dnssd_clientshim.c
+--- mDNSResponder-333.10/mDNSShared/dnssd_clientshim.c 2011-06-02 00:44:37.000000000 +0200
++++ mDNSResponder-333.10.patched/mDNSShared/dnssd_clientshim.c 2012-04-15 15:10:42.000000000 +0200
+@@ -25,6 +25,13 @@
+
+ #include "dns_sd.h" // Defines the interface to the client layer above
+ #include "mDNSEmbeddedAPI.h" // The interface we're building on top of
++#ifndef _MSC_VER
++#include
++#include
++#else
++#include
++#endif
++
+ extern mDNS mDNSStorage; // We need to pass the address of this storage to the lower-layer functions
+
+ #if MDNS_BUILDINGSHAREDLIBRARY || MDNS_BUILDINGSTUBLIBRARY
+@@ -71,6 +78,14 @@ typedef struct
+ typedef struct
+ {
+ mDNS_DirectOP_Dispose *disposefn;
++ DNSServiceRef aQuery;
++ DNSServiceGetAddrInfoReply callback;
++ void *context;
++ } mDNS_DirectOP_GetAddrInfo;
++
++typedef struct
++ {
++ mDNS_DirectOP_Dispose *disposefn;
+ DNSServiceResolveReply callback;
+ void *context;
+ const ResourceRecord *SRV;
+@@ -659,7 +674,7 @@ DNSServiceErrorType DNSServiceQueryRecor
+ x->q.ExpectUnique = mDNSfalse;
+ x->q.ForceMCast = (flags & kDNSServiceFlagsForceMulticast) != 0;
+ x->q.ReturnIntermed = (flags & kDNSServiceFlagsReturnIntermediates) != 0;
+- x->q.SuppressUnsable = (flags & kDNSServiceFlagsSuppressUnusable) != 0;
++ x->q.SuppressUnusable = (flags & kDNSServiceFlagsSuppressUnusable) != 0;
+ x->q.SearchListIndex = 0;
+ x->q.AppendSearchDomains = 0;
+ x->q.RetryWithSearchDomains = mDNSfalse;
+diff -rupN mDNSResponder-333.10/mDNSShared/dnssd_ipc.h mDNSResponder-333.10.patched/mDNSShared/dnssd_ipc.h
+--- mDNSResponder-333.10/mDNSShared/dnssd_ipc.h 2011-06-30 22:56:04.000000000 +0200
++++ mDNSResponder-333.10.patched/mDNSShared/dnssd_ipc.h 2012-04-15 15:10:42.000000000 +0200
+@@ -29,6 +29,11 @@
+ #ifndef DNSSD_IPC_H
+ #define DNSSD_IPC_H
+
++#ifdef TARGET_OS_ANDROID
++#include
++#include
++#endif
++
+ #include "dns_sd.h"
+
+ //
+diff -rupN mDNSResponder-333.10/mDNSShared/uds_daemon.h mDNSResponder-333.10.patched/mDNSShared/uds_daemon.h
+--- mDNSResponder-333.10/mDNSShared/uds_daemon.h 2011-05-18 00:18:08.000000000 +0200
++++ mDNSResponder-333.10.patched/mDNSShared/uds_daemon.h 2012-04-15 15:10:42.000000000 +0200
+@@ -22,6 +22,11 @@
+
+ */
+
++#ifdef TARGET_OS_ANDROID
++#include
++#include
++#endif
++
+ #include "mDNSEmbeddedAPI.h"
+ #include "dnssd_ipc.h"
+
+diff -rupN mDNSResponder-333.10/mDNSWindows/mDNSWin32.c mDNSResponder-333.10.patched/mDNSWindows/mDNSWin32.c
+--- mDNSResponder-333.10/mDNSWindows/mDNSWin32.c 2011-08-31 03:42:48.000000000 +0200
++++ mDNSResponder-333.10.patched/mDNSWindows/mDNSWin32.c 2012-04-15 15:17:34.000000000 +0200
+@@ -2843,10 +2843,7 @@ mDNSlocal mStatus SetupSocket( mDNS * co
+ sa4.sin_family = AF_INET;
+ sa4.sin_port = port.NotAnInteger;
+ sa4.sin_addr.s_addr = ipv4.NotAnInteger;
+-
+- err = bind( sock, (struct sockaddr *) &sa4, sizeof( sa4 ) );
+- check_translated_errno( err == 0, errno_compat(), kUnknownErr );
+-
++
+ // Turn on option to receive destination addresses and receiving interface.
+
+ option = 1;
+@@ -2887,6 +2884,9 @@ mDNSlocal mStatus SetupSocket( mDNS * co
+ err = setsockopt( sock, IPPROTO_IP, IP_MULTICAST_TTL, (char *) &option, sizeof( option ) );
+ check_translated_errno( err == 0, errno_compat(), kOptionErr );
+
++ err = bind( sock, (struct sockaddr *) &sa4, sizeof( sa4 ) );
++ check_translated_errno( err == 0, errno_compat(), kUnknownErr );
++
+ }
+ else if( inAddr->sa_family == AF_INET6 )
+ {
+@@ -2904,10 +2904,7 @@ mDNSlocal mStatus SetupSocket( mDNS * co
+ sa6.sin6_flowinfo = 0;
+ sa6.sin6_addr = sa6p->sin6_addr;
+ sa6.sin6_scope_id = sa6p->sin6_scope_id;
+-
+- err = bind( sock, (struct sockaddr *) &sa6, sizeof( sa6 ) );
+- check_translated_errno( err == 0, errno_compat(), kUnknownErr );
+-
++
+ // Turn on option to receive destination addresses and receiving interface.
+
+ option = 1;
+@@ -2957,6 +2954,10 @@ mDNSlocal mStatus SetupSocket( mDNS * co
+ option = 255;
+ err = setsockopt( sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *) &option, sizeof( option ) );
+ check_translated_errno( err == 0, errno_compat(), kOptionErr );
++
++ err = bind( sock, (struct sockaddr *) &sa6, sizeof( sa6 ) );
++ check_translated_errno( err == 0, errno_compat(), kUnknownErr );
++
+ }
+ else
+ {
+diff -uPr mDNSResponder-333.10/mDNSCore.orig/mDnsEmbedded.c mDNSResponder-333.10/mDNSCore/mDnsEmbedded.c
+--- mDNSResponder-333.10/mDNSCore/mDnsEmbedded.c 1970-01-01 01:00:00.000000000 +0100
++++ mDNSResponder-333.10/mDNSCore/mDnsEmbedded.c 2013-06-01 13:04:44.000000000 +0100
+@@ -0,0 +1,145 @@
++/**
++ * @file
++ * @brief Wrapper for mDNSEmbeddedAPI with Bonjour.
++ * @author 2012 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
++ * @copyright Simplified BSD
++ *
++ * @cond
++ * This program is free software: you can redistribute it and/or modify
++ * it under the terms of the FreeBSD license as published by the FreeBSD
++ * project.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
++ *
++ * You should have received a copy of the FreeBSD license along with this
++ * program. If not, see .
++ * @endcond
++ */
++
++#include
++#include
++#include
++// include order matters
++#include "mDNSEmbeddedAPI.h"
++#ifdef WIN32
++#include "../mDNSWindows/mDNSWin32.h" // Defines the specific types needed to run mDNS on windows platforms
++#else
++#include
++#include "../mDNSPosix/mDNSPosix.h" // Defines the specific types needed to run mDNS on posix platforms
++#endif
++
++#define RR_CACHE_SIZE 500
++static CacheEntity rrcachestorage[RR_CACHE_SIZE];
++mDNS mDNSStorage;
++//struct mDNS_PlatformSupport_struct {};
++static int mDNSIsInitialized = 0;
++static mDNS_PlatformSupport platformSupport;
++
++const char ProgramName[] = "umundo";
++extern mDNSexport void mDNSPosixGetFDSet(mDNS *m, int *nfds, fd_set *readfds, struct timeval *timeout);
++extern mDNSexport void mDNSPosixProcessFDSet(mDNS *const m, fd_set *readfds);
++
++// promise compiler that these will be there
++mDNSexport int embedded_mDNSmainLoop(struct timeval timeout);
++
++#if WIN32
++mStatus mDNSPoll(DWORD msec);
++static void embedded_mDNSInit_ReportStatus( int inType, const char *inFormat, ... ) {
++}
++#endif
++
++mDNSexport int embedded_mDNSInit() {
++ mStatus err;
++ if (mDNSIsInitialized != 0) {
++ return 0;
++ }
++
++ mDNSPlatformMemZero( &mDNSStorage, sizeof(mDNSStorage));
++ mDNSPlatformMemZero( &platformSupport, sizeof(platformSupport));
++
++ err = mDNS_Init(
++ &mDNSStorage,
++ &platformSupport,
++ rrcachestorage,
++ RR_CACHE_SIZE,
++ mDNS_Init_AdvertiseLocalAddresses,
++ mDNS_Init_NoInitCallback,
++ mDNS_Init_NoInitCallbackContext
++ );
++ if (err)
++ return err;
++
++#ifdef WIN32
++ platformSupport.reportStatusFunc = embedded_mDNSInit_ReportStatus;
++ err = SetupInterfaceList( &mDNSStorage );
++ if (err)
++ return err;
++ err = uDNS_SetupDNSConfig( &mDNSStorage );
++#endif
++
++ if (err == 0) {
++ mDNSIsInitialized = 1;
++ }
++ return err;
++}
++
++mDNSexport void embedded_mDNSExit() {
++#ifdef WIN32
++ struct timeval tv;
++ tv.tv_sec = 0;
++ tv.tv_usec = 0;
++// mDNS_StartExit(&mDNSStorage);
++// embedded_mDNSmainLoop(tv);
++// mDNS_FinalExit(&mDNSStorage);
++#else
++ mDNS_Close(&mDNSStorage);
++#endif
++}
++
++#ifdef WIN32
++mDNSexport int embedded_mDNSmainLoop(struct timeval timeout) {
++ mDNS_Execute(&mDNSStorage);
++ mDNSPoll(100);
++// Sleep(100);
++ return 0;
++}
++
++#else
++
++// From /ExampleClientApp.c
++mDNSexport int embedded_mDNSmainLoop(struct timeval timeout) {
++ int nfds = 0;
++ fd_set readfds;
++ int result;
++
++ // 1. Set up the fd_set as usual here.
++ // This example client has no file descriptors of its own,
++ // but a real application would call FD_SET to add them to the set here
++ FD_ZERO(&readfds);
++
++ // 2. Set up the timeout.
++ // This example client has no other work it needs to be doing,
++ // so we set an effectively infinite timeout
++// timeout.tv_sec = 0x3FFFFFFF;
++// timeout.tv_usec = 0;
++
++ assert(timeout.tv_sec < 10);
++ // 3. Give the mDNSPosix layer a chance to add its information to the fd_set and timeout
++ mDNSPosixGetFDSet(&mDNSStorage, &nfds, &readfds, &timeout);
++
++ // 4. Call select as normal
++ result = select(nfds, &readfds, NULL, NULL, &timeout);
++
++ if (result > 0) {
++ // 5. Call mDNSPosixProcessFDSet to let the mDNSPosix layer do its work
++ mDNSPosixProcessFDSet(&mDNSStorage, &readfds);
++
++ // 6. This example client has no other work it needs to be doing,
++ // but a real client would do its work here
++ // ... (do work) ...
++ }
++ return result;
++}
++#endif
+diff -uPr mDNSResponder-333.10/mDNSCore.orig/mDnsEmbedded.h mDNSResponder-333.10/mDNSCore/mDnsEmbedded.h
+--- mDNSResponder-333.10/mDNSCore/mDnsEmbedded.h 1970-01-01 01:00:00.000000000 +0100
++++ mDNSResponder-333.10/mDNSCore/mDnsEmbedded.h 2013-06-01 13:00:29.000000000 +0100
+@@ -0,0 +1,32 @@
++/*
++ * Copyright (C) 2005-2013 Team XBMC
++ * http://www.xbmc.org
++ *
++ * This Program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * This Program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with XBMC; see the file COPYING. If not, see
++ * .
++ *
++ */
++
++#ifndef _MDNSEMBEDDED_H_
++#define _MDNSEMBEDDED_H_
++#ifdef __cplusplus
++ extern "C" {
++#endif
++extern int embedded_mDNSInit();
++extern void embedded_mDNSExit();
++extern int embedded_mDNSmainLoop(struct timeval timeout);
++#ifdef __cplusplus
++ }
++#endif
++#endif //_MDNSEMBEDDED_H_
diff --git a/xbmc/network/Makefile.in b/xbmc/network/Makefile.in
index c80651c4eb2ff..4593abe51cb3f 100644
--- a/xbmc/network/Makefile.in
+++ b/xbmc/network/Makefile.in
@@ -23,6 +23,11 @@ ifeq (@USE_AIRTUNES@, 1)
SRCS += AirTunesServer.cpp
endif
+ifeq (@USE_ANDROID@,1)
+SRCS += windows/ZeroconfBrowserWIN.cpp
+SRCS += windows/ZeroconfWIN.cpp
+endif
+
LIB = network.a
include @abs_top_srcdir@/Makefile.include
diff --git a/xbmc/network/Zeroconf.cpp b/xbmc/network/Zeroconf.cpp
index e2c30260add32..a3de61981b9fe 100644
--- a/xbmc/network/Zeroconf.cpp
+++ b/xbmc/network/Zeroconf.cpp
@@ -22,14 +22,14 @@
#include "Zeroconf.h"
#include "settings/Settings.h"
-#ifdef _LINUX
+#if defined(_LINUX) && !defined(TARGET_ANDROID)
#if !defined(TARGET_DARWIN)
#include "linux/ZeroconfAvahi.h"
#else
//on osx use the native implementation
#include "osx/ZeroconfOSX.h"
#endif
-#elif defined(TARGET_WINDOWS)
+#elif defined(TARGET_WINDOWS) || defined(TARGET_ANDROID)
#include "windows/ZeroconfWIN.h"
#endif
@@ -137,9 +137,9 @@ CZeroconf* CZeroconf::GetInstance()
#else
#if defined(TARGET_DARWIN)
smp_instance = new CZeroconfOSX;
-#elif defined(_LINUX)
+#elif defined(_LINUX) && !defined(TARGET_ANDROID)
smp_instance = new CZeroconfAvahi;
-#elif defined(TARGET_WINDOWS)
+#elif defined(TARGET_WINDOWS) || defined(TARGET_ANDROID)
smp_instance = new CZeroconfWIN;
#endif
#endif
diff --git a/xbmc/network/ZeroconfBrowser.cpp b/xbmc/network/ZeroconfBrowser.cpp
index de94b5973338b..d3fbbd1cc377e 100644
--- a/xbmc/network/ZeroconfBrowser.cpp
+++ b/xbmc/network/ZeroconfBrowser.cpp
@@ -22,14 +22,14 @@
#include
#include "utils/log.h"
-#ifdef _LINUX
+#if defined (_LINUX) && !defined(TARGET_ANDROID)
#if !defined(TARGET_DARWIN)
#include "linux/ZeroconfBrowserAvahi.h"
#else
//on osx use the native implementation
#include "osx/ZeroconfBrowserOSX.h"
#endif
-#elif defined(TARGET_WINDOWS)
+#elif defined(TARGET_WINDOWS) || defined(TARGET_ANDROID)
#include "windows/ZeroconfBrowserWIN.h"
#endif
@@ -158,9 +158,9 @@ CZeroconfBrowser* CZeroconfBrowser::GetInstance()
#else
#if defined(TARGET_DARWIN)
smp_instance = new CZeroconfBrowserOSX;
-#elif defined(_LINUX)
+#elif defined(_LINUX) && !defined(TARGET_ANDROID)
smp_instance = new CZeroconfBrowserAvahi;
-#elif defined(TARGET_WINDOWS)
+#elif defined(TARGET_WINDOWS) || defined(TARGET_ANDROID)
smp_instance = new CZeroconfBrowserWIN;
#endif
#endif
diff --git a/xbmc/network/windows/ZeroconfBrowserWIN.cpp b/xbmc/network/windows/ZeroconfBrowserWIN.cpp
index ce921f1dac999..a90a66e0e95c7 100644
--- a/xbmc/network/windows/ZeroconfBrowserWIN.cpp
+++ b/xbmc/network/windows/ZeroconfBrowserWIN.cpp
@@ -24,13 +24,16 @@
#include "guilib/GUIWindowManager.h"
#include "guilib/GUIMessage.h"
#include "GUIUserMessages.h"
+#if defined(TARGET_WINDOWS)
#include "win32/WIN32Util.h"
+#endif //TARGET_WINDOWS
#include "network/DNSNameCache.h"
#pragma comment(lib, "dnssd.lib")
extern HWND g_hWnd;
+
CZeroconfBrowserWIN::CZeroconfBrowserWIN()
{
m_browser = NULL;
@@ -43,7 +46,9 @@ CZeroconfBrowserWIN::~CZeroconfBrowserWIN()
for(tBrowserMap::iterator it = m_service_browsers.begin(); it != m_service_browsers.end(); ++it )
doRemoveServiceType(it->first);
+#if defined(TARGET_WINDOWS)
WSAAsyncSelect( (SOCKET) DNSServiceRefSockFD( m_browser ), g_hWnd, BONJOUR_BROWSER_EVENT, 0 );
+#endif //TARGET_WINDOWS
DNSServiceRefDeallocate(m_browser);
m_browser = NULL;
}
@@ -196,6 +201,7 @@ bool CZeroconfBrowserWIN::doAddServiceType(const CStdString& fcr_service_type)
if(m_browser == NULL)
{
+#if defined(TARGET_WINDOWS)
err = DNSServiceCreateConnection(&m_browser);
if (err != kDNSServiceErr_NoError)
{
@@ -205,6 +211,7 @@ bool CZeroconfBrowserWIN::doAddServiceType(const CStdString& fcr_service_type)
err = WSAAsyncSelect( (SOCKET) DNSServiceRefSockFD( m_browser ), g_hWnd, BONJOUR_BROWSER_EVENT, FD_READ | FD_CLOSE );
if (err != kDNSServiceErr_NoError)
CLog::Log(LOGERROR, "ZeroconfBrowserWIN: WSAAsyncSelect failed with error = %ld", (int) err);
+#endif //TARGET_WINDOWS
}
{
@@ -308,4 +315,4 @@ void CZeroconfBrowserWIN::ProcessResults()
DNSServiceErrorType err = DNSServiceProcessResult(m_browser);
if (err != kDNSServiceErr_NoError)
CLog::Log(LOGERROR, "ZeroconfWIN: DNSServiceProcessResult returned (error = %ld)", (int) err);
-}
\ No newline at end of file
+}
diff --git a/xbmc/network/windows/ZeroconfWIN.cpp b/xbmc/network/windows/ZeroconfWIN.cpp
index e84bc6eafb069..53a39d8e8cff8 100644
--- a/xbmc/network/windows/ZeroconfWIN.cpp
+++ b/xbmc/network/windows/ZeroconfWIN.cpp
@@ -26,26 +26,53 @@
#include
#include "dialogs/GUIDialogKaiToast.h"
#include "guilib/LocalizeStrings.h"
+#if defined(TARGET_WINDOWS)
#include "win32/WIN32Util.h"
+#else
+#include
+#endif //TARGET_WINDOWS
#pragma comment(lib, "dnssd.lib")
extern HWND g_hWnd;
-CZeroconfWIN::CZeroconfWIN()
+void CZeroconfWIN::Process()
+{
+#if defined(TARGET_ANDROID)
+ CLog::Log(LOGDEBUG, "ZeroconfEmbedded - processing...");
+ struct timeval timeout;
+ timeout.tv_sec = 1;
+ while (( !m_bStop ))
+ embedded_mDNSmainLoop(timeout);
+#endif //TARGET_ANDROID
+
+}
+
+
+CZeroconfWIN::CZeroconfWIN() : CThread("ZerocconfEmbedded")
{
m_service = NULL;
+#if defined(TARGET_ANDROID)
+ CLog::Log(LOGDEBUG, "ZeroconfBrowserThread started");
+ embedded_mDNSInit();
+ Create();
+#endif //TARGET_ANDROID
}
CZeroconfWIN::~CZeroconfWIN()
{
doStop();
+#if defined(TARGET_ANDROID)
+ CLog::Log(LOGDEBUG, "ZeroconfBrowserThread exited");
+ embedded_mDNSExit();
+#endif //TARGET_ANDROID
}
bool CZeroconfWIN::IsZCdaemonRunning()
{
uint32_t version;
uint32_t size = sizeof(version);
+#if defined(TARGET_WINDOWS)
DNSServiceErrorType err = DNSServiceGetProperty(kDNSServiceProperty_DaemonVersion, &version, &size);
if(err != kDNSServiceErr_NoError)
{
@@ -53,6 +80,7 @@ bool CZeroconfWIN::IsZCdaemonRunning()
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(34300), g_localizeStrings.Get(34301), 10000, true);
return false;
}
+#endif //TARGET_WINDOWS
CLog::Log(LOGDEBUG, "ZeroconfWIN:Bonjour version is %d.%d", version / 10000, version / 100 % 100);
return true;
}
@@ -71,7 +99,8 @@ bool CZeroconfWIN::doPublishService(const std::string& fcr_identifier,
if(m_service == NULL)
{
- err = DNSServiceCreateConnection(&m_service);
+#if defined(TARGET_WINDOWS)
+ err = DNSServicecCreateConnection(&m_service);
if (err != kDNSServiceErr_NoError)
{
CLog::Log(LOGERROR, "ZeroconfWIN: DNSServiceCreateConnection failed with error = %ld", (int) err);
@@ -80,6 +109,7 @@ bool CZeroconfWIN::doPublishService(const std::string& fcr_identifier,
err = WSAAsyncSelect( (SOCKET) DNSServiceRefSockFD( m_service ), g_hWnd, BONJOUR_EVENT, FD_READ | FD_CLOSE );
if (err != kDNSServiceErr_NoError)
CLog::Log(LOGERROR, "ZeroconfWIN: WSAAsyncSelect failed with error = %ld", (int) err);
+#endif //TARGET_WINDOWS
}
CLog::Log(LOGDEBUG, "ZeroconfWIN: identifier: %s type: %s name:%s port:%i", fcr_identifier.c_str(), fcr_type.c_str(), fcr_name.c_str(), f_port);
@@ -149,7 +179,10 @@ void CZeroconfWIN::doStop()
}
{
CSingleLock lock(m_data_guard);
+#if defined(TARGET_WINDOWS)
WSAAsyncSelect( (SOCKET) DNSServiceRefSockFD( m_service ), g_hWnd, BONJOUR_EVENT, 0 );
+#endif //TARGET_WINDOWS
+
DNSServiceRefDeallocate(m_service);
m_service = NULL;
}
@@ -180,4 +213,4 @@ void CZeroconfWIN::ProcessResults()
DNSServiceErrorType err = DNSServiceProcessResult(m_service);
if (err != kDNSServiceErr_NoError)
CLog::Log(LOGERROR, "ZeroconfWIN: DNSServiceProcessResult returned (error = %ld)", (int) err);
-}
\ No newline at end of file
+}
diff --git a/xbmc/network/windows/ZeroconfWIN.h b/xbmc/network/windows/ZeroconfWIN.h
index bea0079f2e5bd..461a07c0f897d 100644
--- a/xbmc/network/windows/ZeroconfWIN.h
+++ b/xbmc/network/windows/ZeroconfWIN.h
@@ -24,13 +24,17 @@
#include "network/Zeroconf.h"
#include "threads/CriticalSection.h"
#include
+#include "threads/Thread.h"
-class CZeroconfWIN : public CZeroconf
+class CZeroconfWIN : public CZeroconf,public CThread
{
public:
CZeroconfWIN();
~CZeroconfWIN();
+
protected:
+
+ void Process();
//implement base CZeroConf interface
bool doPublishService(const std::string& fcr_identifier,
const std::string& fcr_type,
diff --git a/xbmc/system.h b/xbmc/system.h
index 1bd0c98f51986..db76e2c42bd3a 100644
--- a/xbmc/system.h
+++ b/xbmc/system.h
@@ -239,6 +239,9 @@
#if defined(TARGET_ANDROID)
#undef HAS_LINUX_EVENTS
#undef HAS_LIRC
+#if defined(HAVE_LIBMDNSEMBEDDED)
+#define HAS_ZEROCONF
+#endif
#endif
// EGL detected. Dont use GLX!