mrmaffen / vlc-android-sdk

VLC Android SDK pushed to Maven Central. Primarily used in project tomahawk-android.
792 stars 244 forks source link

Teletext support #91

Closed ipejasinovic closed 7 years ago

ipejasinovic commented 7 years ago

Is there any chance for author of this compiled version, to add support for Teletext in libvlc? It would be necessary to edit libvlcjni-mediaplayer.c and MediaPlayer.java.

In libvlcjni-mediaplayer.c should be added:

void Java_org_videolan_libvlc_MediaPlayer_nativeToggleTeletext(JNIEnv *env, jobject thiz) {
    vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);

    if (!p_obj)
        return;

    libvlc_toggle_teletext(p_obj->u.p_mp);
}

jint Java_org_videolan_libvlc_MediaPlayer_nativeGetTeletext(JNIEnv *env, jobject thiz) {
    vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);

    if (!p_obj)
        return 0;

    return libvlc_video_get_teletext(p_obj->u.p_mp);
}

void Java_org_videolan_libvlc_MediaPlayer_nativeSetTeletext(JNIEnv *env, jobject thiz, jint index) {
    vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);

    if (!p_obj)
        return;

    libvlc_video_set_teletext(p_obj->u.p_mp, index);
}

In MediaPlayer.java

public void ToggleTeletext() {
    nativeToggleTeletext();
}

public int GetTeletext() {
    return nativeGetTeletext();
}

public void SetTeletext(int index) {
    nativeSetTeletext(index);
}

/* JNI */
private native void nativeToggleTeletext();
private native int nativeGetTeletext();
private native void nativeSetTeletext(int index);

After that, libvlc should be recompiled. I tried to recompile latest official version of vlc for android, but I get some strange errors, even code looks good to me.

Maybe someone know why this error happen:

../../src/modules/bank.c:672:9: error: implicit declaration of function 'twalk' is invalid in C99 [-Werror,-Wimplicit-function-declaration] twalk(modules.caps_tree, vlc_modcap_sort);

ipejasinovic commented 7 years ago

No need to bother, I've managed to compile latest version of VLC by my self. NDK was issue. It says that version must be 13 and above, but actually, it has to be 13 only.