[Android] MediaPlayer: fix build with new title api changes

Thomas Guillem git at videolan.org
Mon Dec 21 14:46:49 CET 2015


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Dec 21 14:46:40 2015 +0100| [94d3c15122d54b4ab29e0d6a7ca530ab9bd7a148] | committer: Thomas Guillem

MediaPlayer: fix build with new title api changes

> https://code.videolan.org/videolan/vlc-android/commit/94d3c15122d54b4ab29e0d6a7ca530ab9bd7a148
---

 libvlc/jni/libvlcjni-mediaplayer.c                 |  2 +-
 libvlc/jni/libvlcjni.c                             |  2 +-
 libvlc/src/org/videolan/libvlc/MediaPlayer.java    | 22 +++++++++++++++++-----
 .../vlc/gui/video/VideoPlayerActivity.java         |  2 +-
 4 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/libvlc/jni/libvlcjni-mediaplayer.c b/libvlc/jni/libvlcjni-mediaplayer.c
index ec5df6b..d02f427 100644
--- a/libvlc/jni/libvlcjni-mediaplayer.c
+++ b/libvlc/jni/libvlcjni-mediaplayer.c
@@ -529,7 +529,7 @@ mediaplayer_title_to_object(JNIEnv *env, libvlc_title_description_t *p_title)
                         fields.MediaPlayer.createTitleFromNativeID,
                         p_title->i_duration,
                         jname,
-                        p_title->b_menu);
+                        p_title->i_flags);
 }
 
 jobject
diff --git a/libvlc/jni/libvlcjni.c b/libvlc/jni/libvlcjni.c
index 034a350..ada6929 100644
--- a/libvlc/jni/libvlcjni.c
+++ b/libvlc/jni/libvlcjni.c
@@ -249,7 +249,7 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved)
            fields.MediaPlayer.createTitleFromNativeID,
            fields.MediaPlayer.clazz,
            "createTitleFromNative",
-           "(JLjava/lang/String;Z)Lorg/videolan/libvlc/MediaPlayer$Title;");
+           "(JLjava/lang/String;I)Lorg/videolan/libvlc/MediaPlayer$Title;");
 
     GET_ID(GetStaticMethodID,
            fields.MediaPlayer.createChapterFromNativeID,
diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index 32e67a0..f1a8935 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -104,6 +104,10 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
     }
 
     public static class Title {
+        private static class Flags {
+            public static final int MENU = 0x01;
+            public static final int INTERACTIVE = 0x02;
+        };
         /**
          * duration in milliseconds
          */
@@ -117,18 +121,26 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
         /**
          * true if the title is a menu
          */
-        public final boolean menu;
+        private final int flags;
 
-        public Title(long duration, String name, boolean menu) {
+        public Title(long duration, String name, int flags) {
             this.duration = duration;
             this.name = name;
-            this.menu = menu;
+            this.flags = flags;
+        }
+
+        public boolean isMenu() {
+            return (this.flags & Flags.MENU) != 0;
+        }
+
+        public boolean isInteractive() {
+            return (this.flags & Flags.INTERACTIVE) != 0;
         }
     }
 
     @SuppressWarnings("unused") /* Used from JNI */
-    private static Title createTitleFromNative(long duration, String name, boolean menu) {
-        return new Title(duration, name, menu);
+    private static Title createTitleFromNative(long duration, String name, int flags) {
+        return new Title(duration, name, flags);
     }
 
     public static class Chapter {
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index fde885e..388cc60 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -3207,7 +3207,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             final int currentIdx = mService.getTitleIdx();
             for (int i = 0; i < titles.length; ++i) {
                 final MediaPlayer.Title title = titles[i];
-                if (title.menu) {
+                if (title.isMenu()) {
                     mMenuIdx = i;
                     break;
                 }



More information about the Android mailing list