Пример #1
0
static void
IjkMediaPlayer_native_setup(JNIEnv *env, jobject thiz, jobject weak_this)
{
    MPTRACE("IjkMediaPlayer_native_setup");
    IjkMediaPlayer *mp = ijkmp_android_create(message_loop);
    JNI_CHECK_GOTO(mp, env, "java/lang/OutOfMemoryError", "mpjni: native_setup: ijkmp_create() failed", LABEL_RETURN);

    jni_set_media_player(env, thiz, mp);
    ijkmp_set_weak_thiz(mp, (*env)->NewGlobalRef(env, weak_this));

LABEL_RETURN:
    ijkmp_dec_ref_p(&mp);
}
Пример #2
0
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);
}
Пример #3
0
static void
AirStashMediaPlayer_native_setup(JNIEnv *env, jobject thiz, jobject weak_this)
{
    MPTRACE("%s\n", __func__);
    AirStashMediaPlayer *mp = airstashmp_android_create(message_loop);
    JNI_CHECK_GOTO(mp, env, "java/lang/OutOfMemoryError", "mpjni: native_setup: airstashmp_create() failed", LABEL_RETURN);

    jni_set_media_player(env, thiz, mp);
    airstashmp_set_weak_thiz(mp, (*env)->NewGlobalRef(env, weak_this));
    airstashmp_set_inject_opaque(mp, airstashmp_get_weak_thiz(mp));
    airstashmp_android_set_mediacodec_select_callback(mp, mediacodec_select_callback, (*env)->NewGlobalRef(env, weak_this));

LABEL_RETURN:
    airstashmp_dec_ref_p(&mp);
}
Пример #4
0
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);
}
Пример #5
0
static void
AirStashMediaPlayer_release(JNIEnv *env, jobject thiz)
{
    MPTRACE("%s\n", __func__);
    AirStashMediaPlayer *mp = jni_get_media_player(env, thiz);
    if (!mp)
        return;

    airstashmp_android_set_surface(env, mp, NULL);
    // explicit shutdown mp, in case it is not the last mp-ref here
    airstashmp_shutdown(mp);
    //only delete weak_thiz at release
    jobject weak_thiz = (jobject) airstashmp_set_weak_thiz(mp, NULL );
    (*env)->DeleteGlobalRef(env, weak_thiz);
    jni_set_media_player(env, thiz, NULL);
    jni_set_media_data_source(env, thiz, NULL);

    airstashmp_dec_ref_p(&mp);
}