[Android] Implement ML flush user thumbs

Nicolas Pomepuy git at videolan.org
Thu Jun 10 11:15:41 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri May 21 07:31:27 2021 +0200| [a61928eddddec9e8bc41f6665f4f1c900af7c865] | committer: Nicolas Pomepuy

Implement ML flush user thumbs

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

 buildsystem/compile-medialibrary.sh                                | 2 +-
 medialibrary/jni/AndroidMediaLibrary.cpp                           | 6 ++++++
 medialibrary/jni/AndroidMediaLibrary.h                             | 1 +
 medialibrary/jni/medialibrary.cpp                                  | 7 +++++++
 medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java   | 5 +++++
 .../src/org/videolan/medialibrary/interfaces/Medialibrary.java     | 1 +
 .../src/org/videolan/medialibrary/stubs/StubMedialibrary.java      | 4 ++++
 7 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/buildsystem/compile-medialibrary.sh b/buildsystem/compile-medialibrary.sh
index f29df5926..93b3033a2 100755
--- a/buildsystem/compile-medialibrary.sh
+++ b/buildsystem/compile-medialibrary.sh
@@ -4,7 +4,7 @@
 # ARGUMENTS #
 #############
 
-MEDIALIBRARY_HASH=857965797eab40c24f36fbdeaecebad9d3e10ddc
+MEDIALIBRARY_HASH=48da0cd521554be2e16abc90f65fcf105af314c8
 
 while [ $# -gt 0 ]; do
   case $1 in
diff --git a/medialibrary/jni/AndroidMediaLibrary.cpp b/medialibrary/jni/AndroidMediaLibrary.cpp
index b30529ff3..4cb8770ff 100644
--- a/medialibrary/jni/AndroidMediaLibrary.cpp
+++ b/medialibrary/jni/AndroidMediaLibrary.cpp
@@ -366,6 +366,12 @@ AndroidMediaLibrary::removeExternalMedia(long id)
     return media != nullptr && p_ml->removeExternalMedia(media);
 }
 
