|
|
|
@ -241,7 +241,7 @@ void Java_org_videolan_vlc_LibVLC_detachSurface(JNIEnv *env, jobject thiz) { |
|
|
|
|
|
|
|
static void debug_log(void *data, int level, const char *fmt, va_list ap) |
|
|
|
{ |
|
|
|
(void)data; |
|
|
|
bool verbose = (bool)data; |
|
|
|
|
|
|
|
static const uint8_t priority[5] = { |
|
|
|
[LIBVLC_DEBUG] = ANDROID_LOG_DEBUG, |
|
|
|
@ -255,31 +255,39 @@ static void debug_log(void *data, int level, const char *fmt, va_list ap) |
|
|
|
if (level >= LIBVLC_DEBUG && level <= LIBVLC_ERROR) |
|
|
|
prio = priority[level]; |
|
|
|
|
|
|
|
if (!verbose && prio < ANDROID_LOG_ERROR) |
|
|
|
return; |
|
|
|
|
|
|
|
__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) |
|
|
|
void Java_org_videolan_vlc_LibVLC_changeVerbosity(JNIEnv *env, jobject thiz, jboolean verbose) |
|
|
|
{ |
|
|
|
libvlc_log_unsubscribe(&debug_subscriber); |
|
|
|
libvlc_log_subscribe(&debug_subscriber, debug_log, (void*)verbose); |
|
|
|
} |
|
|
|
|
|
|
|
void Java_org_videolan_vlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz, jboolean verbose) |
|
|
|
{ |
|
|
|
//only use OpenSLES if java side says we can
|
|
|
|
jclass cls = (*env)->GetObjectClass(env, 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); |
|
|
|
libvlc_log_subscribe(&debug_subscriber, debug_log, (void*)verbose); |
|
|
|
|
|
|
|
/* Don't add any invalid options, otherwise it causes LibVLC to crash */ |
|
|
|
const char *argv[] = { |
|
|
|
"-I", "dummy", |
|
|
|
"-vv", |
|
|
|
"--no-osd", |
|
|
|
"--no-video-title-show", |
|
|
|
"--no-stats", |
|
|
|
"--no-plugins-cache", |
|
|
|
"--no-drop-late-frames", |
|
|
|
"--avcodec-fast", |
|
|
|
use_opensles ? "--aout=opensles" : "--aout=android_audiotrack" |
|
|
|
use_opensles ? "--aout=opensles" : "--aout=android_audiotrack", |
|
|
|
}; |
|
|
|
libvlc_instance_t *instance = libvlc_new(sizeof(argv) / sizeof(*argv), argv); |
|
|
|
|
|
|
|
|