Skip to content

Commit

Permalink
Bring forward Android changes from Jarvis baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
djp952 committed Feb 26, 2017
1 parent 12b735e commit 3e8357e
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
```
Expand Down
3 changes: 2 additions & 1 deletion msbuild.proj
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@

<!-- android-arm -->
<!-- android-aarch64 -->
<Exec Command="..\android-ndk-r12b\ndk-build.cmd NDK_APPLICATION_MK=Application.mk NDK_PROJECT_PATH=. NDK_OUT=out NDK_LIBS_OUT=out" ContinueOnError="false"/>
<!-- android-x86 -->
<Exec Command="&quot;%ANDROID_NDK_ROOT%\ndk-build.cmd&quot; NDK_APPLICATION_MK=Application.mk NDK_PROJECT_PATH=. NDK_OUT=out NDK_LIBS_OUT=out" ContinueOnError="false"/>

</Target>

Expand Down
1 change: 1 addition & 0 deletions pvr.hdhomerundvr/addon-android.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pvr.hdhomerundvr/addon-linux.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pvr.hdhomerundvr/addon-windows.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions src/addoncallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 19 additions & 2 deletions src/pvr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#include <type_traits>
#include <vector>

#ifdef __ANDROID__
#include <android/log.h>
#endif

#include <version.h>
#include <xbmc_pvr_dll.h>

Expand Down Expand Up @@ -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
Expand All @@ -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();
}

Expand Down
10 changes: 6 additions & 4 deletions src/pvrcallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3e8357e

Please sign in to comment.