+bool
+AndroidMediaLibrary::flushUserProvidedThumbnails()
+{
+    return p_ml->flushUserProvidedThumbnails();
+}
+
 medialibrary::MediaPtr
 AndroidMediaLibrary::addStream(const std::string& mrl, const std::string& title)
 {
diff --git a/medialibrary/jni/AndroidMediaLibrary.h b/medialibrary/jni/AndroidMediaLibrary.h
index 4b136f836..35299f510 100644
--- a/medialibrary/jni/AndroidMediaLibrary.h
+++ b/medialibrary/jni/AndroidMediaLibrary.h
@@ -84,6 +84,7 @@ public:
     medialibrary::MediaPtr media(const std::string& mrl);
     medialibrary::MediaPtr addMedia(const std::string& mrl, long duration);
     bool removeExternalMedia(long id);
+    bool flushUserProvidedThumbnails();
     medialibrary::MediaPtr addStream(const std::string& mrl, const std::string& title);
     medialibrary::Query<medialibrary::IMedia> videoFiles( const medialibrary::QueryParameters* params = nullptr );
     medialibrary::Query<medialibrary::IMedia> audioFiles( const medialibrary::QueryParameters* params = nullptr );
diff --git a/medialibrary/jni/medialibrary.cpp b/medialibrary/jni/medialibrary.cpp
index 956415649..f5e0ca9e2 100644
--- a/medialibrary/jni/medialibrary.cpp
+++ b/medialibrary/jni/medialibrary.cpp
@@ -744,6 +744,12 @@ removeExternalMedia(JNIEnv* env, jobject thiz, jlong id) {
     return aml->removeExternalMedia(id);
 }
 
+jboolean
+flushUserProvidedThumbnails(JNIEnv* env, jobject thiz) {
+    AndroidMediaLibrary *aml = MediaLibrary_getInstance(env, thiz);
+    return aml->flushUserProvidedThumbnails();
+}
+
 jobject
 addStream(JNIEnv* env, jobject thiz, jstring mrl, jstring title) {
     AndroidMediaLibrary *aml = MediaLibrary_getInstance(env, thiz);
@@ -2051,6 +2057,7 @@ static JNINativeMethod methods[] = {
     {"nativeGetMediaFromMrl", "(Ljava/lang/String;)Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)getMediaFromMrl },
     {"nativeAddMedia", "(Ljava/lang/String;J)Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)addMedia },
     {"nativeRemoveExternalMedia", "(J)Z", (void*)removeExternalMedia },
+    {"nativeFlushUserProvidedThumbnails", "()Z", (void*)flushUserProvidedThumbnails },
     {"nativeAddStream", "(Ljava/lang/String;Ljava/lang/String;)Lorg/videolan/medialibrary/interfaces/media/MediaWrapper;", (void*)addStream },
     {"nativeGetVideoCount", "()I", (void*)getVideoCount },
     {"nativeGetAudioCount", "()I", (void*)getAudioCount },
diff --git a/medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java b/medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java
index c50303c87..2beaa6d1a 100644
--- a/medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java
+++ b/medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java
@@ -460,6 +460,10 @@ public class MedialibraryImpl extends Medialibrary {
         return mIsInitiated && nativeRemoveExternalMedia(id);
     }
 
+    public boolean flushUserProvidedThumbnails() {
+        return mIsInitiated && nativeFlushUserProvidedThumbnails();
+    }
+
     @Nullable
     public MediaWrapper addStream(String mrl, String title) {
         final String vlcMrl = Tools.encodeVLCMrl(mrl);
@@ -608,6 +612,7 @@ public class MedialibraryImpl extends Medialibrary {
     private native MediaWrapper nativeGetMediaFromMrl(String mrl);
     private native MediaWrapper nativeAddMedia(String mrl, long duration);
     private native boolean nativeRemoveExternalMedia(long id);
+    private native boolean nativeFlushUserProvidedThumbnails();
     private native MediaWrapper nativeAddStream(String mrl, String title);
     private native MediaWrapper[] nativeGetVideos();
     private native MediaWrapper[] nativeGetSortedVideos(int sort, boolean desc, boolean includeMissing);
diff --git a/medialibrary/src/org/videolan/medialibrary/interfaces/Medialibrary.java b/medialibrary/src/org/videolan/medialibrary/interfaces/Medialibrary.java
index e3984e78f..ed7a36c22 100644
--- a/medialibrary/src/org/videolan/medialibrary/interfaces/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/interfaces/Medialibrary.java
@@ -746,6 +746,7 @@ abstract public class Medialibrary {
     abstract public MediaWrapper getMedia(String mrl);
     abstract public MediaWrapper addMedia(String mrl, long duration);
     abstract public boolean removeExternalMedia(long id);
+    abstract public boolean flushUserProvidedThumbnails();
     abstract public MediaWrapper addStream(String mrl, String title);
     abstract public Folder[] getFolders(int type, int sort, boolean desc, boolean includeMissing, int nbItems, int offset);
     abstract public int getFoldersCount(int type);
diff --git a/medialibrary/src/org/videolan/medialibrary/stubs/StubMedialibrary.java b/medialibrary/src/org/videolan/medialibrary/stubs/StubMedialibrary.java
index 4ac453737..e5f5e5de5 100644
--- a/medialibrary/src/org/videolan/medialibrary/stubs/StubMedialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/stubs/StubMedialibrary.java
@@ -461,6 +461,10 @@ public class StubMedialibrary extends Medialibrary {
         return true;
     }
 
+    public boolean flushUserProvidedThumbnails() {
+        return true;
+    }
+
     public MediaWrapper addStream(String mrl, String title) {
         return dt.addMediaWrapper(mrl, title, MediaWrapper.TYPE_STREAM);
     }



More information about the Android mailing list