[Android] Implement media.isThumbnailGenerated()

Geoffrey Métais git at videolan.org
Mon Apr 9 17:10:07 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Apr  9 15:43:55 2018 +0200| [8cd8efb5f795d6541c14c31f7890b9683957f7cf] | committer: Geoffrey Métais

Implement media.isThumbnailGenerated()

> https://code.videolan.org/videolan/vlc-android/commit/8cd8efb5f795d6541c14c31f7890b9683957f7cf
---

 medialibrary/jni/medialibrary.cpp                             |  2 +-
 medialibrary/jni/utils.cpp                                    |  2 +-
 .../src/org/videolan/medialibrary/media/MediaWrapper.java     | 11 ++++++++---
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/medialibrary/jni/medialibrary.cpp b/medialibrary/jni/medialibrary.cpp
index 255101add..781b377c7 100644
--- a/medialibrary/jni/medialibrary.cpp
+++ b/medialibrary/jni/medialibrary.cpp
@@ -986,7 +986,7 @@ int MediaLibraryJNI_OnLoad(JavaVM *vm, JNIEnv* env)
     GET_ID(GetMethodID,
            ml_fields.MediaWrapper.initID,
            ml_fields.MediaWrapper.clazz,
-           "<init>", "(JLjava/lang/String;JJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IILjava/lang/String;IIIIJJ)V");
+           "<init>", "(JLjava/lang/String;JJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IILjava/lang/String;IIIIJJZ)V");
 
     GET_CLASS(ml_fields.HistoryItem.clazz,
               "org/videolan/medialibrary/media/HistoryItem", true);
diff --git a/medialibrary/jni/utils.cpp b/medialibrary/jni/utils.cpp
index 1cc8f488c..4f4c49094 100644
--- a/medialibrary/jni/utils.cpp
+++ b/medialibrary/jni/utils.cpp
@@ -78,7 +78,7 @@ mediaToMediaWrapper(JNIEnv* env, fields *fields, medialibrary::MediaPtr const& m
                           (jlong) mediaPtr->id(), mrl,(jlong) progress, (jlong) duration, type,
                           title, artist, genre, album,
                           albumArtist, width, height, thumbnail,
-                          audioTrack, spuTrack, trackNumber, discNumber, (jlong) files.at(0)->lastModificationDate(), seen);
+                          audioTrack, spuTrack, trackNumber, discNumber, (jlong) files.at(0)->lastModificationDate(), seen, mediaPtr->isThumbnailGenerated());
     if (artist != NULL)
         env->DeleteLocalRef(artist);
     if (genre != NULL)
diff --git a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
index 52272e1c7..16097404c 100644
--- a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
+++ b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
@@ -100,6 +100,7 @@ public class MediaWrapper extends MediaLibraryItem implements Parcelable {
     private String mEncodedBy;
     private String mTrackID;
     private String mArtworkURL;
+    private boolean mThumbnailGenerated;
 
     private final Uri mUri;
     private String mFilename;
@@ -126,10 +127,9 @@ public class MediaWrapper extends MediaLibraryItem implements Parcelable {
     public MediaWrapper(long id, String mrl, long time, long length, int type, String title,
                         String artist, String genre, String album, String albumArtist, int width,
                         int height, String artworkURL, int audio, int spu, int trackNumber,
-                        int discNumber, long lastModified, long seen) {
+                        int discNumber, long lastModified, long seen, boolean isThumbnailGenerated) {
         super();
-        if (TextUtils.isEmpty(mrl))
-            throw new IllegalArgumentException("uri was empty");
+        if (TextUtils.isEmpty(mrl)) throw new IllegalArgumentException("uri was empty");
 
         if (mrl.charAt(0) == '/')
             mrl = "file://"+mrl;
@@ -156,6 +156,7 @@ public class MediaWrapper extends MediaLibraryItem implements Parcelable {
         if (sb.length() > 0)
             mDescription = sb.toString();
         defineType();
+        mThumbnailGenerated = isThumbnailGenerated;
     }
 
     /**
@@ -552,6 +553,10 @@ public class MediaWrapper extends MediaLibraryItem implements Parcelable {
         return mArtworkURL;
     }
 
+    public boolean isThumbnailGenerated() {
+        return mThumbnailGenerated;
+    }
+
     public String getArtworkMrl() {
         return mArtworkURL;
     }



More information about the Android mailing list