[Android] [PATCH 1/2] LibVLC: add MEDIA_PAUSED flag that set "start-paused"

Thomas Guillem thomas at gllm.fr
Mon Mar 23 14:52:07 CET 2015


---
 libvlc/src/org/videolan/libvlc/LibVLC.java | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index 01bed0b..d4240a5 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -57,6 +57,7 @@ public class LibVLC {
 
     public final static int MEDIA_NO_VIDEO   = 0x01;
     public final static int MEDIA_NO_HWACCEL = 0x02;
+    public final static int MEDIA_PAUSED = 0x4;
 
     private static final String DEFAULT_CODEC_LIST = "mediacodec,iomx,all";
     private static final boolean HAS_WINDOW_VOUT = LibVlcUtil.isGingerbreadOrLater();
@@ -266,6 +267,16 @@ public class LibVLC {
     }
 
     public String[] getMediaOptions(boolean noHardwareAcceleration, boolean noVideo) {
+        final int flag = (noHardwareAcceleration ? MEDIA_NO_HWACCEL : 0) |
+                         (noVideo ? MEDIA_NO_VIDEO : 0);
+        return getMediaOptions(flag);
+    }
+
+    public String[] getMediaOptions(int flags) {
+        boolean noHardwareAcceleration = (flags & MEDIA_NO_HWACCEL) != 0;
+        boolean noVideo = (flags & MEDIA_NO_VIDEO) != 0;
+        final boolean paused = (flags & MEDIA_PAUSED) != 0;
+
         if (this.devHardwareDecoder != DEV_HW_DECODER_AUTOMATIC)
             noHardwareAcceleration = noVideo = false;
         else if (!noHardwareAcceleration)
@@ -289,16 +300,11 @@ public class LibVLC {
         }
         if (noVideo)
             options.add(":no-video");
-
+        if (paused)
+            options.add(":start-paused");
         return options.toArray(new String[options.size()]);
     }
 
-    public String[] getMediaOptions(int flags) {
-        final boolean noHardwareAcceleration = (flags & MEDIA_NO_HWACCEL) != 0;
-        final boolean noVideo = (flags & MEDIA_NO_VIDEO) != 0;
-        return getMediaOptions(noHardwareAcceleration, noVideo); 
-    }
-
     public String getSubtitlesEncoding() {
         return subtitlesEncoding;
     }
-- 
2.1.3



More information about the Android mailing list