<div dir="ltr"><div><div><div>Hi,<br></div>I will probably have to update these patches. Could you tell me if they could get applied?<br></div>Thank you,<br></div>Paulo</div><div class="gmail_extra"><br><div class="gmail_quote">2014-12-17 21:03 GMT-02:00 Paulo Vitor Magacho da Silva <span dir="ltr"><<a href="mailto:pvmagacho@gmail.com" target="_blank">pvmagacho@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div>I wonder if this will be applied ?<div>Thanks,</div><div>Paulo</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-12-11 1:17 GMT-02:00 Paulo Vitor Magacho da Silva <span dir="ltr"><<a href="mailto:pvmagacho@gmail.com" target="_blank">pvmagacho@gmail.com</a>></span>:<div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
libvlc/jni/libvlcjni-equalizer.c | 4 +-<br>
libvlc/jni/libvlcjni-util.c | 17 --<br>
libvlc/jni/libvlcjni.c | 179 +++++++++++---------<br>
libvlc/jni/native_crash_handler.c | 25 +--<br>
libvlc/jni/native_crash_handler.h | 5 +-<br>
libvlc/jni/utils.h | 2 -<br>
libvlc/jni/vout.c | 188 ++++++++++++---------<br>
libvlc/jni/vout.h | 24 ++-<br>
libvlc/src/org/videolan/libvlc/EventHandler.java | 8 -<br>
libvlc/src/org/videolan/libvlc/LibVLC.java | 100 +++--------<br>
libvlc/src/org/videolan/libvlc/LibVlcUtil.java | 56 +++++-<br>
.../org/videolan/libvlc/NativeCrashHandler.java | 64 +++++++<br>
.../src/org/videolan/vlc/VLCApplication.java | 15 +-<br>
.../src/org/videolan/vlc/audio/AudioService.java | 14 +-<br>
.../org/videolan/vlc/gui/PreferencesActivity.java | 2 +-<br>
.../vlc/gui/video/VideoPlayerActivity.java | 9 +-<br>
.../src/org/videolan/vlc/util/VLCInstance.java | 14 +-<br>
17 files changed, 398 insertions(+), 328 deletions(-)<br>
create mode 100644 libvlc/src/org/videolan/libvlc/NativeCrashHandler.java<br>
<br>
diff --git a/libvlc/jni/libvlcjni-equalizer.c b/libvlc/jni/libvlcjni-equalizer.c<br>
index 2dad0e4..d11f24d 100644<br>
--- a/libvlc/jni/libvlcjni-equalizer.c<br>
+++ b/libvlc/jni/libvlcjni-equalizer.c<br>
@@ -89,10 +89,10 @@ jfloatArray Java_org_videolan_libvlc_LibVLC_getPreset(JNIEnv *env, jobject thiz,<br>
* apply equalizer settings (param bands is float[] (first element is preamp, then bands))<br>
*/<br>
//"--audio-filter=equalizer", "--equalizer-bands=-3.5 -4.5 -1 0 0 5 8 8 8 8",<br>
-jint Java_org_videolan_libvlc_LibVLC_setNativeEqualizer(JNIEnv *env, jobject thiz, jlong media_player, jfloatArray bands)<br>
+jint Java_org_videolan_libvlc_LibVLC_setNativeEqualizer(JNIEnv *env, jobject thiz, jfloatArray bands)<br>
{<br>
jint res = -1;<br>
- libvlc_media_player_t *mp = (libvlc_media_player_t*)(intptr_t)media_player;<br>
+ libvlc_media_player_t *mp = getMediaPlayer(env, thiz);<br>
if (!mp)<br>
return res;<br>
<br>
diff --git a/libvlc/jni/libvlcjni-util.c b/libvlc/jni/libvlcjni-util.c<br>
index 205d59d..67c2554 100644<br>
--- a/libvlc/jni/libvlcjni-util.c<br>
+++ b/libvlc/jni/libvlcjni-util.c<br>
@@ -131,23 +131,6 @@ void arrayListStringAdd(JNIEnv *env, jclass class, jmethodID methodID, jobject a<br>
(*env)->DeleteLocalRef(env, jstr);<br>
}<br>
<br>
-jobject getEventHandlerReference(JNIEnv *env, jobject thiz, jobject eventHandler)<br>
-{<br>
- jclass cls = (*env)->GetObjectClass(env, eventHandler);<br>
- if (!cls) {<br>
- LOGE("setEventHandler: failed to get class reference");<br>
- return NULL;<br>
- }<br>
-<br>
- jmethodID methodID = (*env)->GetMethodID(env, cls, "callback", "(ILandroid/os/Bundle;)V");<br>
- if (!methodID) {<br>
- LOGE("setEventHandler: failed to get the callback method");<br>
- return NULL;<br>
- }<br>
-<br>
- return (*env)->NewGlobalRef(env, eventHandler);<br>
-}<br>
-<br>
static void debug_buffer_log(void *data, int level, const char *fmt, va_list ap)<br>
{<br>
bool isAttached = false;<br>
diff --git a/libvlc/jni/libvlcjni.c b/libvlc/jni/libvlcjni.c<br>
index a9662db..78f5e25 100644<br>
--- a/libvlc/jni/libvlcjni.c<br>
+++ b/libvlc/jni/libvlcjni.c<br>
@@ -38,7 +38,6 @@<br>
#include "aout.h"<br>
#include "vout.h"<br>
#include "utils.h"<br>
-#include "native_crash_handler.h"<br>
<br>
#define VOUT_ANDROID_SURFACE 0<br>
#define VOUT_OPENGLES2 1<br>
@@ -60,6 +59,26 @@ int jni_attach_thread(JNIEnv **env, const char *thread_name);<br>
void jni_detach_thread();<br>
int jni_get_env(JNIEnv **env);<br>
<br>
+static void setLibVlcSysInstance(JNIEnv *env, jobject thiz, libvlc_instance_sys_t *p_sys)<br>
+{<br>
+ setLong(env, thiz, "mLibVlcInstance", (jlong)(intptr_t) p_sys);<br>
+}<br>
+<br>
+static libvlc_instance_sys_t *getLibVlcSysInstance(JNIEnv *env, jobject thiz)<br>
+{<br>
+ return (libvlc_instance_sys_t *)(intptr_t)getLong(env, thiz, "mLibVlcInstance");<br>
+}<br>
+<br>
+static void releaseMediaPlayer(JNIEnv *env, jobject thiz)<br>
+{<br>
+ libvlc_media_player_t *p_mp = getMediaPlayer(env, thiz);<br>
+ if (p_mp)<br>
+ {<br>
+ libvlc_media_player_stop(p_mp);<br>
+ libvlc_media_player_release(p_mp);<br>
+ }<br>
+}<br>
+<br>
static void add_media_options(libvlc_media_t *p_md, JNIEnv *env, jobjectArray mediaOptions)<br>
{<br>
int stringCount = (*env)->GetArrayLength(env, mediaOptions);<br>
@@ -98,24 +117,20 @@ libvlc_media_t *new_media(JNIEnv *env, jobject thiz, jstring fileLocation, bool<br>
<br>
libvlc_instance_t *getLibVlcInstance(JNIEnv *env, jobject thiz)<br>
{<br>
- return (libvlc_instance_t*)(intptr_t)getLong(env, thiz, "mLibVlcInstance");<br>
+ libvlc_instance_sys_t *p_sys = getLibVlcSysInstance(env, thiz);<br>
+ return p_sys ? p_sys->p_libvlc : NULL;<br>
}<br>
<br>
-libvlc_media_player_t *getMediaPlayer(JNIEnv *env, jobject thiz)<br>
+android_surf_value_t *getAndroidSurfaceInstance(JNIEnv *env, jobject thiz)<br>
{<br>
- return (libvlc_media_player_t*)(intptr_t)getLong(env, thiz, "mInternalMediaPlayerInstance");<br>
+ libvlc_instance_sys_t *p_sys = getLibVlcSysInstance(env, thiz);<br>
+ return p_sys ? p_sys->p_surf : NULL;<br>
}<br>
<br>
-<br>
-static void releaseMediaPlayer(JNIEnv *env, jobject thiz)<br>
+libvlc_media_player_t *getMediaPlayer(JNIEnv *env, jobject thiz)<br>
{<br>
- libvlc_media_player_t* p_mp = getMediaPlayer(env, thiz);<br>
- if (p_mp)<br>
- {<br>
- libvlc_media_player_stop(p_mp);<br>
- libvlc_media_player_release(p_mp);<br>
- setLong(env, thiz, "mInternalMediaPlayerInstance", 0);<br>
- }<br>
+ libvlc_instance_sys_t *p_sys = getLibVlcSysInstance(env, thiz);<br>
+ return p_sys ? p_sys->p_mp : NULL;<br>
}<br>
<br>
/* Pointer to the Java virtual machine<br>
@@ -124,17 +139,12 @@ static void releaseMediaPlayer(JNIEnv *env, jobject thiz)<br>
*/<br>
static JavaVM *myVm;<br>
<br>
-static jobject eventHandlerInstance = NULL;<br>
-<br>
static void vlc_event_callback(const libvlc_event_t *ev, void *data)<br>
{<br>
JNIEnv *env;<br>
<br>
bool isAttached = false;<br>
<br>
- if (eventHandlerInstance == NULL)<br>
- return;<br>
-<br>
if (jni_get_env(&env) < 0) {<br>
if (jni_attach_thread(&env, THREAD_NAME) < 0)<br>
return;<br>
@@ -193,20 +203,31 @@ static void vlc_event_callback(const libvlc_event_t *ev, void *data)<br>
free(mrl);<br>
}<br>
<br>
+ /* The LibVLC object */<br>
+ jobject vlcObject = (jobject) data;<br>
+<br>
+ /* Get the event handler object */<br>
+ jclass cls = (*env)->GetObjectClass(env, vlcObject);<br>
+ jmethodID methodId = (*env)->GetMethodID(env, cls, "getEventHandler", "()Lorg/videolan/libvlc/EventHandler;");<br>
+ jobject eventHandlerInstance = (*env)->CallObjectMethod(env, vlcObject, methodId);<br>
+<br>
+ (*env)->DeleteLocalRef(env, cls);<br>
+<br>
/* Get the object class */<br>
- jclass cls = (*env)->GetObjectClass(env, eventHandlerInstance);<br>
+ cls = (*env)->GetObjectClass(env, eventHandlerInstance);<br>
if (!cls) {<br>
LOGE("EventHandler: failed to get class reference");<br>
goto end;<br>
}<br>
<br>
/* Find the callback ID */<br>
- jmethodID methodID = (*env)->GetMethodID(env, cls, "callback", "(ILandroid/os/Bundle;)V");<br>
- if (methodID) {<br>
- (*env)->CallVoidMethod(env, eventHandlerInstance, methodID, ev->type, bundle);<br>
+ methodId = (*env)->GetMethodID(env, cls, "callback", "(ILandroid/os/Bundle;)V");<br>
+ if (methodId) {<br>
+ (*env)->CallVoidMethod(env, eventHandlerInstance, methodId, ev->type, bundle);<br>
} else {<br>
LOGE("EventHandler: failed to get the callback method");<br>
}<br>
+ (*env)->DeleteLocalRef(env, cls);<br>
<br>
end:<br>
(*env)->DeleteLocalRef(env, bundle);<br>
@@ -219,16 +240,12 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved)<br>
// Keep a reference on the Java VM.<br>
myVm = vm;<br>
<br>
- pthread_mutex_init(&vout_android_lock, NULL);<br>
- pthread_cond_init(&vout_android_surf_attached, NULL);<br>
-<br>
LOGD("JNI interface loaded.");<br>
return VLC_JNI_VERSION;<br>
}<br>
<br>
void JNI_OnUnload(JavaVM* vm, void* reserved) {<br>
- pthread_mutex_destroy(&vout_android_lock);<br>
- pthread_cond_destroy(&vout_android_surf_attached);<br>
+ LOGD("JNI interface un-loaded.");<br>
}<br>
<br>
int jni_attach_thread(JNIEnv **env, const char *thread_name)<br>
@@ -354,8 +371,6 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)<br>
};<br>
libvlc_instance_t *instance = libvlc_new(sizeof(argv) / sizeof(*argv), argv);<br>
<br>
- setLong(env, thiz, "mLibVlcInstance", (jlong)(intptr_t) instance);<br>
-<br>
(*env)->ReleaseStringUTFChars(env, chroma, chromastr);<br>
(*env)->ReleaseStringUTFChars(env, subsencoding, subsencodingstr);<br>
<br>
@@ -365,45 +380,45 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)<br>
(*env)->ThrowNew(env, exc, "Unable to instantiate LibVLC");<br>
}<br>
<br>
+ /* Set values to libvlc sys instance */<br>
+ libvlc_instance_sys_t *p_sys = (libvlc_instance_sys_t *) calloc(1, sizeof(libvlc_instance_sys_t));<br>
+ p_sys->p_libvlc = instance;<br>
+ p_sys->p_surf = (android_surf_value_t *) calloc(1, sizeof(android_surf_value_t));<br>
+ p_sys->p_this = (*env)->NewGlobalRef(env, thiz);<br>
+<br>
+ pthread_mutex_init(&p_sys->p_surf->vout_android_lock, NULL);<br>
+ pthread_cond_init(&p_sys->p_surf->vout_android_surf_attached, NULL);<br>
+<br>
+ setLibVlcSysInstance(env, thiz, p_sys);<br>
+<br>
LOGI("LibVLC initialized: %p", instance);<br>
<br>
libvlc_log_set(instance, debug_log, &verbosity);<br>
-<br>
- init_native_crash_handler(env, thiz);<br>
}<br>
<br>
void Java_org_videolan_libvlc_LibVLC_nativeDestroy(JNIEnv *env, jobject thiz)<br>
{<br>
- destroy_native_crash_handler(env);<br>
+ libvlc_instance_sys_t *p_sys = getLibVlcSysInstance(env, thiz);<br>
+ if (p_sys == NULL)<br>
+ return; // Already destroyed<br>
<br>
releaseMediaPlayer(env, thiz);<br>
- jlong libVlcInstance = getLong(env, thiz, "mLibVlcInstance");<br>
- if (!libVlcInstance)<br>
- return; // Already destroyed<br>
<br>
- libvlc_instance_t *instance = (libvlc_instance_t*)(intptr_t) libVlcInstance;<br>
+ libvlc_instance_t *instance = p_sys->p_libvlc;<br>
+ LOGI("LibVLC destroyed: %p", instance);<br>
+<br>
libvlc_log_unset(instance);<br>
libvlc_release(instance);<br>
<br>
- setLong(env, thiz, "mLibVlcInstance", 0);<br>
-}<br>
+ (*env)->DeleteGlobalRef(env, p_sys->p_this);<br>
<br>
-void Java_org_videolan_libvlc_LibVLC_detachEventHandler(JNIEnv *env, jobject thiz)<br>
-{<br>
- if (eventHandlerInstance != NULL) {<br>
- (*env)->DeleteGlobalRef(env, eventHandlerInstance);<br>
- eventHandlerInstance = NULL;<br>
- }<br>
-}<br>
+ pthread_mutex_destroy(&p_sys->p_surf->vout_android_lock);<br>
+ pthread_cond_destroy(&p_sys->p_surf->vout_android_surf_attached);<br>
<br>
-void Java_org_videolan_libvlc_LibVLC_setEventHandler(JNIEnv *env, jobject thiz, jobject eventHandler)<br>
-{<br>
- if (eventHandlerInstance != NULL) {<br>
- (*env)->DeleteGlobalRef(env, eventHandlerInstance);<br>
- eventHandlerInstance = NULL;<br>
- }<br>
+ free(p_sys->p_surf);<br>
+ free(p_sys);<br>
<br>
- eventHandlerInstance = getEventHandlerReference(env, thiz, eventHandler);<br>
+ setLibVlcSysInstance(env, thiz, NULL);<br>
}<br>
<br>
void Java_org_videolan_libvlc_LibVLC_playMRL(JNIEnv *env, jobject thiz,<br>
@@ -412,25 +427,24 @@ void Java_org_videolan_libvlc_LibVLC_playMRL(JNIEnv *env, jobject thiz,<br>
/* Release previous media player, if any */<br>
releaseMediaPlayer(env, thiz);<br>
<br>
- libvlc_instance_t *p_instance = getLibVlcInstance(env, thiz);<br>
+ libvlc_instance_sys_t *p_sys = getLibVlcSysInstance(env, thiz);<br>
<br>
/* Create a media player playing environment */<br>
- libvlc_media_player_t *mp = libvlc_media_player_new(p_instance);<br>
- libvlc_media_player_set_video_title_display(mp, libvlc_position_disable, 0);<br>
- jobject myJavaLibVLC = (*env)->NewGlobalRef(env, thiz);<br>
+ p_sys->p_mp = libvlc_media_player_new(p_sys->p_libvlc);<br>
+<br>
+ libvlc_media_player_set_video_title_display(p_sys->p_mp, libvlc_position_disable, 0);<br>
<br>
//if AOUT_AUDIOTRACK_JAVA, we use amem<br>
jclass cls = (*env)->GetObjectClass(env, thiz);<br>
jmethodID methodId = (*env)->GetMethodID(env, cls, "getAout", "()I");<br>
if ( (*env)->CallIntMethod(env, thiz, methodId) == AOUT_AUDIOTRACK_JAVA )<br>
{<br>
- libvlc_audio_set_callbacks(mp, aout_play, aout_pause, NULL, NULL, NULL,<br>
- (void*) myJavaLibVLC);<br>
- libvlc_audio_set_format_callbacks(mp, aout_open, aout_close);<br>
+ libvlc_audio_set_callbacks(p_sys->p_mp, aout_play, aout_pause, NULL, NULL, NULL, p_sys->p_this);<br>
+ libvlc_audio_set_format_callbacks(p_sys->p_mp, aout_open, aout_close);<br>
}<br>
<br>
/* Connect the event manager */<br>
- libvlc_event_manager_t *ev = libvlc_media_player_event_manager(mp);<br>
+ libvlc_event_manager_t *ev = libvlc_media_player_event_manager(p_sys->p_mp);<br>
static const libvlc_event_type_t mp_events[] = {<br>
libvlc_MediaPlayerPlaying,<br>
libvlc_MediaPlayerPaused,<br>
@@ -442,10 +456,7 @@ void Java_org_videolan_libvlc_LibVLC_playMRL(JNIEnv *env, jobject thiz,<br>
libvlc_MediaPlayerEncounteredError<br>
};<br>
for(int i = 0; i < (sizeof(mp_events) / sizeof(*mp_events)); i++)<br>
- libvlc_event_attach(ev, mp_events[i], vlc_event_callback, myVm);<br>
-<br>
- /* Keep a pointer to this media player */<br>
- setLong(env, thiz, "mInternalMediaPlayerInstance", (jlong)(intptr_t)mp);<br>
+ libvlc_event_attach(ev, mp_events[i], vlc_event_callback, p_sys->p_this);<br>
<br>
cls = (*env)->GetObjectClass(env, thiz);<br>
jmethodID methodID = (*env)->GetMethodID(env, cls, "applyEqualizer", "()V");<br>
@@ -453,13 +464,16 @@ void Java_org_videolan_libvlc_LibVLC_playMRL(JNIEnv *env, jobject thiz,<br>
<br>
const char* p_mrl = (*env)->GetStringUTFChars(env, mrl, 0);<br>
<br>
- libvlc_media_t* p_md = libvlc_media_new_location(p_instance, p_mrl);<br>
+ libvlc_media_t* p_md = libvlc_media_new_location(p_sys->p_libvlc, p_mrl);<br>
/* media options */<br>
if (mediaOptions != NULL)<br>
add_media_options(p_md, env, mediaOptions);<br>
<br>
(*env)->ReleaseStringUTFChars(env, mrl, p_mrl);<br>
<br>
+ /* set the Android surface value structure before playing */<br>
+ libvlc_media_player_set_androidobject(p_sys->p_mp, p_sys->p_surf);<br>
+<br>
/* Connect the media event manager. */<br>
libvlc_event_manager_t *ev_media = libvlc_media_event_manager(p_md);<br>
static const libvlc_event_type_t mp_media_events[] = {<br>
@@ -467,10 +481,10 @@ void Java_org_videolan_libvlc_LibVLC_playMRL(JNIEnv *env, jobject thiz,<br>
libvlc_MediaMetaChanged,<br>
};<br>
for(int i = 0; i < (sizeof(mp_media_events) / sizeof(*mp_media_events)); i++)<br>
- libvlc_event_attach(ev_media, mp_media_events[i], vlc_event_callback, myVm);<br>
+ libvlc_event_attach(ev_media, mp_media_events[i], vlc_event_callback, p_sys->p_this);<br>
<br>
- libvlc_media_player_set_media(mp, p_md);<br>
- libvlc_media_player_play(mp);<br>
+ libvlc_media_player_set_media(p_sys->p_mp, p_md);<br>
+ libvlc_media_player_play(p_sys->p_mp);<br>
}<br>
<br>
jfloat Java_org_videolan_libvlc_LibVLC_getRate(JNIEnv *env, jobject thiz) {<br>
@@ -655,23 +669,26 @@ void Java_org_videolan_libvlc_LibVLC_playerNavigate(JNIEnv *env, jobject thiz, j<br>
libvlc_media_player_navigate(mp, (unsigned) nav);<br>
}<br>
<br>
-// TODO: remove static variables<br>
-static int i_window_width = 0;<br>
-static int i_window_height = 0;<br>
-<br>
void Java_org_videolan_libvlc_LibVLC_setWindowSize(JNIEnv *env, jobject thiz, jint width, jint height)<br>
{<br>
- pthread_mutex_lock(&vout_android_lock);<br>
- i_window_width = width;<br>
- i_window_height = height;<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ android_surf_value_t *android_surface = getAndroidSurfaceInstance(env, thiz);<br>
+ if (android_surface == NULL)<br>
+ return;<br>
+<br>
+ pthread_mutex_lock(&android_surface->vout_android_lock);<br>
+ android_surface->i_window_width = width;<br>
+ android_surface->i_window_height = height;<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
}<br>
<br>
-int jni_GetWindowSize(int *width, int *height)<br>
+int jni_GetWindowSize(android_surf_value_t *android_surface, int *width, int *height)<br>
{<br>
- pthread_mutex_lock(&vout_android_lock);<br>
- *width = i_window_width;<br>
- *height = i_window_height;<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ if (android_surface == NULL)<br>
+ return;<br>
+<br>
+ pthread_mutex_lock(&android_surface->vout_android_lock);<br>
+ *width = android_surface->i_window_width;<br>
+ *height = android_surface->i_window_height;<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
return 0;<br>
}<br>
diff --git a/libvlc/jni/native_crash_handler.c b/libvlc/jni/native_crash_handler.c<br>
index 2cb1590..73b1e1e 100644<br>
--- a/libvlc/jni/native_crash_handler.c<br>
+++ b/libvlc/jni/native_crash_handler.c<br>
@@ -23,7 +23,7 @@<br>
#include "native_crash_handler.h"<br>
<br>
static struct sigaction old_actions[NSIG];<br>
-static jobject j_libVLC;<br>
+static jobject j_NativeCrashHandler = NULL;<br>
<br>
#define THREAD_NAME "native_crash_handler"<br>
extern int jni_attach_thread(JNIEnv **env, const char *thread_name);<br>
@@ -54,9 +54,9 @@ void sigaction_callback(int signal, siginfo_t *info, void *reserved)<br>
JNIEnv *env;<br>
jni_attach_thread(&env, THREAD_NAME);<br>
<br>
- jclass cls = (*env)->GetObjectClass(env, j_libVLC);<br>
+ jclass cls = (*env)->GetObjectClass(env, j_NativeCrashHandler);<br>
jmethodID methodId = (*env)->GetMethodID(env, cls, "onNativeCrash", "()V");<br>
- (*env)->CallVoidMethod(env, j_libVLC, methodId);<br>
+ (*env)->CallVoidMethod(env, j_NativeCrashHandler, methodId);<br>
<br>
(*env)->DeleteLocalRef(env, cls);<br>
jni_detach_thread();<br>
@@ -65,10 +65,8 @@ void sigaction_callback(int signal, siginfo_t *info, void *reserved)<br>
old_actions[signal].sa_handler(signal);<br>
}<br>
<br>
-<br>
-void init_native_crash_handler(JNIEnv *env, jobject j_libVLC_local)<br>
+void Java_org_videolan_libvlc_NativeCrashHandler_nativeInit(JNIEnv *env, jobject thiz)<br>
{<br>
- j_libVLC = (*env)->NewGlobalRef(env, j_libVLC_local);<br>
struct sigaction handler;<br>
memset(&handler, 0, sizeof(struct sigaction));<br>
<br>
@@ -81,17 +79,6 @@ void init_native_crash_handler(JNIEnv *env, jobject j_libVLC_local)<br>
const int s = monitored_signals[i];<br>
sigaction(s, &handler, &old_actions[s]);<br>
}<br>
-}<br>
-<br>
-<br>
-void destroy_native_crash_handler(JNIEnv *env)<br>
-{<br>
- // Uninstall the signal handlers and restore their old actions.<br>
- for (unsigned i = 0; i < sizeof(monitored_signals) / sizeof(int); ++i)<br>
- {<br>
- const int s = monitored_signals[i];<br>
- sigaction(s, &old_actions[s], NULL);<br>
- }<br>
<br>
- (*env)->DeleteGlobalRef(env, j_libVLC);<br>
-}<br>
+ j_NativeCrashHandler = (*env)->NewGlobalRef(env, thiz);;<br>
+}<br>
\ No newline at end of file<br>
diff --git a/libvlc/jni/native_crash_handler.h b/libvlc/jni/native_crash_handler.h<br>
index a57e61e..d220af5 100644<br>
--- a/libvlc/jni/native_crash_handler.h<br>
+++ b/libvlc/jni/native_crash_handler.h<br>
@@ -23,7 +23,4 @@<br>
<br>
#include <jni.h><br>
<br>
-void init_native_crash_handler(JNIEnv *env, jobject j_libVLC_local);<br>
-void destroy_native_crash_handler(JNIEnv *env);<br>
-<br>
-#endif // LIBVLCJNI_NATIVE_CRASH_HANDLER_H<br>
+#endif // LIBVLCJNI_NATIVE_CRASH_HANDLER_H<br>
\ No newline at end of file<br>
diff --git a/libvlc/jni/utils.h b/libvlc/jni/utils.h<br>
index f5b9f8d..e136bcb 100644<br>
--- a/libvlc/jni/utils.h<br>
+++ b/libvlc/jni/utils.h<br>
@@ -43,8 +43,6 @@ void arrayListGetIDs(JNIEnv *env, jclass* p_class, jmethodID* p_add, jmethodID*<br>
<br>
void arrayListStringAdd(JNIEnv *env, jclass class, jmethodID methodID, jobject arrayList, const char* str);<br>
<br>
-jobject getEventHandlerReference(JNIEnv *env, jobject thiz, jobject eventHandler);<br>
-<br>
void debug_log(void *data, int level, const libvlc_log_t *ctx, const char *fmt, va_list ap);<br>
<br>
#endif // LIBVLCJNI_UTILS_H<br>
diff --git a/libvlc/jni/vout.c b/libvlc/jni/vout.c<br>
index 6362f0c..aeec651 100644<br>
--- a/libvlc/jni/vout.c<br>
+++ b/libvlc/jni/vout.c<br>
@@ -22,105 +22,105 @@<br>
#include <vlc_common.h><br>
<br>
#include <jni.h><br>
+#include "vout.h"<br>
+<br>
+#define LOG_TAG "VLC/JNI/vout"<br>
+#include "log.h"<br>
<br>
#define THREAD_NAME "jni_vout"<br>
extern int jni_attach_thread(JNIEnv **env, const char *thread_name);<br>
extern void jni_detach_thread();<br>
extern int jni_get_env(JNIEnv **env);<br>
<br>
-pthread_mutex_t vout_android_lock;<br>
-pthread_cond_t vout_android_surf_attached;<br>
-static void *vout_android_gui = NULL;<br>
-static jobject vout_android_java_surf = NULL;<br>
-static jobject vout_android_subtitles_surf = NULL;<br>
-static bool vout_video_player_activity_created = false;<br>
-<br>
-void *jni_LockAndGetSubtitlesSurface() {<br>
- pthread_mutex_lock(&vout_android_lock);<br>
- while (vout_android_subtitles_surf == NULL)<br>
- pthread_cond_wait(&vout_android_surf_attached, &vout_android_lock);<br>
- return vout_android_subtitles_surf;<br>
+void *jni_LockAndGetSubtitlesSurface(android_surf_value_t *android_surface) {<br>
+ pthread_mutex_lock(&android_surface->vout_android_lock);<br>
+ while (android_surface->vout_android_subtitles_surf == NULL)<br>
+ pthread_cond_wait(&android_surface->vout_android_surf_attached, &android_surface->vout_android_lock);<br>
+ return android_surface->vout_android_subtitles_surf;<br>
}<br>
<br>
-jobject jni_LockAndGetAndroidJavaSurface() {<br>
- pthread_mutex_lock(&vout_android_lock);<br>
- while (vout_android_java_surf == NULL)<br>
- pthread_cond_wait(&vout_android_surf_attached, &vout_android_lock);<br>
- return vout_android_java_surf;<br>
+jobject jni_LockAndGetAndroidJavaSurface(android_surf_value_t *android_surface) {<br>
+ pthread_mutex_lock(&android_surface->vout_android_lock);<br>
+ while (android_surface->vout_android_java_surf == NULL)<br>
+ pthread_cond_wait(&android_surface->vout_android_surf_attached, &android_surface->vout_android_lock);<br>
+ return android_surface->vout_android_java_surf;<br>
}<br>
<br>
-void jni_UnlockAndroidSurface() {<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+void jni_UnlockAndroidSurface(android_surf_value_t *android_surface) {<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
}<br>
<br>
-bool jni_LockAndGetIsSurfaceAttached() {<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
- return vout_android_java_surf != NULL;<br>
+bool jni_LockAndGetIsSurfaceAttached(android_surf_value_t *android_surface) {<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
+ return android_surface->vout_android_java_surf != NULL;<br>
}<br>
<br>
-void jni_EventHardwareAccelerationError()<br>
+void jni_EventHardwareAccelerationError(android_surf_value_t *android_surface)<br>
{<br>
JNIEnv *env;<br>
bool isAttached = false;<br>
<br>
- pthread_mutex_lock(&vout_android_lock);<br>
- if (vout_android_gui == NULL) {<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ pthread_mutex_lock(&android_surface->vout_android_lock);<br>
+ if (android_surface->vout_android_gui == NULL) {<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
return;<br>
}<br>
<br>
if (jni_get_env(&env) < 0) {<br>
if (jni_attach_thread(&env, THREAD_NAME) < 0) {<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
return;<br>
}<br>
isAttached = true;<br>
}<br>
<br>
- jclass cls = (*env)->GetObjectClass(env, vout_android_gui);<br>
+ jclass cls = (*env)->GetObjectClass(env, android_surface->vout_android_gui);<br>
jmethodID methodId = (*env)->GetMethodID(env, cls, "eventHardwareAccelerationError", "()V");<br>
- (*env)->CallVoidMethod(env, vout_android_gui, methodId);<br>
+ (*env)->CallVoidMethod(env, android_surface->vout_android_gui, methodId);<br>
<br>
(*env)->DeleteLocalRef(env, cls);<br>
if (isAttached)<br>
jni_detach_thread();<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
}<br>
<br>
-static void jni_SetSurfaceLayoutEnv(JNIEnv *p_env, int width, int height, int visible_width, int visible_height, int sar_num, int sar_den)<br>
+void jni_SetSurfaceLayoutEnv(JNIEnv *p_env, android_surf_value_t *android_surface, int width, int height, int visible_width, int visible_height, int sar_num, int sar_den)<br>
{<br>
- pthread_mutex_lock(&vout_android_lock);<br>
- if (vout_android_gui == NULL) {<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ pthread_mutex_lock(&android_surface->vout_android_lock);<br>
+ if (android_surface->vout_android_gui == NULL) {<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
return;<br>
}<br>
<br>
- jclass cls = (*p_env)->GetObjectClass (p_env, vout_android_gui);<br>
+ jclass cls = (*p_env)->GetObjectClass (p_env, android_surface->vout_android_gui);<br>
jmethodID methodId = (*p_env)->GetMethodID (p_env, cls, "setSurfaceLayout", "(IIIIII)V");<br>
<br>
- (*p_env)->CallVoidMethod (p_env, vout_android_gui, methodId, width, height, visible_width, visible_height, sar_num, sar_den);<br>
+ (*p_env)->CallVoidMethod (p_env, android_surface->vout_android_gui, methodId, width, height, visible_width, visible_height, sar_num, sar_den);<br>
<br>
(*p_env)->DeleteLocalRef(p_env, cls);<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
}<br>
<br>
-void jni_SetSurfaceLayout(int width, int height, int visible_width, int visible_height, int sar_num, int sar_den)<br>
+void jni_SetSurfaceLayout(android_surf_value_t *android_surface, int width, int height, int visible_width, int visible_height, int sar_num, int sar_den)<br>
{<br>
JNIEnv *p_env;<br>
bool isAttached = false;<br>
<br>
+ if (android_surface == NULL)<br>
+ return;<br>
+<br>
if (jni_get_env(&p_env) < 0) {<br>
if (jni_attach_thread(&p_env, THREAD_NAME) < 0)<br>
return;<br>
isAttached = true;<br>
}<br>
- jni_SetSurfaceLayoutEnv(p_env, width, height, visible_width, visible_height, sar_num, sar_den);<br>
+ jni_SetSurfaceLayoutEnv(p_env, android_surface, width, height, visible_width, visible_height, sar_num, sar_den);<br>
<br>
if (isAttached)<br>
jni_detach_thread();<br>
}<br>
<br>
-void *jni_AndroidJavaSurfaceToNativeSurface(jobject *surf)<br>
+void *jni_AndroidJavaSurfaceToNativeSurface(jobject surf)<br>
{<br>
JNIEnv *p_env;<br>
jclass clz;<br>
@@ -159,28 +159,29 @@ void *jni_AndroidJavaSurfaceToNativeSurface(jobject *surf)<br>
return native_surface;<br>
}<br>
<br>
-int jni_ConfigureSurface(jobject jsurf, int width, int height, int hal, bool *configured)<br>
+int jni_ConfigureSurface(android_surf_value_t *android_surface, int width, int height, int hal, bool *configured)<br>
{<br>
JNIEnv *p_env;<br>
bool isAttached = false;<br>
int ret;<br>
<br>
- pthread_mutex_lock(&vout_android_lock);<br>
- if (vout_android_gui == NULL) {<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ pthread_mutex_lock(&android_surface->vout_android_lock);<br>
+ if (android_surface->vout_android_gui == NULL) {<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
return -1;<br>
}<br>
<br>
if (jni_get_env(&p_env) < 0) {<br>
if (jni_attach_thread(&p_env, THREAD_NAME) < 0) {<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
return -1;<br>
}<br>
isAttached = true;<br>
}<br>
- jclass clz = (*p_env)->GetObjectClass (p_env, vout_android_gui);<br>
+ jclass clz = (*p_env)->GetObjectClass (p_env, android_surface->vout_android_gui);<br>
jmethodID methodId = (*p_env)->GetMethodID (p_env, clz, "configureSurface", "(Landroid/view/Surface;III)I");<br>
- ret = (*p_env)->CallIntMethod (p_env, vout_android_gui, methodId, jsurf, width, height, hal);<br>
+ ret = (*p_env)->CallIntMethod (p_env, android_surface->vout_android_gui, methodId,<br>
+ android_surface->vout_android_java_surf, width, height, hal);<br>
if (ret >= 0 && configured)<br>
*configured = ret == 1;<br>
<br>
@@ -188,62 +189,81 @@ int jni_ConfigureSurface(jobject jsurf, int width, int height, int hal, bool *co<br>
<br>
if (isAttached)<br>
jni_detach_thread();<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
return ret == -1 ? -1 : 0;<br>
}<br>
<br>
-bool jni_IsVideoPlayerActivityCreated() {<br>
- pthread_mutex_lock(&vout_android_lock);<br>
- bool result = vout_video_player_activity_created;<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+bool jni_IsVideoPlayerActivityCreated(android_surf_value_t *android_surface) {<br>
+ pthread_mutex_lock(&android_surface->vout_android_lock);<br>
+ bool result = android_surface->vout_video_player_activity_created;<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
return result;<br>
}<br>
<br>
void Java_org_videolan_libvlc_LibVLC_eventVideoPlayerActivityCreated(JNIEnv *env, jobject thiz, jboolean created) {<br>
- pthread_mutex_lock(&vout_android_lock);<br>
- vout_video_player_activity_created = created;<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ android_surf_value_t * android_surface = getAndroidSurfaceInstance(env, thiz);<br>
+ if (android_surface == NULL)<br>
+ return;<br>
+<br>
+ pthread_mutex_lock(&android_surface->vout_android_lock);<br>
+ android_surface->vout_video_player_activity_created = created;<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
}<br>
<br>
void Java_org_videolan_libvlc_LibVLC_attachSurface(JNIEnv *env, jobject thiz, jobject surf, jobject gui) {<br>
- pthread_mutex_lock(&vout_android_lock);<br>
-<br>
- if (vout_android_gui != NULL)<br>
- (*env)->DeleteGlobalRef(env, vout_android_gui);<br>
- if (vout_android_java_surf != NULL)<br>
- (*env)->DeleteGlobalRef(env, vout_android_java_surf);<br>
- vout_android_gui = (*env)->NewGlobalRef(env, gui);<br>
- vout_android_java_surf = (*env)->NewGlobalRef(env, surf);<br>
- pthread_cond_signal(&vout_android_surf_attached);<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ android_surf_value_t * android_surface = getAndroidSurfaceInstance(env, thiz);<br>
+ if (android_surface == NULL)<br>
+ return;<br>
+<br>
+ pthread_mutex_lock(&android_surface->vout_android_lock);<br>
+ if (android_surface->vout_android_gui != NULL)<br>
+ (*env)->DeleteGlobalRef(env, android_surface->vout_android_gui);<br>
+ if (android_surface->vout_android_java_surf != NULL)<br>
+ (*env)->DeleteGlobalRef(env, android_surface->vout_android_java_surf);<br>
+ android_surface->vout_android_gui = (*env)->NewGlobalRef(env, gui);<br>
+ android_surface->vout_android_java_surf = (*env)->NewGlobalRef(env, surf);<br>
+ pthread_cond_signal(&android_surface->vout_android_surf_attached);<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
}<br>
<br>
void Java_org_videolan_libvlc_LibVLC_detachSurface(JNIEnv *env, jobject thiz) {<br>
- pthread_mutex_lock(&vout_android_lock);<br>
- if (vout_android_gui != NULL)<br>
- (*env)->DeleteGlobalRef(env, vout_android_gui);<br>
- if (vout_android_java_surf != NULL)<br>
- (*env)->DeleteGlobalRef(env, vout_android_java_surf);<br>
- vout_android_gui = NULL;<br>
- vout_android_java_surf = NULL;<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ android_surf_value_t * android_surface = getAndroidSurfaceInstance(env, thiz);<br>
+ if (android_surface == NULL)<br>
+ return;<br>
+<br>
+ pthread_mutex_lock(&android_surface->vout_android_lock);<br>
+ if (android_surface->vout_android_gui != NULL)<br>
+ (*env)->DeleteGlobalRef(env, android_surface->vout_android_gui);<br>
+ if (android_surface->vout_android_java_surf != NULL)<br>
+ (*env)->DeleteGlobalRef(env, android_surface->vout_android_java_surf);<br>
+ android_surface->vout_android_gui = NULL;<br>
+ android_surface->vout_android_java_surf = NULL;<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
}<br>
<br>
void Java_org_videolan_libvlc_LibVLC_attachSubtitlesSurface(JNIEnv *env, jobject thiz, jobject surf) {<br>
- pthread_mutex_lock(&vout_android_lock);<br>
- if (vout_android_subtitles_surf != NULL)<br>
- (*env)->DeleteGlobalRef(env, vout_android_subtitles_surf);<br>
- vout_android_subtitles_surf = (*env)->NewGlobalRef(env, surf);<br>
- pthread_cond_signal(&vout_android_surf_attached);<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ android_surf_value_t * android_surface = getAndroidSurfaceInstance(env, thiz);<br>
+ if (android_surface == NULL)<br>
+ return;<br>
+<br>
+ pthread_mutex_lock(&android_surface->vout_android_lock);<br>
+ if (android_surface->vout_android_subtitles_surf != NULL)<br>
+ (*env)->DeleteGlobalRef(env, android_surface->vout_android_subtitles_surf);<br>
+ android_surface->vout_android_subtitles_surf = (*env)->NewGlobalRef(env, surf);<br>
+ pthread_cond_signal(&android_surface->vout_android_surf_attached);<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
}<br>
<br>
void Java_org_videolan_libvlc_LibVLC_detachSubtitlesSurface(JNIEnv *env, jobject thiz) {<br>
- pthread_mutex_lock(&vout_android_lock);<br>
- if (vout_android_subtitles_surf != NULL)<br>
- (*env)->DeleteGlobalRef(env, vout_android_subtitles_surf);<br>
- vout_android_subtitles_surf = NULL;<br>
- pthread_mutex_unlock(&vout_android_lock);<br>
+ android_surf_value_t * android_surface = getAndroidSurfaceInstance(env, thiz);<br>
+ if (android_surface == NULL)<br>
+ return;<br>
+<br>
+ pthread_mutex_lock(&android_surface->vout_android_lock);<br>
+ if (android_surface->vout_android_subtitles_surf != NULL)<br>
+ (*env)->DeleteGlobalRef(env, android_surface->vout_android_subtitles_surf);<br>
+ android_surface->vout_android_subtitles_surf = NULL;<br>
+ pthread_mutex_unlock(&android_surface->vout_android_lock);<br>
}<br>
<br>
static int mouse_x = -1;<br>
diff --git a/libvlc/jni/vout.h b/libvlc/jni/vout.h<br>
index c3d4fd7..ac13413 100644<br>
--- a/libvlc/jni/vout.h<br>
+++ b/libvlc/jni/vout.h<br>
@@ -21,8 +21,26 @@<br>
#ifndef LIBVLCJNI_VOUT_H<br>
#define LIBVLCJNI_VOUT_H<br>
<br>
-/* vout lock initialized in vout.c */<br>
-pthread_mutex_t vout_android_lock;<br>
-pthread_cond_t vout_android_surf_attached;<br>
+#include <pthread.h><br>
+<br>
+typedef struct android_surf_value_t {<br>
+ pthread_mutex_t vout_android_lock;<br>
+ pthread_cond_t vout_android_surf_attached;<br>
+ void *vout_android_gui;<br>
+ jobject vout_android_java_surf;<br>
+ jobject vout_android_subtitles_surf;<br>
+ bool vout_video_player_activity_created;<br>
+ int i_window_width;<br>
+ int i_window_height;<br>
+} android_surf_value_t;<br>
+<br>
+typedef struct libvlc_instance_sys_t {<br>
+ void *p_this;<br>
+ libvlc_instance_t *p_libvlc;<br>
+ libvlc_media_player_t *p_mp;<br>
+ android_surf_value_t *p_surf;<br>
+} libvlc_instance_sys_t;<br>
+<br>
+android_surf_value_t *getAndroidSurfaceInstance(JNIEnv *env, jobject thiz);<br>
<br>
#endif // LIBVLCJNI_VOUT_H<br>
diff --git a/libvlc/src/org/videolan/libvlc/EventHandler.java b/libvlc/src/org/videolan/libvlc/EventHandler.java<br>
index 4ec0861..2d13d30 100644<br>
--- a/libvlc/src/org/videolan/libvlc/EventHandler.java<br>
+++ b/libvlc/src/org/videolan/libvlc/EventHandler.java<br>
@@ -97,19 +97,11 @@ public class EventHandler {<br>
public static final int HardwareAccelerationError = 0x3000;<br>
<br>
private ArrayList<Handler> mEventHandler;<br>
- private static EventHandler mInstance;<br>
<br>
EventHandler() {<br>
mEventHandler = new ArrayList<Handler>();<br>
}<br>
<br>
- public static EventHandler getInstance() {<br>
- if (mInstance == null) {<br>
- mInstance = new EventHandler();<br>
- }<br>
- return mInstance;<br>
- }<br>
-<br>
public void addHandler(Handler handler) {<br>
if (!mEventHandler.contains(handler))<br>
mEventHandler.add(handler);<br>
diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java<br>
index 822999a..aaf640f 100644<br>
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java<br>
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java<br>
@@ -1,7 +1,7 @@<br>
/*****************************************************************************<br>
* LibVLC.java<br>
*****************************************************************************<br>
- * Copyright © 2010-2013 VLC authors and VideoLAN<br>
+ * Copyright © 2010-2014 VLC authors and VideoLAN<br>
*<br>
* This program is free software; you can redistribute it and/or modify it<br>
* under the terms of the GNU Lesser General Public License as published by<br>
@@ -25,7 +25,6 @@ import java.util.ArrayList;<br>
import java.util.Map;<br>
<br>
import android.content.Context;<br>
-import android.os.Build;<br>
import android.util.Log;<br>
import android.view.Surface;<br>
<br>
@@ -61,11 +60,12 @@ public class LibVLC {<br>
<br>
private static LibVLC sInstance;<br>
<br>
+ private final EventHandler eventHandler = new EventHandler();<br>
+<br>
/** libVLC instance C pointer */<br>
private long mLibVlcInstance = 0; // Read-only, reserved for JNI<br>
/** libvlc_media_player pointer and index */<br>
private int mInternalMediaPlayerIndex = 0; // Read-only, reserved for JNI<br>
- private long mInternalMediaPlayerInstance = 0; // Read-only, reserved for JNI<br>
<br>
private MediaList mMediaList; // Pointer to media list being followed<br>
private MediaList mPrimaryList; // Primary/default media list; see getPrimaryMediaList()<br>
@@ -99,9 +99,6 @@ public class LibVLC {<br>
/** Path of application-specific cache */<br>
private String mCachePath = "";<br>
<br>
- /** Native crash handler */<br>
- private OnNativeCrashListener mOnNativeCrashListener;<br>
-<br>
/** Check in libVLC already initialized otherwise crash */<br>
private boolean mIsInitialized = false;<br>
public native void attachSurface(Surface surface, IVideoPlayer player);<br>
@@ -113,54 +110,6 @@ public class LibVLC {<br>
<br>
public native void eventVideoPlayerActivityCreated(boolean created);<br>
<br>
- /* Load library before object instantiation */<br>
- static {<br>
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {<br>
- try {<br>
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR1)<br>
- System.loadLibrary("anw.10");<br>
- else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR2)<br>
- System.loadLibrary("anw.13");<br>
- else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1)<br>
- System.loadLibrary("anw.14");<br>
- else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH)<br>
- System.loadLibrary("anw.18");<br>
- else<br>
- System.loadLibrary("anw.21");<br>
- } catch (Throwable t) {<br>
- Log.w(TAG, "Unable to load the anw library: " + t);<br>
- }<br>
- }<br>
-<br>
- try {<br>
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1)<br>
- System.loadLibrary("iomx.10");<br>
- else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR2)<br>
- System.loadLibrary("iomx.13");<br>
- else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1)<br>
- System.loadLibrary("iomx.14");<br>
- else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2)<br>
- System.loadLibrary("iomx.18");<br>
- else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT)<br>
- System.loadLibrary("iomx.19");<br>
- } catch (Throwable t) {<br>
- // No need to warn if it isn't found, when we intentionally don't build these except for debug<br>
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)<br>
- Log.w(TAG, "Unable to load the iomx library: " + t);<br>
- }<br>
- try {<br>
- System.loadLibrary("vlcjni");<br>
- } catch (UnsatisfiedLinkError ule) {<br>
- Log.e(TAG, "Can't load vlcjni library: " + ule);<br>
- /// FIXME Alert user<br>
- System.exit(1);<br>
- } catch (SecurityException se) {<br>
- Log.e(TAG, "Encountered a security issue when loading vlcjni library: " + se);<br>
- /// FIXME Alert user<br>
- System.exit(1);<br>
- }<br>
- }<br>
-<br>
/**<br>
* Singleton constructor of libVLC Without surface and vout to create the<br>
* thumbnail and get information e.g. on the MediaLibraryActivity<br>
@@ -192,10 +141,9 @@ public class LibVLC {<br>
}<br>
<br>
/**<br>
- * Constructor<br>
- * It is private because this class is a singleton.<br>
+ * Constructor.<br>
*/<br>
- private LibVLC() {<br>
+ public LibVLC() {<br>
mAout = new AudioOutput();<br>
}<br>
<br>
@@ -261,7 +209,7 @@ public class LibVLC {<br>
*/<br>
public native void setSurface(Surface f);<br>
<br>
- public static synchronized void restart(Context context) {<br>
+ public static synchronized void restartInstance(Context context) {<br>
if (sInstance != null) {<br>
try {<br>
sInstance.destroy();<br>
@@ -272,6 +220,15 @@ public class LibVLC {<br>
}<br>
}<br>
<br>
+ public void restart(Context context) {<br>
+ try {<br>
+ this.destroy();<br>
+ this.init(context);<br>
+ } catch (LibVlcException lve) {<br>
+ Log.e(TAG, "Unable to reinit libvlc: " + lve);<br>
+ }<br>
+ }<br>
+<br>
/**<br>
* those get/is* are called from native code to get settings values.<br>
*/<br>
@@ -493,11 +450,11 @@ public class LibVLC {<br>
applyEqualizer();<br>
}<br>
<br>
- private void applyEqualizer()<br>
+ protected void applyEqualizer()<br>
{<br>
- setNativeEqualizer(mInternalMediaPlayerInstance, this.equalizer);<br>
+ setNativeEqualizer(this.equalizer);<br>
}<br>
- private native int setNativeEqualizer(long mediaPlayer, float[] bands);<br>
+ private native int setNativeEqualizer(float[] bands);<br>
<br>
public boolean frameSkipEnabled() {<br>
return frameSkip;<br>
@@ -533,7 +490,7 @@ public class LibVLC {<br>
public void init(Context context) throws LibVlcException {<br>
Log.v(TAG, "Initializing LibVLC");<br>
mDebugLogBuffer = new StringBuffer();<br>
- if (!mIsInitialized) {<br>
+ if (LibVlcUtil.isLibraryLoaded() && !mIsInitialized) {<br>
if(!LibVlcUtil.hasCompatibleCPU(context)) {<br>
Log.e(TAG, LibVlcUtil.getErrorMsg());<br>
throw new LibVlcException();<br>
@@ -543,7 +500,6 @@ public class LibVLC {<br>
mCachePath = (cacheDir != null) ? cacheDir.getAbsolutePath() : null;<br>
nativeInit();<br>
mMediaList = mPrimaryList = new MediaList(this);<br>
- setEventHandler(EventHandler.getInstance());<br>
mIsInitialized = true;<br>
}<br>
}<br>
@@ -555,7 +511,6 @@ public class LibVLC {<br>
public void destroy() {<br>
Log.v(TAG, "Destroying LibVLC instance");<br>
nativeDestroy();<br>
- detachEventHandler();<br>
mIsInitialized = false;<br>
}<br>
<br>
@@ -835,27 +790,14 @@ public class LibVLC {<br>
return mMediaList.expandMedia(mInternalMediaPlayerIndex);<br>
}<br>
<br>
- private native void setEventHandler(EventHandler eventHandler);<br>
-<br>
- private native void detachEventHandler();<br>
-<br>
public native float[] getBands();<br>
<br>
public native String[] getPresets();<br>
<br>
public native float[] getPreset(int index);<br>
<br>
- public static interface OnNativeCrashListener {<br>
- public void onNativeCrash();<br>
- }<br>
-<br>
- public void setOnNativeCrashListener(OnNativeCrashListener l) {<br>
- mOnNativeCrashListener = l;<br>
- }<br>
-<br>
- private void onNativeCrash() {<br>
- if (mOnNativeCrashListener != null)<br>
- mOnNativeCrashListener.onNativeCrash();<br>
+ public EventHandler getEventHandler() {<br>
+ return eventHandler;<br>
}<br>
<br>
public String getCachePath() {<br>
diff --git a/libvlc/src/org/videolan/libvlc/LibVlcUtil.java b/libvlc/src/org/videolan/libvlc/LibVlcUtil.java<br>
index 0ddf780..6c7dc97 100644<br>
--- a/libvlc/src/org/videolan/libvlc/LibVlcUtil.java<br>
+++ b/libvlc/src/org/videolan/libvlc/LibVlcUtil.java<br>
@@ -1,7 +1,7 @@<br>
/*****************************************************************************<br>
* LibVlcUtil.java<br>
*****************************************************************************<br>
- * Copyright © 2011-2013 VLC authors and VideoLAN<br>
+ * Copyright © 2011-2014 VLC authors and VideoLAN<br>
*<br>
* This program is free software; you can redistribute it and/or modify it<br>
* under the terms of the GNU Lesser General Public License as published by<br>
@@ -39,6 +39,60 @@ import android.util.Log;<br>
public class LibVlcUtil {<br>
public final static String TAG = "VLC/LibVLC/Util";<br>
<br>
+ public static boolean libraryLoaded = false;<br>
+<br>
+ /* Load library before object instantiation */<br>
+ static {<br>
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {<br>
+ try {<br>
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR1)<br>
+ System.loadLibrary("anw.10");<br>
+ else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR2)<br>
+ System.loadLibrary("anw.13");<br>
+ else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1)<br>
+ System.loadLibrary("anw.14");<br>
+ else<br>
+ System.loadLibrary("anw.18");<br>
+ } catch (Throwable t) {<br>
+ Log.w(TAG, "Unable to load the anw library: " + t);<br>
+ }<br>
+ }<br>
+<br>
+ try {<br>
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1)<br>
+ System.loadLibrary("iomx.10");<br>
+ else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR2)<br>
+ System.loadLibrary("iomx.13");<br>
+ else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1)<br>
+ System.loadLibrary("iomx.14");<br>
+ else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2)<br>
+ System.loadLibrary("iomx.18");<br>
+ else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT)<br>
+ System.loadLibrary("iomx.19");<br>
+ } catch (Throwable t) {<br>
+ // No need to warn if it isn't found, when we intentionally don't build these except for debug<br>
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)<br>
+ Log.w(TAG, "Unable to load the iomx library: " + t);<br>
+ }<br>
+ try {<br>
+ System.loadLibrary("vlcjni");<br>
+ } catch (UnsatisfiedLinkError ule) {<br>
+ Log.e(TAG, "Can't load vlcjni library: " + ule);<br>
+ /// FIXME Alert user<br>
+ System.exit(1);<br>
+ } catch (SecurityException se) {<br>
+ Log.e(TAG, "Encountered a security issue when loading vlcjni library: " + se);<br>
+ /// FIXME Alert user<br>
+ System.exit(1);<br>
+ }<br>
+<br>
+ libraryLoaded = true;<br>
+ }<br>
+<br>
+ public static boolean isLibraryLoaded() {<br>
+ return libraryLoaded;<br>
+ }<br>
+<br>
public static boolean isFroyoOrLater()<br>
{<br>
return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.FROYO;<br>
diff --git a/libvlc/src/org/videolan/libvlc/NativeCrashHandler.java b/libvlc/src/org/videolan/libvlc/NativeCrashHandler.java<br>
new file mode 100644<br>
index 0000000..ec10698<br>
--- /dev/null<br>
+++ b/libvlc/src/org/videolan/libvlc/NativeCrashHandler.java<br>
@@ -0,0 +1,64 @@<br>
+/*****************************************************************************<br>
+ * NativeCrashHandler.java<br>
+ *****************************************************************************<br>
+ * Copyright © 2014 VLC authors and VideoLAN<br>
+ *<br>
+ * This program is free software; you can redistribute it and/or modify<br>
+ * it under the terms of the GNU General Public License as published by<br>
+ * the Free Software Foundation; either version 2 of the License, or<br>
+ * (at your option) any later version.<br>
+ *<br>
+ * This program is distributed in the hope that it will be useful,<br>
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+ * GNU General Public License for more details.<br>
+ *<br>
+ * You should have received a copy of the GNU General Public License<br>
+ * along with this program; if not, write to the Free Software<br>
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.<br>
+ *****************************************************************************/<br>
+<br>
+package org.videolan.libvlc;<br>
+<br>
+import android.os.Build;<br>
+import android.util.Log;<br>
+<br>
+public class NativeCrashHandler {<br>
+ public final static String TAG = "VLC/NativeCrashHandler";<br>
+<br>
+ /** Native crash handler */<br>
+ private OnNativeCrashListener mOnNativeCrashListener;<br>
+<br>
+ private static NativeCrashHandler sInstance;<br>
+<br>
+ private NativeCrashHandler() {<br>
+ }<br>
+<br>
+ public static interface OnNativeCrashListener {<br>
+ public void onNativeCrash();<br>
+ }<br>
+<br>
+ public static NativeCrashHandler getInstance() {<br>
+ synchronized (NativeCrashHandler.class) {<br>
+ if (sInstance == null) {<br>
+ /* First call */<br>
+ sInstance = new NativeCrashHandler();<br>
+ if (LibVlcUtil.isLibraryLoaded())<br>
+ sInstance.nativeInit();<br>
+ }<br>
+ }<br>
+<br>
+ return sInstance;<br>
+ }<br>
+<br>
+ public void setOnNativeCrashListener(OnNativeCrashListener l) {<br>
+ mOnNativeCrashListener = l;<br>
+ }<br>
+<br>
+ public void onNativeCrash() {<br>
+ if (mOnNativeCrashListener != null)<br>
+ mOnNativeCrashListener.onNativeCrash();<br>
+ }<br>
+<br>
+ private native void nativeInit();<br>
+}<br>
\ No newline at end of file<br>
diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.java b/vlc-android/src/org/videolan/vlc/VLCApplication.java<br>
index e915a46..ba34827 100644<br>
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.java<br>
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.java<br>
@@ -1,7 +1,7 @@<br>
/*****************************************************************************<br>
* VLCApplication.java<br>
*****************************************************************************<br>
- * Copyright © 2010-2013 VLC authors and VideoLAN<br>
+ * Copyright © 2010-2014 VLC authors and VideoLAN<br>
*<br>
* This program is free software; you can redistribute it and/or modify<br>
* it under the terms of the GNU General Public License as published by<br>
@@ -21,11 +21,14 @@ package org.videolan.vlc;<br>
<br>
import java.util.Locale;<br>
<br>
+import org.videolan.libvlc.NativeCrashHandler;<br>
import org.videolan.vlc.gui.audio.AudioUtil;<br>
+import org.videolan.vlc.gui.NativeCrashActivity;<br>
import org.videolan.vlc.util.BitmapCache;<br>
<br>
import android.app.Application;<br>
import android.content.Context;<br>
+import android.content.Intent;<br>
import android.content.SharedPreferences;<br>
import android.content.res.Configuration;<br>
import android.content.res.Resources;<br>
@@ -81,6 +84,16 @@ public class VLCApplication extends Application {<br>
MediaDatabase.getInstance();<br>
// Prepare cache folder constants<br>
AudioUtil.prepareCacheFolder(this);<br>
+<br>
+ NativeCrashHandler.getInstance().setOnNativeCrashListener(new NativeCrashHandler.OnNativeCrashListener() {<br>
+ @Override<br>
+ public void onNativeCrash() {<br>
+ Intent i = new Intent(instance, NativeCrashActivity.class);<br>
+ i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);<br>
+ i.putExtra("PID", android.os.Process.myPid());<br>
+ instance.startActivity(i);<br>
+ }<br>
+ });<br>
}<br>
<br>
/**<br>
diff --git a/vlc-android/src/org/videolan/vlc/audio/AudioService.java b/vlc-android/src/org/videolan/vlc/audio/AudioService.java<br>
index c33abc8..d039fba 100644<br>
--- a/vlc-android/src/org/videolan/vlc/audio/AudioService.java<br>
+++ b/vlc-android/src/org/videolan/vlc/audio/AudioService.java<br>
@@ -116,7 +116,6 @@ public class AudioService extends Service {<br>
<br>
private LibVLC mLibVLC;<br>
private HashMap<IAudioServiceCallback, Integer> mCallback;<br>
- private EventHandler mEventHandler;<br>
private OnAudioFocusChangeListener audioFocusListener;<br>
private boolean mDetectHeadset = true;<br>
private PowerManager.WakeLock mWakeLock;<br>
@@ -165,7 +164,6 @@ public class AudioService extends Service {<br>
mPrevIndex = -1;<br>
mNextIndex = -1;<br>
mPrevious = new Stack<Integer>();<br>
- mEventHandler = EventHandler.getInstance();<br>
mRemoteControlClientReceiverComponent = new ComponentName(getPackageName(),<br>
RemoteControlClientReceiver.class.getName());<br>
<br>
@@ -346,7 +344,7 @@ public class AudioService extends Service {<br>
}<br>
<br>
/*<br>
- * Incoming Call : Pause if VLC is playing audio or video.<br>
+ * Incoming Call : Pause if VLC is playing audio or video.<br>
*/<br>
if (action.equalsIgnoreCase(VLCApplication.INCOMING_CALL_INTENT)) {<br>
mWasPlayingAudio = mLibVLC.isPlaying() && mLibVLC.getVideoTracksCount() < 1;<br>
@@ -625,7 +623,7 @@ public class AudioService extends Service {<br>
String MRL = mLibVLC.getMediaList().getMRL(mCurrentIndex);<br>
int index = mCurrentIndex;<br>
mCurrentIndex = -1;<br>
- mEventHandler.removeHandler(mVlcEventHandler);<br>
+ mLibVLC.getEventHandler().removeHandler(mVlcEventHandler);<br>
// Preserve playback when switching to video<br>
hideNotification(false);<br>
<br>
@@ -833,7 +831,7 @@ public class AudioService extends Service {<br>
<br>
private void stop() {<br>
mLibVLC.stop();<br>
- mEventHandler.removeHandler(mVlcEventHandler);<br>
+ mLibVLC.getEventHandler().removeHandler(mVlcEventHandler);<br>
mLibVLC.getMediaList().getEventHandler().removeHandler(mListEventHandler);<br>
setRemoteControlClientPlaybackState(EventHandler.MediaPlayerStopped);<br>
mCurrentIndex = -1;<br>
@@ -1158,7 +1156,7 @@ public class AudioService extends Service {<br>
throws RemoteException {<br>
<br>
Log.v(TAG, "Loading position " + ((Integer)position).toString() + " in " + mediaPathList.toString());<br>
- mEventHandler.addHandler(mVlcEventHandler);<br>
+ mLibVLC.getEventHandler().addHandler(mVlcEventHandler);<br>
<br>
mLibVLC.getMediaList().getEventHandler().removeHandler(mListEventHandler);<br>
mLibVLC.setMediaList();<br>
@@ -1226,7 +1224,7 @@ public class AudioService extends Service {<br>
mCurrentIndex = 0;<br>
}<br>
<br>
- mEventHandler.addHandler(mVlcEventHandler);<br>
+ mLibVLC.getEventHandler().addHandler(mVlcEventHandler);<br>
mLibVLC.playIndex(mCurrentIndex);<br>
mHandler.sendEmptyMessage(SHOW_PROGRESS);<br>
setUpRemoteControlClient();<br>
@@ -1250,7 +1248,7 @@ public class AudioService extends Service {<br>
<br>
if(URI == null || !mLibVLC.isPlaying())<br>
return;<br>
- mEventHandler.addHandler(mVlcEventHandler);<br>
+ mLibVLC.getEventHandler().addHandler(mVlcEventHandler);<br>
mCurrentIndex = index;<br>
<br>
// Notify everyone<br>
diff --git a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java<br>
index fc7d695..6a2cfed 100644<br>
--- a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java<br>
+++ b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java<br>
@@ -299,7 +299,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP<br>
|| key.equalsIgnoreCase("network_caching")<br>
|| key.equalsIgnoreCase("dev_hardware_decoder")) {<br>
VLCInstance.updateLibVlcSettings(sharedPreferences);<br>
- LibVLC.restart(this);<br>
+ LibVLC.restartInstance(this);<br>
}<br>
}<br>
<br>
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java<br>
index 4cf4793..195de50 100644<br>
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java<br>
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java<br>
@@ -439,8 +439,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay<br>
// SurfaceView is now available for MediaCodec direct rendering.<br>
mLibVLC.eventVideoPlayerActivityCreated(true);<br>
<br>
- EventHandler em = EventHandler.getInstance();<br>
- em.addHandler(eventHandler);<br>
+ mLibVLC.getEventHandler().addHandler(eventHandler);<br>
<br>
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);<br>
<br>
@@ -590,8 +589,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay<br>
super.onDestroy();<br>
unregisterReceiver(mReceiver);<br>
<br>
- EventHandler em = EventHandler.getInstance();<br>
- em.removeHandler(eventHandler);<br>
+ mLibVLC.getEventHandler().removeHandler(eventHandler);<br>
<br>
// MediaCodec opaque direct rendering should not be used anymore since there is no surface to attach.<br>
mLibVLC.eventVideoPlayerActivityCreated(false);<br>
@@ -1228,8 +1226,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay<br>
}<br>
<br>
public void eventHardwareAccelerationError() {<br>
- EventHandler em = EventHandler.getInstance();<br>
- em.callback(EventHandler.HardwareAccelerationError, new Bundle());<br>
+ mLibVLC.getEventHandler().callback(EventHandler.HardwareAccelerationError, new Bundle());<br>
}<br>
<br>
private void handleHardwareAccelerationError() {<br>
diff --git a/vlc-android/src/org/videolan/vlc/util/VLCInstance.java b/vlc-android/src/org/videolan/vlc/util/VLCInstance.java<br>
index d0212c6..9b65285 100644<br>
--- a/vlc-android/src/org/videolan/vlc/util/VLCInstance.java<br>
+++ b/vlc-android/src/org/videolan/vlc/util/VLCInstance.java<br>
@@ -24,7 +24,6 @@ import org.videolan.libvlc.LibVLC;<br>
import org.videolan.libvlc.LibVlcException;<br>
import org.videolan.vlc.VLCApplication;<br>
import org.videolan.vlc.VLCCrashHandler;<br>
-import org.videolan.vlc.gui.NativeCrashActivity;<br>
<br>
import android.content.Context;<br>
import android.content.Intent;<br>
@@ -45,15 +44,6 @@ public class VLCInstance {<br>
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);<br>
VLCInstance.updateLibVlcSettings(pref);<br>
instance.init(context);<br>
- instance.setOnNativeCrashListener(new LibVLC.OnNativeCrashListener() {<br>
- @Override<br>
- public void onNativeCrash() {<br>
- Intent i = new Intent(context, NativeCrashActivity.class);<br>
- i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);<br>
- i.putExtra("PID", android.os.Process.myPid());<br>
- context.startActivity(i);<br>
- }<br>
- });<br>
}<br>
return instance;<br>
}<br>
@@ -81,10 +71,10 @@ public class VLCInstance {<br>
}<br>
int vout;<br>
try {<br>
- vout = Integer.parseInt(pref.getString("vout", "-1"));<br>
+ vout = Integer.parseInt(pref.getString("vout", "-1"));<br>
}<br>
catch (NumberFormatException nfe) {<br>
- vout = -1;<br>
+ vout = -1;<br>
}<br>
int deblocking;<br>
try {<br>
<span><font color="#888888">--<br>
1.9.3 (Apple Git-50)<br>
<br>
</font></span></blockquote></div></div></div></div>
</blockquote></div><br></div>