[Android] [PATCH 12/14] VideoGridFragment: use Media class

Thomas Guillem thomas at gllm.fr
Fri Jan 16 17:12:12 CET 2015


---
 .../org/videolan/vlc/gui/video/VideoGridFragment.java  | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 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 fdc8937..88fa0d6 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -59,7 +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.TrackInfo;
+import org.videolan.libvlc.Media;
 import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.MediaDatabase;
 import org.videolan.vlc.MediaGroup;
@@ -349,19 +349,17 @@ public class VideoGridFragment extends Fragment implements IBrowser, ISortable,
         setContextMenuItems(menu, media);
     }
 
-    private void setContextMenuItems(Menu menu, MediaWrapper media) {
-        long lastTime = media.getTime();
+    private void setContextMenuItems(Menu menu, MediaWrapper mediaWrapper) {
+        long lastTime = mediaWrapper.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, mediaWrapper.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



More information about the Android mailing list