[Android] jni: add addSubtitleTrack()

Edward Wang git at videolan.org
Sun Jun 16 05:55:51 CEST 2013


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Fri Jun 14 17:41:49 2013 -0400| [67bb4b006d45aded68d32f8ba2c6c6ca79eec743] | committer: Edward Wang

jni: add addSubtitleTrack()

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=67bb4b006d45aded68d32f8ba2c6c6ca79eec743
---

 vlc-android/jni/libvlcjni.c                     |   14 ++++++++++++++
 vlc-android/src/org/videolan/libvlc/LibVLC.java |    2 ++
 2 files changed, 16 insertions(+)

diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index 74e0f70..cd9c830 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -1252,6 +1252,20 @@ jint Java_org_videolan_libvlc_LibVLC_setSpuTrack(JNIEnv *env, jobject thiz, jint
     return -1;
 }
 
+jint Java_org_videolan_libvlc_LibVLC_addSubtitleTrack(JNIEnv *env, jobject thiz, jstring path)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp) {
+        jboolean isCopy;
+        const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy);
+        jint res = libvlc_video_set_subtitle_file(mp, psz_path);
+        (*env)->ReleaseStringUTFChars(env, path, psz_path);
+        return res;
+    } else {
+        return -1;
+    }
+}
+
 void Java_org_videolan_libvlc_LibVLC_nativeReadDirectory(JNIEnv *env, jobject thiz, jstring path, jobject arrayList)
 {
     jboolean isCopy;
diff --git a/vlc-android/src/org/videolan/libvlc/LibVLC.java b/vlc-android/src/org/videolan/libvlc/LibVLC.java
index f0cbce4..62bc6d2 100644
--- a/vlc-android/src/org/videolan/libvlc/LibVLC.java
+++ b/vlc-android/src/org/videolan/libvlc/LibVLC.java
@@ -510,6 +510,8 @@ public class LibVLC {
 
     public native int getVideoTracksCount();
 
+    public native int addSubtitleTrack(String path);
+
     public native Map<Integer,String> getSpuTrackDescription();
 
     public native int getSpuTrack();



More information about the Android mailing list