Included --enable-android on configure script.
Build with that sample script:
#!/bin/sh
# Make sure you have TOOLCHAIN defined in .bashrc or .bash_profile and have linux/dvb headers in include dir.
SRC_DIR="`pwd`/tvheadend"
INCLUDE_DIR="`pwd`/out/include"
cd $SRC_DIR
export SYS_ROOT="$TOOLCHAIN/sysroot"
export CC="arm-linux-androideabi-gcc --sysroot=$SYS_ROOT -I$INCLUDE_DIR"
export CXX="arm-linux-androideabi-g++ --sysroot=$SYS_ROOT -I$INCLUDE_DIR"
export CPP="arm-linux-androideabi-cpp"
export LD="arm-linux-androideabi-ld"
export AR="arm-linux-androideabi-ar"
export RANLIB="arm-linux-androideabi-ranlib"
export STRIP="arm-linux-androideabi-strip"
export CROSSCOMPILE="arm-linux-androideabi-"
export CFLAGS="--sysroot=$SYS_ROOT -I$INCLUDE_DIR"
export CXXFLAGS="--sysroot=$SYS_ROOT -I$INCLUDE_DIR"
export LIBS="-lc -lgcc"
./configure --prefix=$SYS_ROOT/usr --arch=armv7 --platform=linux --disable-avahi --enable-bundle --python=/usr/bin/python --enable-android
make
TODO: change shm code to ashmem on tvhtime.c
CFLAGS += -fms-extensions -funsigned-char -fno-strict-aliasing
CFLAGS += -D_FILE_OFFSET_BITS=64
CFLAGS += -I${BUILDDIR} -I${ROOTDIR}/src -I${ROOTDIR}
+ifeq ($(CONFIG_ANDROID),yes)
+LDFLAGS += -ldl -lm
+else
LDFLAGS += -ldl -lpthread -lm
+endif
ifeq ($(CONFIG_LIBICONV),yes)
LDFLAGS += -liconv
endif
ifeq ($(PLATFORM), darwin)
LDFLAGS += -framework CoreServices
else
+ifeq ($(CONFIG_ANDROID),no)
LDFLAGS += -lrt
endif
+endif
ifeq ($(COMPILER), clang)
CFLAGS += -Wno-microsoft -Qunused-arguments -Wno-unused-function
"dvbcsa:no"
"kqueue:no"
"dbus_1:auto"
+ "android:no"
)
#
enable ssl
elif check_pkg openssl || check_pkg libssl; then
enable ssl
+elif check_cc_header 'openssl/ssl' ssl; then
+ enable ssl
else
die "SSL development support not found"
fi
res = send(fd, buf, len, MSG_DONTWAIT);
if (res < len) {
- tvhlog(LOG_DEBUG, "capmt", "Message send failed to socket %i (%zi)", fd, res);
+ tvhlog(LOG_DEBUG, "capmt", "Message send failed to socket %i (%li)", fd, res);
if (capmt->capmt_oscam != CAPMT_OSCAM_SO_WRAPPER) {
capmt_socket_close_lock(capmt, i);
return -1;
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
+#if ENABLE_ANDROID
+#include <sys/vfs.h>
+#define statvfs statfs
+#define fstatvfs fstatfs
+#else
#include <sys/statvfs.h>
+#endif
#include "settings.h"
#include <sys/time.h>
#include <limits.h>
#define SSL_OP_NO_COMPRESSION 0
#endif
+#if ENABLE_ANDROID
+#include <sys/socket.h>
+#endif
+
struct http_client_ssl {
int connected;
int shutdown;
#include <sys/socket.h>
#endif
+#if ENABLE_ANDROID
+#include <sys/socket.h>
+#endif
+
static void satip_device_discovery_start( void );
/*
#include <sys/socket.h>
#endif
+#if ENABLE_ANDROID
+#include <sys/socket.h>
+#endif
+
static int
satip_frontend_tune1
( satip_frontend_t *lfe, mpegts_mux_instance_t *mmi );
while (*s == ',')
s++;
while (strlen(s) > maxlen) {
- ptr = rindex(s, ',');
+ ptr = strrchr(s, ',');
if (ptr == NULL)
abort();
*ptr = '\0';
get_user_groups (const struct passwd *pw, gid_t* glist, size_t gmax)
{
int num = 0;
+#if !ENABLE_ANDROID
struct group *gr;
char **mem;
glist[num++] = pw->pw_gid;
if(!strcmp(*mem, pw->pw_name)) glist[num++] = gr->gr_gid;
}
}
+#endif
return num;
}
case MC_CACHE_DONTKEEP:
#if defined(PLATFORM_DARWIN)
fcntl(fd, F_NOCACHE, 1);
-#else
+#elseif !ENABLE_ANDROID
posix_fadvise(fd, pos, size, POSIX_FADV_DONTNEED);
#endif
break;
#include "file.h"
#include "spawn.h"
+#if ENABLE_ANDROID
+#define WIFCONTINUED(s) ((s) == 0xffff)
+#endif
+
extern char **environ;
pthread_mutex_t spawn_mutex = PTHREAD_MUTEX_INITIALIZER;
tvhlog(LOG_ERR, "timeshift", "ts %d could not read buffer", ts->id);
return -1;
}
- tvhtrace("timeshift", "ts %d read msg %p (%zd)",
+ tvhtrace("timeshift", "ts %d read msg %p (%ld)",
ts->id, *sm, r);
/* Incomplete */
#include <assert.h>
#include <unistd.h>
#include <limits.h>
-#if ENABLE_LOCKOWNER
+#if ENABLE_LOCKOWNER || ENABLE_ANDROID
#include <sys/syscall.h>
#endif
#define ERRNO_AGAIN(e) ((e) == EAGAIN || (e) == EINTR || (e) == EWOULDBLOCK)
+#if ENABLE_ANDROID
+#define S_IEXEC S_IXUSR
+#include <time64.h>
+// 32-bit Android has only timegm64() and not timegm().
+// We replicate the behaviour of timegm() when the result overflows time_t.
+static inline time_t timegm(struct tm* const t);
+time_t timegm(struct tm* const t) {
+ // time_t is signed on Android.
+ static const time_t kTimeMax = ~(1L << (sizeof(time_t) * CHAR_BIT - 1));
+ static const time_t kTimeMin = (1L << (sizeof(time_t) * CHAR_BIT - 1));
+ time64_t result = timegm64(t);
+ if (result < kTimeMin || result > kTimeMax)
+ return -1;
+ return result;
+}
+#endif
+
typedef struct {
const char *name;
const uint32_t *enabled;
#define __TVH_LOGGING_H__
#include <sys/types.h>
+#include "build.h"
+#if ENABLE_ANDROID
+#include <syslog.h>
+#else
#include <sys/syslog.h>
+#endif
#include <pthread.h>
#include <stdarg.h>
#include <time.h>
#include <sys/ipc.h>
-#include <sys/shm.h>
#include <sys/time.h>
#include <stdio.h>
#include <string.h>
#include "tvheadend.h"
#include "settings.h"
+#if !ENABLE_ANDROID
+#include <sys/shm.h>
+#endif
+
uint32_t tvhtime_update_enabled;
uint32_t tvhtime_ntp_enabled;
uint32_t tvhtime_tolerance;
#define NTPD_BASE 0x4e545030 /* "NTP0" */
#define NTPD_UNIT 2
+#if !ENABLE_ANDROID
typedef struct
{
int mode; /* 0 - if valid set
return shmptr;
}
+#endif
/*
* Update time
void
tvhtime_update ( struct tm *tm )
{
+#if !ENABLE_ANDROID
time_t now;
struct timeval tv;
ntp_shm_t *ntp_shm;
ntp_shm->count++;
ntp_shm->valid = 1;
}
+#endif
}
/* Initialise */
#include <sys/socket.h>
#endif
+#if ENABLE_ANDROID
+#include <sys/socket.h>
+#endif
+
int upnp_running;
static pthread_t upnp_tid;
pthread_mutex_t upnp_lock;
#include <sys/uio.h>
#endif
+#if ENABLE_ANDROID
+#include <sys/socket.h>
+#endif
+
static int webui_xspf;
/**