Commit fd7bba25 authored by Rafaël Carré's avatar Rafaël Carré
Browse files

releaseMediaPlayer: simplify

parent 8d446b55
......@@ -31,20 +31,19 @@ static libvlc_media_player_t *getMediaPlayer(JNIEnv *env, jobject thiz)
return (libvlc_media_player_t*)(*env)->GetIntField(env, thiz, fieldMP);
}
jboolean releaseMediaPlayer(JNIEnv *env, jobject thiz)
static void releaseMediaPlayer(JNIEnv *env, jobject thiz)
{
jclass clazz = (*env)->GetObjectClass(env, thiz);
jfieldID fieldMP = (*env)->GetFieldID(env, clazz,
"mMediaPlayerInstance", "I");
jint mediaPlayer = (*env)->GetIntField(env, thiz, fieldMP);
if (mediaPlayer != 0)
libvlc_media_player_t *mp;
mp = (libvlc_media_player_t*)(*env)->GetIntField(env, thiz, fieldMP);
if (mp)
{
libvlc_media_player_t *mp = (libvlc_media_player_t*) mediaPlayer;
libvlc_media_player_stop(mp);
libvlc_media_player_release(mp);
(*env)->SetIntField(env, thiz, fieldMP, 0);
}
return (mediaPlayer == 0);
}
/* Pointer to the Java virtual machine
......
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