Commit 16a2b640 authored by Rafaël Carré's avatar Rafaël Carré

Use libvlc_log_*() instead of logger module

parent 5bd310eb
......@@ -36,7 +36,7 @@ $(VLC_APK): $(LIBVLCJNI) $(JAVA_SOURCES)
@echo
$(VERBOSE)cd $(SRC) && ant $(ANT_OPTS) debug
VLC_MODULES=`find $(VLC_BUILD_DIR)/modules -name 'lib*_plugin.a'|grep -v -E "stats|access_bd|oldrc|real|hotkeys|gestures|sap|dynamicoverlay|rss|libball|bargraph|clone|access_shm|mosaic|imem|osdmenu|puzzle|mediadirs|t140|ripple|motion|sharpen|grain|posterize|mirror|wall|scene|blendbench|psychedelic|alphamask|netsync|audioscrobbler|imem|motiondetect|export|smf|podcast|bluescreen|erase|record|speex_resampler|remoteosd|magnify|gradient|spdif|dtstofloat32" | tr \\\\n \ `
VLC_MODULES=`find $(VLC_BUILD_DIR)/modules -name 'lib*_plugin.a'|grep -v -E "stats|access_bd|oldrc|real|hotkeys|gestures|sap|dynamicoverlay|rss|libball|bargraph|clone|access_shm|mosaic|imem|osdmenu|puzzle|mediadirs|t140|ripple|motion|sharpen|grain|posterize|mirror|wall|scene|blendbench|psychedelic|alphamask|netsync|audioscrobbler|imem|motiondetect|export|smf|podcast|bluescreen|erase|record|speex_resampler|remoteosd|magnify|gradient|spdif|dtstofloat32|logger" | tr \\\\n \ `
$(LIBVLCJNI_H):
$(VERBOSE)if [ -z "$(VLC_BUILD_DIR)" ]; then echo "VLC_BUILD_DIR not defined" ; exit 1; fi
......
......@@ -222,6 +222,27 @@ void Java_org_videolan_vlc_LibVLC_detachSurface(JNIEnv *env, jobject thiz) {
pthread_mutex_unlock(&vout_android_lock);
}
static void debug_log(void *data, int level, const char *fmt, va_list ap)
{
(void)data;
static const uint8_t priority[5] = {
[LIBVLC_DEBUG] = ANDROID_LOG_DEBUG,
[1 /* ??? */] = ANDROID_LOG_DEBUG,
[LIBVLC_NOTICE] = ANDROID_LOG_INFO,
[LIBVLC_WARNING] = ANDROID_LOG_WARN,
[LIBVLC_ERROR] = ANDROID_LOG_ERROR,
};
int prio = ANDROID_LOG_DEBUG;
if (level >= LIBVLC_DEBUG && level <= LIBVLC_ERROR)
prio = priority[level];
__android_log_vprint(prio, "VLC", fmt, ap);
}
static libvlc_log_subscriber_t debug_subscriber;
void Java_org_videolan_vlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
{
//only use OpenSLES if java side says we can
......@@ -229,6 +250,8 @@ void Java_org_videolan_vlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
jmethodID methodId = (*env)->GetMethodID(env, cls, "getAout", "()I");
bool use_opensles = (*env)->CallIntMethod(env, thiz, methodId) == AOUT_OPENSLES;
libvlc_log_subscribe(&debug_subscriber, debug_log, NULL);
/* Don't add any invalid options, otherwise it causes LibVLC to crash */
const char *argv[] = {
"-I", "dummy",
......@@ -238,8 +261,6 @@ void Java_org_videolan_vlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
"--no-stats",
"--no-plugins-cache",
"--no-drop-late-frames",
"--control", "logger",
"--logmode", "android",
"--ffmpeg-fast",
use_opensles ? "--aout=opensles" : "--aout=android_audiotrack"
};
......@@ -284,6 +305,7 @@ void Java_org_videolan_vlc_LibVLC_nativeDestroy(JNIEnv *env, jobject thiz)
libvlc_instance_t *instance = (libvlc_instance_t*) libVlcInstance;
libvlc_release(instance);
libvlc_log_unsubscribe(&debug_subscriber);
(*env)->SetIntField(env, thiz, field, 0);
}
......
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