[vlc-devel] [PATCH 1/2] Android: push messages to the android log system

Jean-Baptiste Kempf jb at videolan.org
Thu Jun 2 14:06:17 CEST 2011


This is a port of the commit from Rémi Duraffort, that is now totally
incompatible.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
---
 src/misc/messages.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/src/misc/messages.c b/src/misc/messages.c
index 188d763..4e134e8 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -434,6 +434,11 @@ static void PrintMsg ( vlc_object_t *p_this, const msg_item_t *p_item )
 #   define GRAY    "\033[0m"
     static const char msgtype[4][9] = { "", " error", " warning", " debug" };
     static const char msgcolor[4][8] = { WHITE, RED, YELLOW, GRAY };
+#ifdef __ANDROID__
+#include <android/log.h>
+    android_LogPriority prioritytype[4] = {ANDROID_LOG_INFO, ANDROID_LOG_ERROR,
+                                           ANDROID_LOG_WARN, ANDROID_LOG_DEBUG };
+#endif
 
     libvlc_priv_t *priv = libvlc_priv (p_this->p_libvlc);
     int type = p_item->i_type;
@@ -469,8 +474,20 @@ static void PrintMsg ( vlc_object_t *p_this, const msg_item_t *p_item )
     fprintf (stream, priv->b_color ? "["GREEN"%p"GRAY"] " : "[%p] ",
             (void *)p_item->i_object_id);
     if (p_item->psz_header != NULL)
+    {
+#ifdef __ANDROID__
+        __android_log_print (prioritytype[type], "vlc", "[%s] ", p_item->psz_header);
+#else
         utf8_fprintf (stream, "[%s] ", p_item->psz_header);
-    utf8_fprintf (stream, "%s %s%s: ", p_item->psz_module, objtype,
+#endif
+    }
+
+#ifdef __ANDROID__
+    __android_log_print (prioritytype[type], "vlc",
+#else
+    utf8_fprintf (stream,
+#endif
+                  "%s %s%s: ", p_item->psz_module, objtype,
                   msgtype[type]);
     if (priv->b_color)
         fputs (msgcolor[type], stream);
-- 
1.7.5.3




More information about the vlc-devel mailing list