static void IjkMediaPlayer_reset(JNIEnv *env, jobject thiz) { MPTRACE("IjkMediaPlayer_reset"); IjkMediaPlayer *mp = jni_get_media_player(env, thiz); JNI_CHECK_GOTO(mp, env, NULL, "mpjni: reset: null mp", LABEL_RETURN); ijkmp_android_set_surface(env, mp, NULL); ijkmp_reset(mp); LABEL_RETURN: ijkmp_dec_ref_p(&mp); }
static void IjkMediaPlayer_setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface) { MPTRACE("IjkMediaPlayer_setVideoSurface"); IjkMediaPlayer *mp = jni_get_media_player(env, thiz); JNI_CHECK_GOTO(mp, env, NULL, "mpjni: setVideoSurface: null mp", LABEL_RETURN); ijkmp_android_set_surface(env, mp, jsurface); LABEL_RETURN: ijkmp_dec_ref_p(&mp); return; }
static void IjkMediaPlayer_release(JNIEnv *env, jobject thiz) { MPTRACE("IjkMediaPlayer_release"); IjkMediaPlayer *mp = jni_get_media_player(env, thiz); if (!mp) return; // explicit shutdown mp, in case it is not the last mp-ref here ijkmp_android_set_surface(env, mp, NULL); ijkmp_shutdown(mp); jni_set_media_player(env, thiz, NULL); ijkmp_dec_ref_p(&mp); }
static void IjkMediaPlayer_release(JNIEnv *env, jobject thiz) { MPTRACE("IjkMediaPlayer_release"); IjkMediaPlayer *mp = jni_get_media_player(env, thiz); if (!mp) return; // explicit shutdown mp, in case it is not the last mp-ref here ijkmp_android_set_surface(env, mp, NULL ); ijkmp_shutdown(mp); //only delete weak_thiz at release jobject weak_thiz = (jobject) ijkmp_set_weak_thiz(mp, NULL ); (*env)->DeleteGlobalRef(env, weak_thiz); jni_set_media_player(env, thiz, NULL ); ijkmp_dec_ref_p(&mp); }