[Android] [PATCH 11/13] VideoGridFragment: use Media class
Thomas Guillem
thomas at gllm.fr
Thu Jan 15 19:22:28 CET 2015
---
.../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
More information about the Android
mailing list