Commit 724acaa9 authored by Rafaël Carré's avatar Rafaël Carré

update patches

parent f8ab16ff
From e7712a61b2dda5e2675bd0b892e94e60498ee2e5 Mon Sep 17 00:00:00 2001
From cd075d698fe8b680984b299844a705bca1923785 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Philippe=20Andr=C3=A9?= <jpeg@videolan.org>
Date: Thu, 2 Jun 2011 15:15:57 +0200
Subject: [PATCH 1/7] Android: add compatibility pthread_cancel
Subject: [PATCH 1/2] Android: add compatibility pthread_cancel
Original-code: c1ee19f63a6c6773400e98a9265b0a7e49fd528c
7884ed8d407647a1523afb8be6a2859477d54fd7
......@@ -15,11 +15,11 @@ Modified and ported-by: Jean-Baptiste Kempf <jb@videolan.org>
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
---
compat/pthread_cancel.c | 291 +++++++++++++++++++++++++++++++++++++++++++++++
configure.ac | 4 +
configure.ac | 5 +
include/vlc_fixups.h | 22 ++++
lib/error.c | 16 +++
src/posix/thread.c | 21 ++++
5 files changed, 354 insertions(+), 0 deletions(-)
src/posix/thread.c | 37 ++++++-
5 files changed, 367 insertions(+), 4 deletions(-)
create mode 100644 compat/pthread_cancel.c
diff --git a/compat/pthread_cancel.c b/compat/pthread_cancel.c
......@@ -320,25 +320,26 @@ index 0000000..8a39f5d
+ return ret;
+}
diff --git a/configure.ac b/configure.ac
index 27bb143..e61f372 100644
index 52d8cf7..e72a05c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -469,6 +469,10 @@ if test "${SYS}" = "mingw32" ; then
CFLAGS="${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
@@ -446,6 +446,11 @@ if test "${SYS}" = "mingw32" ; then
fi
fi
+if test "${HAVE_ANDROID}" = "1"; then
+ AC_REPLACE_FUNCS([pthread_cancel])
+ VLC_ADD_LIBS([libvlccore],[-llog])
+fi
+
dnl
dnl Buggy glibc prevention. Purposedly not cached.
dnl See sourceware.org bugs 5058 and 5443.
diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index e0152fc..0d63194 100644
index b5884f4..227658a 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -339,6 +339,28 @@ long nrand48 (unsigned short subi[3]);
@@ -338,6 +338,28 @@ long nrand48 (unsigned short subi[3]);
# undef __cplusplus
# endif
char *tempnam(const char *, const char *);
......@@ -409,10 +410,54 @@ index ef2ecdc..441953c 100644
vlc_mutex_unlock (&lock);
}
diff --git a/src/posix/thread.c b/src/posix/thread.c
index 122e201..9d9c771 100644
index 7c4860e..94b1a73 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -435,7 +435,11 @@ void vlc_cond_broadcast (vlc_cond_t *p_condvar)
@@ -136,6 +136,14 @@ static struct timespec mtime_to_ts (mtime_t date)
return ts;
}
+#if defined(__ANDROID__) && !defined(NDEBUG)
+# include <android/log.h>
+# define LOG_TAG "VLC/pthread"
+# define FATAL(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
+#else
+# define FATAL(...) fprintf(stderr, __VA_ARGS__)
+#endif
+
/**
* Print a backtrace to the standard error for debugging purpose.
*/
@@ -176,8 +184,8 @@ vlc_thread_fatal (const char *action, int error,
const char *function, const char *file, unsigned line)
{
int canc = vlc_savecancel ();
- fprintf (stderr, "LibVLC fatal error %s (%d) in thread %lu ",
- action, error, vlc_threadid ());
+ FATAL ("LibVLC fatal error %s (%d) in thread %lu ",
+ action, error, vlc_threadid ());
vlc_trace (function, file, line);
/* Sometimes strerror_r() crashes too, so make sure we print an error
@@ -185,7 +193,7 @@ vlc_thread_fatal (const char *action, int error,
#ifdef __GLIBC__
/* Avoid the strerror_r() prototype brain damage in glibc */
errno = error;
- fprintf (stderr, " Error message: %m\n");
+ FATAL (" Error message: %m\n");
#else
char buf[1000];
const char *msg;
@@ -202,7 +210,7 @@ vlc_thread_fatal (const char *action, int error,
msg = "unknown (invalid error number)";
break;
}
- fprintf (stderr, " Error message: %s\n", msg);
+ FATAL (" Error message: %s\n", msg);
#endif
fflush (stderr);
@@ -435,7 +443,11 @@ void vlc_cond_broadcast (vlc_cond_t *p_condvar)
*/
void vlc_cond_wait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
{
......@@ -424,9 +469,9 @@ index 122e201..9d9c771 100644
VLC_THREAD_ASSERT ("waiting on condition");
}
@@ -472,7 +476,12 @@ int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
#endif
@@ -458,7 +470,12 @@ int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
mtime_t deadline)
{
struct timespec ts = mtime_to_ts (deadline);
+
+#ifdef __ANDROID__
......@@ -437,7 +482,7 @@ index 122e201..9d9c771 100644
if (val != ETIMEDOUT)
VLC_THREAD_ASSERT ("timed-waiting on condition");
return val;
@@ -511,6 +520,14 @@ void vlc_sem_destroy (vlc_sem_t *sem)
@@ -497,6 +514,14 @@ void vlc_sem_destroy (vlc_sem_t *sem)
val = errno;
#endif
......@@ -452,7 +497,7 @@ index 122e201..9d9c771 100644
VLC_THREAD_ASSERT ("destroying semaphore");
}
@@ -741,7 +758,11 @@ static int vlc_clone_attr (vlc_thread_t *th, pthread_attr_t *attr,
@@ -727,7 +752,11 @@ static int vlc_clone_attr (vlc_thread_t *th, pthread_attr_t *attr,
assert (ret == 0); /* fails iif VLC_STACKSIZE is invalid */
#endif
......@@ -465,5 +510,5 @@ index 122e201..9d9c771 100644
pthread_attr_destroy (attr);
return ret;
--
1.7.5.4
1.7.8.3
From 73cb72d834c6cd2cde2a56c0add8542453eca1f3 Mon Sep 17 00:00:00 2001
From a00dc86ddff76c50791962b8c1981140ff0b8bac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Duraffort?= <ivoire@videolan.org>
Date: Sun, 7 Nov 2010 19:11:51 +0100
Subject: [PATCH 6/7] Implement rw_locks, needed for Android 2.2 and below
Subject: [PATCH 2/2] Implement rw_locks, needed for Android 2.2 and below
---
include/vlc_threads.h | 22 ++++++++++++++
......@@ -44,10 +44,10 @@ index 7a6c6af..181f273 100644
typedef struct vlc_timer *vlc_timer_t;
diff --git a/src/posix/thread.c b/src/posix/thread.c
index d8a442b..dd5b2fd 100644
index 94b1a73..d7438a4 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -587,6 +587,7 @@ void vlc_sem_wait (vlc_sem_t *sem)
@@ -573,6 +573,7 @@ void vlc_sem_wait (vlc_sem_t *sem)
VLC_THREAD_ASSERT ("locking semaphore");
}
......@@ -55,7 +55,7 @@ index d8a442b..dd5b2fd 100644
/**
* Initializes a read/write lock.
*/
@@ -631,6 +632,81 @@ void vlc_rwlock_unlock (vlc_rwlock_t *lock)
@@ -617,6 +618,81 @@ void vlc_rwlock_unlock (vlc_rwlock_t *lock)
int val = pthread_rwlock_unlock (lock);
VLC_THREAD_ASSERT ("releasing R/W lock");
}
......@@ -138,5 +138,5 @@ index d8a442b..dd5b2fd 100644
/**
* Allocates a thread-specific variable.
--
1.7.5.4
1.7.8.3
From 5e1faeb801e3eec6e2876021202289a5a149e2a1 Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Kempf <jb@videolan.org>
Date: Sun, 31 Jul 2011 00:20:40 +0200
Subject: [PATCH 3/7] Push messages to Android stack
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
---
configure.ac | 1 +
src/misc/messages.c | 7 +++++++
src/posix/thread.c | 16 ++++++++++++----
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index e61f372..90de262 100644
--- a/configure.ac
+++ b/configure.ac
@@ -471,6 +471,7 @@ fi
if test "${HAVE_ANDROID}" = "1"; then
AC_REPLACE_FUNCS([pthread_cancel])
+ VLC_ADD_LIBS([libvlccore],[-llog])
fi
dnl
diff --git a/src/misc/messages.c b/src/misc/messages.c
index 61080c0..f92d4c0 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -224,10 +224,17 @@ void vlc_vaLog (vlc_object_t *obj, int type, const char *module,
va_list ap;
va_copy (ap, args);
+#ifdef __ANDROID__
+#include <android/log.h>
+ android_LogPriority prioritytype[4] = {ANDROID_LOG_INFO, ANDROID_LOG_ERROR,
+ ANDROID_LOG_WARN, ANDROID_LOG_DEBUG };
+ __android_log_vprint(prioritytype[type], "vlc", format, ap);
+#else
if (priv->b_color)
PrintColorMsg (&priv->i_verbose, type, &msg, format, ap);
else
PrintMsg (&priv->i_verbose, type, &msg, format, ap);
+#endif
va_end (ap);
vlc_rwlock_rdlock (&msg_lock);
diff --git a/src/posix/thread.c b/src/posix/thread.c
index 9d9c771..d8a442b 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -136,6 +136,14 @@ static struct timespec mtime_to_ts (mtime_t date)
return ts;
}
+#if defined(__ANDROID__) && !defined(NDEBUG)
+# include <android/log.h>
+# define LOG_TAG "VLC/pthread"
+# define FATAL(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
+#else
+# define FATAL(...) fprintf(stderr, __VA_ARGS__)
+#endif
+
/**
* Print a backtrace to the standard error for debugging purpose.
*/
@@ -176,8 +184,8 @@ vlc_thread_fatal (const char *action, int error,
const char *function, const char *file, unsigned line)
{
int canc = vlc_savecancel ();
- fprintf (stderr, "LibVLC fatal error %s (%d) in thread %lu ",
- action, error, vlc_threadid ());
+ FATAL ("LibVLC fatal error %s (%d) in thread %lu ",
+ action, error, vlc_threadid ());
vlc_trace (function, file, line);
/* Sometimes strerror_r() crashes too, so make sure we print an error
@@ -185,7 +193,7 @@ vlc_thread_fatal (const char *action, int error,
#ifdef __GLIBC__
/* Avoid the strerror_r() prototype brain damage in glibc */
errno = error;
- fprintf (stderr, " Error message: %m\n");
+ FATAL (" Error message: %m\n");
#else
char buf[1000];
const char *msg;
@@ -202,7 +210,7 @@ vlc_thread_fatal (const char *action, int error,
msg = "unknown (invalid error number)";
break;
}
- fprintf (stderr, " Error message: %s\n", msg);
+ FATAL (" Error message: %s\n", msg);
#endif
fflush (stderr);
--
1.7.5.4
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment