[Android] [PATCH 02/13] move Media flags to LibVLC

Jean-Baptiste Kempf jb at videolan.org
Thu Jan 15 20:12:05 CET 2015


OK.

On 15 Jan, Thomas Guillem wrote :
> ---
>  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..78e1bc5 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_FLAG_NO_VIDEO   = 0x01;
> +    public final static int MEDIA_FLAG_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_FLAG_NO_HWACCEL) != 0;
> +        final boolean noVideo = (flags & MEDIA_FLAG_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..62f2977 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_FLAG_NO_VIDEO);
>                  mediaList.add(media);
>              }
>  
> -- 
> 2.1.3
> 
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android

-- 
With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device


More information about the Android mailing list