[Android] jni: add emitting module & type info

Edward Wang git at videolan.org
Sat May 25 17:53:59 CEST 2013


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Tue May 21 21:10:03 2013 -0400| [d6378b68151ae017a7676ee876b25d00c9c111e2] | committer: Edward Wang

jni: add emitting module & type info

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=d6378b68151ae017a7676ee876b25d00c9c111e2
---

 vlc-android/jni/libvlcjni.c |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index 77cb9a4..74e0f70 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -422,17 +422,24 @@ static void debug_log(void *data, int level, const libvlc_log_t *ctx, const char
     if (level >= LIBVLC_DEBUG && level <= LIBVLC_ERROR)
         prio = priority[level];
 
+    /* Quit if we are not doing anything */
+    if(!buffer_logging && (!(*verbose) && prio < ANDROID_LOG_ERROR))
+        return;
+
+    /* Add emitting module & type */
+    char* fmt2 = NULL;
+    if(asprintf(&fmt2, "%s %s: %s", ctx->psz_module, ctx->psz_object_type, fmt) < 0)
+        return;
+
     if (buffer_logging) {
         va_list aq;
         va_copy(aq, ap);
-        debug_buffer_log(data, level, fmt, aq);
+        debug_buffer_log(data, level, fmt2, aq);
         va_end(aq);
     }
 
-    if (!*verbose && prio < ANDROID_LOG_ERROR)
-        return;
-
-    __android_log_vprint(prio, "VLC", fmt, ap);
+    __android_log_vprint(prio, "VLC", fmt2, ap);
+    free(fmt2);
 }
 
 void Java_org_videolan_libvlc_LibVLC_startDebugBuffer(JNIEnv *env, jobject thiz)



More information about the Android mailing list