[Android] LibVLC: Send LengthChanged events

Geoffrey Métais git at videolan.org
Thu Feb 8 15:44:10 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Feb  8 15:40:14 2018 +0100| [e6703a9fa24b1ed08f603531f5c5ca5fa9e4393c] | committer: Geoffrey Métais

LibVLC: Send LengthChanged events

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

 libvlc/jni/libvlcjni-mediaplayer.c              | 4 ++++
 libvlc/src/org/videolan/libvlc/MediaPlayer.java | 9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/libvlc/jni/libvlcjni-mediaplayer.c b/libvlc/jni/libvlcjni-mediaplayer.c
index ad717f519..ffa3586e9 100644
--- a/libvlc/jni/libvlcjni-mediaplayer.c
+++ b/libvlc/jni/libvlcjni-mediaplayer.c
@@ -44,6 +44,7 @@ static const libvlc_event_type_t mp_events[] = {
     libvlc_MediaPlayerESSelected,
     libvlc_MediaPlayerSeekableChanged,
     libvlc_MediaPlayerPausableChanged,
+    libvlc_MediaPlayerLengthChanged,
     -1,
 };
 
@@ -102,6 +103,9 @@ MediaPlayer_event_cb(vlcjni_object *p_obj, const libvlc_event_t *p_ev,
         case libvlc_MediaPlayerPausableChanged:
             p_java_event->arg1 = p_ev->u.media_player_pausable_changed.new_pausable;
             break;
+        case libvlc_MediaPlayerLengthChanged:
+            p_java_event->arg1 = p_ev->u.media_player_length_changed.new_length;
+            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 8a4008d7c..9be5b6bc3 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -62,7 +62,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
         public static final int PausableChanged     = 0x10e;
         //public static final int TitleChanged        = 0x10f;
         //public static final int SnapshotTaken       = 0x110;
-        //public static final int LengthChanged       = 0x111;
+        public static final int LengthChanged       = 0x111;
         public static final int Vout                = 0x112;
         //public static final int ScrambledChanged    = 0x113;
         public static final int ESAdded             = 0x114;
@@ -87,6 +87,11 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
         public long getTimeChanged() {
             return arg1;
         }
+
+        public long getLengthChanged() {
+            return arg1;
+        }
+
         public float getPositionChanged() {
             return argf1;
         }
@@ -1104,6 +1109,8 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
                 return new Event(eventType);
             case Event.TimeChanged:
                 return new Event(eventType, arg1);
+            case Event.LengthChanged:
+                return new Event(eventType, arg1);
             case Event.PositionChanged:
                 return new Event(eventType, argf1);
             case Event.Vout:



More information about the Android mailing list