[Android] [PATCH 11/13] VideoGridFragment: use Media class

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


OK

On 15 Jan, Thomas Guillem wrote :
> ---
>  .../org/videolan/vlc/gui/video/VideoGridFragment.java   | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
> index 601022b..18ca8e7 100644
> --- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
> +++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
> @@ -59,6 +59,7 @@ import android.widget.TextView;
>  import org.videolan.libvlc.LibVLC;
>  import org.videolan.libvlc.LibVlcException;
>  import org.videolan.libvlc.LibVlcUtil;
> +import org.videolan.libvlc.Media;
>  import org.videolan.libvlc.TrackInfo;
>  import org.videolan.vlc.MediaHolder;
>  import org.videolan.vlc.MediaDatabase;
> @@ -349,19 +350,17 @@ public class VideoGridFragment extends Fragment implements IBrowser, ISortable,
>          setContextMenuItems(menu, media);
>      }
>  
> -    private void setContextMenuItems(Menu menu, MediaHolder media) {
> -        long lastTime = media.getTime();
> +    private void setContextMenuItems(Menu menu, MediaHolder mediaHolder) {
> +        long lastTime = mediaHolder.getTime();
>          if (lastTime > 0)
>              menu.findItem(R.id.video_list_play_from_start).setVisible(true);
>  
>          boolean hasInfo = false;
> -        TrackInfo[] tracks = mLibVlc.readTracksInfo(media.getLocation());
> -        for (TrackInfo track : tracks) {
> -            if (track.Type != TrackInfo.TYPE_META) {
> -                hasInfo = true;
> -                break;
> -            }
> -        }
> +        final Media media = new Media(mLibVlc, mediaHolder.getLocation());
> +        media.parse();
> +        media.release();
> +        if (media.getMeta(Media.Meta.Title) != null)
> +            hasInfo = true;
>          menu.findItem(R.id.video_list_info).setVisible(hasInfo);
>      }
>  
> -- 
> 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