[Android] Libvlc: listen to Seekable/Pausable events

Thomas Guillem git at videolan.org
Thu Oct 22 11:01:19 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Oct 22 10:54:45 2015 +0200| [d97f6caa88205b45565dc765c02713d2071bbdf3] | committer: Thomas Guillem

Libvlc: listen to Seekable/Pausable events

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

 libvlc/jni/libvlcjni-mediaplayer.c              |    8 ++++++++
 libvlc/src/org/videolan/libvlc/MediaPlayer.java |   12 ++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/libvlc/jni/libvlcjni-mediaplayer.c b/libvlc/jni/libvlcjni-mediaplayer.c
index 817ffcd..ec5df6b 100644
--- a/libvlc/jni/libvlcjni-mediaplayer.c
+++ b/libvlc/jni/libvlcjni-mediaplayer.c
@@ -40,6 +40,8 @@ static const libvlc_event_type_t mp_events[] = {
     libvlc_MediaPlayerVout,
     libvlc_MediaPlayerESAdded,
     libvlc_MediaPlayerESDeleted,
+    libvlc_MediaPlayerSeekableChanged,
+    libvlc_MediaPlayerPausableChanged,
     -1,
 };
 
@@ -86,6 +88,12 @@ MediaPlayer_event_cb(vlcjni_object *p_obj, const libvlc_event_t *p_ev,
         case libvlc_MediaPlayerESDeleted:
             p_java_event->arg1 = p_ev->u.media_player_es_changed.i_type;
             break;
+        case libvlc_MediaPlayerSeekableChanged:
+            p_java_event->arg1 = p_ev->u.media_player_seekable_changed.new_seekable;
+            break;
+        case libvlc_MediaPlayerPausableChanged:
+            p_java_event->arg1 = p_ev->u.media_player_pausable_changed.new_pausable;
+            break;
     }
     p_java_event->type = p_ev->type;
     return true;
diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index 4dd6c0c..5215634 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -39,8 +39,8 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
         public static final int EncounteredError   = 0x10a;
         public static final int TimeChanged         = 0x10b;
         public static final int PositionChanged     = 0x10c;
-        //public static final int SeekableChanged     = 0x10d;
-        //public static final int PausableChanged     = 0x10e;
+        public static final int SeekableChanged     = 0x10d;
+        public static final int PausableChanged     = 0x10e;
         //public static final int TitleChanged        = 0x10f;
         //public static final int SnapshotTaken       = 0x110;
         //public static final int LengthChanged       = 0x111;
@@ -79,6 +79,12 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
         public int getEsChangedType() {
             return (int) arg1;
         }
+        public boolean getPausable() {
+            return arg1 != 0;
+        }
+        public boolean getSeekable() {
+            return arg1 != 0;
+        }
     }
 
     public interface EventListener extends VLCEvent.Listener<MediaPlayer.Event> {}
@@ -814,6 +820,8 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
                 return new Event(eventType, arg1);
             case Event.ESAdded:
             case Event.ESDeleted:
+            case Event.SeekableChanged:
+            case Event.PausableChanged:
                 return new Event(eventType, arg1);
         }
         return null;



More information about the Android mailing list