res = send(fd, buf, len, MSG_DONTWAIT);
if (res < len) {
#if ENABLE_ANDROID
- tvhlog(LOG_DEBUG, "capmt", "%s: Message send failed to socket %i (%li)", capmt_name(capmt), fd, res); // Android bug, ssize_t is long int
+ tvhlog(LOG_DEBUG, "capmt", "%s: Message send failed to socket %i (%li)", capmt_name(capmt), fd, (long int)res); // Android bug, ssize_t is long int
#else
tvhlog(LOG_DEBUG, "capmt", "%s: Message send failed to socket %i (%zi)", capmt_name(capmt), fd, res);
#endif
#include <sys/stat.h>
#include <libgen.h> /* basename */
-#if ENABLE_ANDROID
-#include <sys/vfs.h>
-#define statvfs statfs
-#define fstatvfs fstatfs
-#else
-#include <sys/statvfs.h>
-#endif
-
#include "htsstr.h"
#include "tvheadend.h"
#include "muxer.h"
+#if ENABLE_ANDROID
+#include <sys/vfs.h>
+#define statvfs statfs
+#define fstatvfs fstatfs
+#else
+#include <sys/statvfs.h>
+#endif
+
/**
*
*/
#include "notify.h"
#include "channels.h"
+#if ENABLE_ANDROID
+#include <sys/socket.h>
+#endif
+
void *http_server;
static http_path_list_t http_paths;
#include "iptv_private.h"
#include "iptv_rtcp.h"
#include "http.h"
+#if ENABLE_ANDROID
+#include <sys/socket.h>
+#endif
typedef struct {
http_client_t *hc;
#include <assert.h>
static void mpegts_mux_scan_timeout ( void *p );
-
/* ****************************************************************************
* Mux instance (input linkage)
* ***************************************************************************/
#include "input.h"
#include "streaming.h"
#include "satip/server.h"
+#if ENABLE_ANDROID
+#include <sys/socket.h>
+#endif
#define RTP_PACKETS 128
#define RTP_PAYLOAD (7*188+12)
if (tsf->rfd < 0)
return -1;
}
- tvhtrace("timeshift", "ts %d seek to %jd (fd %i)", ts->id, tsf->roff, tsf->rfd);
+ tvhtrace("timeshift", "ts %d seek to %jd (fd %i)", ts->id, (intmax_t)tsf->roff, tsf->rfd);
if (tsf->rfd >= 0)
if ((off = lseek(tsf->rfd, tsf->roff, SEEK_SET)) != tsf->roff)
tvherror("timeshift", "seek to %s failed (off %"PRId64" != %"PRId64"): %s",
return -1;
}
#if ENABLE_ANDROID
- tvhtrace("timeshift", "ts %d read msg %p (%ld)", ts->id, *sm, r); // Android bug, ssize_t is long int
+ tvhtrace("timeshift", "ts %d read msg %p (%ld)", ts->id, *sm, (long int)r); // Android bug, ssize_t is long int
#else
tvhtrace("timeshift", "ts %d read msg %p (%zd)", ts->id, *sm, r);
#endif
/* Incomplete */
if (r == 0) {
if (tsf->rfd >= 0) {
- tvhtrace("timeshift", "ts %d seek to %jd (fd %i) (incomplete)", ts->id, tsf->roff, tsf->rfd);
+ tvhtrace("timeshift", "ts %d seek to %jd (fd %i) (incomplete)", ts->id, (intmax_t)tsf->roff, tsf->rfd);
if ((off = lseek(tsf->rfd, ooff, SEEK_SET)) != ooff)
tvherror("timeshift", "seek to %s failed (off %"PRId64" != %"PRId64"): %s",
tsf->path, (int64_t)ooff, (int64_t)off, strerror(errno));
#if ENABLE_ANDROID
#define S_IEXEC S_IXUSR
+#define epoll_create1(EPOLL_CLOEXEC) epoll_create(n)
+#define inotify_init1(IN_CLOEXEC) inotify_init()
#include <time64.h>
// 32-bit Android has only timegm64() and not timegm().
// We replicate the behaviour of timegm() when the result overflows time_t.
#include <pthread_np.h>
#endif
+#if ENABLE_ANDROID
+int
+pthread_mutex_timedlock
+ ( pthread_mutex_t *mutex, struct timespec *timeout )
+{
+ struct timeval timenow;
+ struct timespec sleepytime;
+ int retcode;
+
+ /* This is just to avoid a completely busy wait */
+ sleepytime.tv_sec = 0;
+ sleepytime.tv_nsec = 10000000; /* 10ms */
+
+ while ((retcode = pthread_mutex_trylock (mutex)) == EBUSY) {
+ gettimeofday (&timenow, NULL);
+
+ if (timenow.tv_sec >= timeout->tv_sec &&
+ (timenow.tv_usec * 1000) >= timeout->tv_nsec)
+ return ETIMEDOUT;
+
+ nanosleep (&sleepytime, NULL);
+ }
+
+ return retcode;
+}
+#endif
+
int
tvh_open(const char *pathname, int flags, mode_t mode)
{