[Android] Filter files to add to medialib
Geoffrey Métais
git at videolan.org
Thu Mar 26 16:13:16 CET 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Mar 26 16:07:56 2015 +0100| [09a7d5570ab0aa5279e01d18905d6609bae2a576] | committer: Geoffrey Métais
Filter files to add to medialib
Fixes system mod files added in Library
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=09a7d5570ab0aa5279e01d18905d6609bae2a576
---
vlc-android/src/org/videolan/vlc/MediaLibrary.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/MediaLibrary.java b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
index 73ddcd4..fd2d752 100644
--- a/vlc-android/src/org/videolan/vlc/MediaLibrary.java
+++ b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
@@ -366,12 +366,17 @@ public class MediaLibrary {
final Media media = new Media(libVlcInstance, fileURI);
media.parse();
media.release();
+ /* skip files with audio/video extension but no known codec */
+ if (media.getDuration() == 0 ||
+ (media.getTrackCount() == 1 && media.getTrack(0).codec.isEmpty())) {
+ mItemListLock.writeLock().unlock();
+ continue;
+ }
MediaWrapper mw = new MediaWrapper(media);
mw.setLastModified(file.lastModified());
mItemList.add(mw);
// Add this item to database
- MediaDatabase db = MediaDatabase.getInstance();
- db.addMedia(mw);
+ mediaDatabase.addMedia(mw);
mItemListLock.writeLock().unlock();
}
if (isStopping) {
More information about the Android
mailing list