[Android] libvlc: move Media flags to LibVLC

Thomas Guillem git at videolan.org
Mon Jan 19 09:43:26 CET 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jan 15 16:57:39 2015 +0100| [5a4f0db044ea7537d51883ae145b4cc31684285a] | committer: Thomas Guillem

libvlc: move Media flags to LibVLC

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

 libvlc/src/org/videolan/libvlc/LibVLC.java               |   14 ++++++--------
 libvlc/src/org/videolan/libvlc/Media.java                |    3 ---
 libvlc/src/org/videolan/libvlc/MediaListPlayer.java      |    2 +-
 vlc-android/src/org/videolan/vlc/audio/AudioService.java |    2 +-
 4 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index 8632b4a..8e881da 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -56,6 +56,9 @@ public class LibVLC {
     public static final int INPUT_NAV_LEFT = 3;
     public static final int INPUT_NAV_RIGHT = 4;
 
+    public final static int MEDIA_NO_VIDEO   = 0x01;
+    public final static int MEDIA_NO_HWACCEL = 0x02;
+
     private static final String DEFAULT_CODEC_LIST = "mediacodec,iomx,all";
     private static final boolean HAS_WINDOW_VOUT = LibVlcUtil.isGingerbreadOrLater();
 
@@ -340,14 +343,9 @@ public class LibVLC {
         return options.toArray(new String[options.size()]);
     }
 
-    public String[] getMediaOptions(Media media) {
-        boolean noHardwareAcceleration = false;
-        boolean noVideo = false;
-        if (media != null) {
-            final int flags = media.getFlags();
-            noHardwareAcceleration = (flags & Media.FLAG_NO_HWACCEL) != 0;
-            noVideo = (flags & Media.FLAG_NO_VIDEO) != 0;
-        }
+    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); 
     }
 
diff --git a/libvlc/src/org/videolan/libvlc/Media.java b/libvlc/src/org/videolan/libvlc/Media.java
index 02ae924..62ba1e5 100644
--- a/libvlc/src/org/videolan/libvlc/Media.java
+++ b/libvlc/src/org/videolan/libvlc/Media.java
@@ -73,9 +73,6 @@ public class Media implements Parcelable {
     public final static int TYPE_AUDIO = 1;
     public final static int TYPE_GROUP = 2;
 
-    public final static int FLAG_NO_VIDEO   = 0x01;
-    public final static int FLAG_NO_HWACCEL = 0x02;
-
     /** Metadata from libvlc_media */
     protected String mTitle;
     private String mArtist;
diff --git a/libvlc/src/org/videolan/libvlc/MediaListPlayer.java b/libvlc/src/org/videolan/libvlc/MediaListPlayer.java
index 50dc061..a7fa532 100644
--- a/libvlc/src/org/videolan/libvlc/MediaListPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaListPlayer.java
@@ -49,7 +49,7 @@ public class MediaListPlayer {
             return;
 
         final Media media = mMediaList.getMedia(position);
-        String[] options = mLibVLC.getMediaOptions(media);
+        String[] options = mLibVLC.getMediaOptions(media != null ? media.getFlags() : 0);
         mPlayerIndex = position;
         mLibVLC.playMRL(mrl, options);
     }
diff --git a/vlc-android/src/org/videolan/vlc/audio/AudioService.java b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
index e7eb229..93f8a4b 100644
--- a/vlc-android/src/org/videolan/vlc/audio/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
@@ -1224,7 +1224,7 @@ public class AudioService extends Service {
                     media = new Media(mLibVLC, location);
                 }
                 if (noVideo)
-                    media.addFlags(Media.FLAG_NO_VIDEO);
+                    media.addFlags(LibVLC.MEDIA_NO_VIDEO);
                 mediaList.add(media);
             }
 



More information about the Android mailing list