diff --git a/Android.mk b/Android.mk
index 067d2cb4..81bfdf95 100644
--- a/Android.mk
+++ b/Android.mk
@@ -92,9 +92,9 @@ LOCAL_STATIC_LIBRARIES += \
libcrypto-prebuilt \
libz-prebuilt
-LOCAL_LD_LIBS += \
- -ldl -lpthread
-
+LOCAL_LDLIBS += \
+ -llog
+
LOCAL_SRC_FILES := \
../external-sqlite/sqlite3.c \
src/addoncallbacks.cpp \
diff --git a/README.md b/README.md
index 9f8218fd..e83ec289 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,7 @@ Copyright (C)2017 Michael G. Brehm
* Windows 10 x64 15025
* Visual Studio 2015 (with Git for Windows)
* Bash on Ubuntu on Windows 16.04.1 LTS
+* Android NDK r12b for Windows 64-bit
**CONFIGURE BASH ON UBUNTU ON WINDOWS**
Open "Bash on Ubuntu on Windows"
@@ -22,6 +23,20 @@ sudo apt-get update
sudo apt-get install gcc g++ gcc-multilib g++-multilib gcc-4.9 g++-4.9 gcc-4.9-multilib g++-4.9-multilib
```
+**CONFIGURE ANDROID NDK**
+Download the Android NDK r12b for Windows 64-bit:
+[https://dl.google.com/android/repository/android-ndk-r12b-windows-x86_64.zip](https://dl.google.com/android/repository/android-ndk-r12b-windows-x86_64.zip)
+
+* Extract the contents of the .zip file somewhere
+* Set a System Environment Variable named ANDROID_NDK_ROOT that points to the extraction location (android-ndk-r12b)
+* Optionally, ANDROID_NDK_ROOT can also be set on the command line prior to executing msbuild:
+```
+...
+set ANDROID_NDK_ROOT=D:\android-ndk-r12b
+msbuild msbuild.proj
+...
+```
+
**BUILD**
Open "Developer Command Prompt for VS2015"
```
diff --git a/msbuild.proj b/msbuild.proj
index a421a8b2..c8c41e20 100644
--- a/msbuild.proj
+++ b/msbuild.proj
@@ -84,7 +84,8 @@
-
+
+
diff --git a/pvr.hdhomerundvr/addon-android.xml b/pvr.hdhomerundvr/addon-android.xml
index 457eac9a..898cfd90 100644
--- a/pvr.hdhomerundvr/addon-android.xml
+++ b/pvr.hdhomerundvr/addon-android.xml
@@ -12,6 +12,7 @@ v1.0.2
- Add option to enable discovery of extended (8 hour) Electronic Program Guide data
- Update SQLite database engine to v3.17.0
- (Linux) Switch to statically linked OpenSSL (1.0.2k) and zlib (1.2.8) libraries for better system compatibility
+ - (Android) Initial release for Android ARM, ARM64 and x86 devices. Experimental with known issues -- see documentation (https://github.com/djp952/pvr.hdhomerundvr/wiki)
v1.0.1
- Fix minor problem with one database table not being truncated at startup
diff --git a/pvr.hdhomerundvr/addon-linux.xml b/pvr.hdhomerundvr/addon-linux.xml
index a319d523..ca03d575 100644
--- a/pvr.hdhomerundvr/addon-linux.xml
+++ b/pvr.hdhomerundvr/addon-linux.xml
@@ -12,6 +12,7 @@ v1.0.2
- Add option to enable discovery of extended (8 hour) Electronic Program Guide data
- Update SQLite database engine to v3.17.0
- (Linux) Switch to statically linked OpenSSL (1.0.2k) and zlib (1.2.8) libraries for better system compatibility
+ - (Android) Initial release for Android ARM, ARM64 and x86 devices. Experimental with known issues -- see documentation (https://github.com/djp952/pvr.hdhomerundvr/wiki)
v1.0.1
- Fix minor problem with one database table not being truncated at startup
diff --git a/pvr.hdhomerundvr/addon-windows.xml b/pvr.hdhomerundvr/addon-windows.xml
index 04e07ce2..eb75dfe9 100644
--- a/pvr.hdhomerundvr/addon-windows.xml
+++ b/pvr.hdhomerundvr/addon-windows.xml
@@ -12,6 +12,7 @@ v1.0.2
- Add option to enable discovery of extended (8 hour) Electronic Program Guide data
- Update SQLite database engine to v3.17.0
- (Linux) Switch to statically linked OpenSSL (1.0.2k) and zlib (1.2.8) libraries for better system compatibility
+ - (Android) Initial release for Android ARM, ARM64 and x86 devices. Experimental with known issues -- see documentation (https://github.com/djp952/pvr.hdhomerundvr/wiki)
v1.0.1
- Fix minor problem with one database table not being truncated at startup
diff --git a/src/addoncallbacks.cpp b/src/addoncallbacks.cpp
index a5505188..d06f9303 100644
--- a/src/addoncallbacks.cpp
+++ b/src/addoncallbacks.cpp
@@ -35,16 +35,18 @@
// Macro indicating the location of the libXBMC_addon module, which is architecture-specific
#if defined(_WINDOWS)
#define LIBXBMC_ADDON_MODULE "\\library.xbmc.addon\\libXBMC_addon.dll"
-#elif defined(__x86_64__)
+#elif defined(__x86_64__) && !defined(__ANDROID__)
#define LIBXBMC_ADDON_MODULE "/library.xbmc.addon/libXBMC_addon-x86_64-linux.so"
-#elif defined(__i386__)
+#elif defined(__i386__) && !defined(__ANDROID__)
#define LIBXBMC_ADDON_MODULE "/library.xbmc.addon/libXBMC_addon-i486-linux.so"
-#elif defined(__ANDROID__) && (defined __ARMEL__)
+#elif defined(__ANDROID__) && defined(__arm__)
#define LIBXBMC_ADDON_MODULE "/libXBMC_addon-arm.so"
#elif defined(__ANDROID__) && (defined __aarch64__)
#define LIBXBMC_ADDON_MODULE "/libXBMC_addon-aarch64.so"
+#elif defined(__ANDROID__) && defined(__i386__)
+#define LIBXBMC_ADDON_MODULE "/libXBMC_addon-i486-linux.so"
#else
-#error addoncallbacks.cpp -- unknown architecture -- only win32, linux-i686, linux-x86_64, android-armeabi-v7a and android-arm64-v8a are supported
+#error addoncallbacks.cpp -- unknown architecture -- only win32, linux-i686, linux-x86_64, android-armeabi-v7a, android-arm64-v8a and android-x86 are supported
#endif
// GetFunctionPointer (local)
diff --git a/src/pvr.cpp b/src/pvr.cpp
index 335a1baa..b99f1da3 100644
--- a/src/pvr.cpp
+++ b/src/pvr.cpp
@@ -35,6 +35,10 @@
#include
#include
+#ifdef __ANDROID__
+#include
+#endif
+
#include
#include
@@ -858,7 +862,20 @@ static void log_message(addoncallbacks::addon_log_t level, _args&&... args)
(void)unpack;
if(g_addon) g_addon->Log(level, stream.str().c_str());
- if (level == addoncallbacks::addon_log_t::LOG_ERROR) fprintf(stderr, "ERROR: %s\r\n", stream.str().c_str());
+
+ // Write LOG_ERROR level messages to an appropriate secondary log mechanism
+ if(level == addoncallbacks::addon_log_t::LOG_ERROR) {
+
+#ifdef _WINDOWS
+ std::string message = "ERROR: " + stream.str() + "\r\n";
+ OutputDebugStringA(message.c_str());
+#elif __ANDROID__
+ __android_log_print(ANDROID_LOG_ERROR, VERSION_PRODUCTNAME_ANSI, "ERROR: %s\n", stream.str().c_str());
+#else
+ fprintf(stderr, "ERROR: %s\r\n", stream.str().c_str());
+#endif
+
+ }
}
// log_notice
@@ -883,7 +900,7 @@ unsigned long openssl_id_callback(void)
// OpenSSL locking function callback
void openssl_locking_callback(int mode, int n, char const* /*file*/, int /*line*/)
{
- if ((mode & CRYPTO_LOCK) == CRYPTO_LOCK) g_openssl_locks[n].lock();
+ if((mode & CRYPTO_LOCK) == CRYPTO_LOCK) g_openssl_locks[n].lock();
else g_openssl_locks[n].unlock();
}
diff --git a/src/pvrcallbacks.cpp b/src/pvrcallbacks.cpp
index da8ac2cd..4ea49ccd 100644
--- a/src/pvrcallbacks.cpp
+++ b/src/pvrcallbacks.cpp
@@ -35,16 +35,18 @@
// Macro indicating the location of the libXBMC_pvr module, which is architecture-specific
#if defined(_WINDOWS)
#define LIBXBMC_PVR_MODULE "\\library.xbmc.pvr\\libXBMC_pvr.dll"
-#elif defined(__x86_64__)
+#elif defined(__x86_64__) && !defined(__ANDROID__)
#define LIBXBMC_PVR_MODULE "/library.xbmc.pvr/libXBMC_pvr-x86_64-linux.so"
-#elif defined(__i386__)
+#elif defined(__i386__) && !defined(__ANDROID__)
#define LIBXBMC_PVR_MODULE "/library.xbmc.pvr/libXBMC_pvr-i486-linux.so"
-#elif defined(__ANDROID__) && (defined __ARMEL__)
+#elif defined(__ANDROID__) && defined(__arm__)
#define LIBXBMC_PVR_MODULE "/libXBMC_pvr-arm.so"
#elif defined(__ANDROID__) && (defined __aarch64__)
#define LIBXBMC_PVR_MODULE "/libXBMC_pvr-aarch64.so"
+#elif defined(__ANDROID__) && defined(__i386__)
+#define LIBXBMC_PVR_MODULE "/libXBMC_pvr-i486-linux.so"
#else
-#error pvrcallbacks.cpp -- unknown architecture -- only win32, linux-i686, linux-x86_64, android-armeabi-v7a and android-arm64-v8a are supported
+#error pvrcallbacks.cpp -- unknown architecture -- only win32, linux-i686, linux-x86_64, android-armeabi-v7a, android-arm64-v8a and android-x86 are supported
#endif
// GetFunctionPointer (local)