[Android] VideoGridFragment: use Media class

Thomas Guillem git at videolan.org
Tue Jan 20 12:05:46 CET 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jan 15 19:16:46 2015 +0100| [0f584258dd9e8f6b74e2cc7c80219b934e5a7989] | committer: Thomas Guillem

VideoGridFragment: use Media class

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

 .../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 77b808d..bc233cb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -58,7 +58,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 BrowserFragment implements ISortable, IVi
         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);
     }
 



More information about the Android mailing list