[Android] Ml: add new refreshAllSubscriptions API
Duncan McNamara
git at videolan.org
Fri Nov 18 12:29:46 UTC 2022
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Thu Nov 17 16:42:19 2022 +0100| [8e8f82fbfd5cac5539531e1f38c8c4aef8c07b76] | committer: Nicolas Pomepuy
Ml: add new refreshAllSubscriptions API
> https://code.videolan.org/videolan/vlc-android/commit/8e8f82fbfd5cac5539531e1f38c8c4aef8c07b76
---
medialibrary/jni/AndroidMediaLibrary.cpp | 6 ++++++
medialibrary/jni/AndroidMediaLibrary.h | 1 +
medialibrary/jni/medialibrary.cpp | 7 +++++++
medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java | 6 ++++++
.../src/org/videolan/medialibrary/interfaces/Medialibrary.java | 1 +
.../src/org/videolan/medialibrary/stubs/StubMedialibrary.java | 5 +++++
6 files changed, 26 insertions(+)
diff --git a/medialibrary/jni/AndroidMediaLibrary.cpp b/medialibrary/jni/AndroidMediaLibrary.cpp
index 5989aaff07..1782d461fb 100644
--- a/medialibrary/jni/AndroidMediaLibrary.cpp
+++ b/medialibrary/jni/AndroidMediaLibrary.cpp
@@ -1231,6 +1231,12 @@ AndroidMediaLibrary::getGlobalSubscriptionMaxCacheSize()
return p_ml->getMaxCacheSize();
}
+bool
+AndroidMediaLibrary::refreshAllSubscriptions()
+{
+ return p_ml->refreshAllSubscriptions();
+}
+
void AndroidMediaLibrary::onSubscriptionsAdded( std::vector<medialibrary::SubscriptionPtr> )
{
}
diff --git a/medialibrary/jni/AndroidMediaLibrary.h b/medialibrary/jni/AndroidMediaLibrary.h
index a9882dc1a4..266c7f0589 100644
--- a/medialibrary/jni/AndroidMediaLibrary.h
+++ b/medialibrary/jni/AndroidMediaLibrary.h
@@ -198,6 +198,7 @@ public:
uint32_t getSubscriptionMaxCachedMedia();
uint64_t getSubscriptionMaxCacheSize();
uint64_t getGlobalSubscriptionMaxCacheSize();
+ bool refreshAllSubscriptions();
void onSubscriptionsAdded( std::vector<medialibrary::SubscriptionPtr> );
void onSubscriptionsModified( std::set<int64_t> );
void onSubscriptionsDeleted( std::set<int64_t> );
diff --git a/medialibrary/jni/medialibrary.cpp b/medialibrary/jni/medialibrary.cpp
index 716dba2901..66cc6a5644 100644
--- a/medialibrary/jni/medialibrary.cpp
+++ b/medialibrary/jni/medialibrary.cpp
@@ -2121,6 +2121,12 @@ jlong getGlobalSubscriptionMaxCacheSize(JNIEnv* env, jobject thiz, jobject media
return aml->getGlobalSubscriptionMaxCacheSize();
}
+jboolean refreshAllSubscriptions(JNIEnv* env, jobject thiz, jobject ml)
+{
+ AndroidMediaLibrary *aml = MediaLibrary_getInstance(env, ml);
+ return aml->refreshAllSubscriptions();
+}
+
/*
* Services
*/
@@ -2527,6 +2533,7 @@ static JNINativeMethod methods[] = {
{"nativeGetSubscriptionMaxCacheMedia", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;)I", (void*)getSubscriptionMaxCachedMedia},
{"nativeGetSubscriptionMaxCacheSize", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;)J", (void*)getSubscriptionMaxCacheSize},
{"nativeGetGlobalSubscriptionMaxCacheSize", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;)J", (void*)getGlobalSubscriptionMaxCacheSize},
+ {"nativeRefreshAllSubscriptions", "(Lorg/videolan/medialibrary/interfaces/Medialibrary;)Z", (void*)refreshAllSubscriptions},
};
static JNINativeMethod media_methods[] = {
diff --git a/medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java b/medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java
index 17239c4930..b427845d25 100644
--- a/medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java
+++ b/medialibrary/src/org/videolan/medialibrary/MedialibraryImpl.java
@@ -644,6 +644,11 @@ public class MedialibraryImpl extends Medialibrary {
return mIsInitiated ? nativeGetGlobalSubscriptionMaxCacheSize(this) : -1L;
}
+ @Override
+ public boolean refreshAllSubscriptions() {
+ return mIsInitiated && nativeRefreshAllSubscriptions(this);
+ }
+
// Native methods
private native void nativeConstruct(String dbPath, String thumbsPath);
private native int nativeInit(String dbPath);
@@ -757,4 +762,5 @@ public class MedialibraryImpl extends Medialibrary {
private native int nativeGetSubscriptionMaxCacheMedia(Medialibrary ml);
private native long nativeGetSubscriptionMaxCacheSize(Medialibrary ml);
private native long nativeGetGlobalSubscriptionMaxCacheSize(Medialibrary ml);
+ private native boolean nativeRefreshAllSubscriptions(Medialibrary ml);
}
diff --git a/medialibrary/src/org/videolan/medialibrary/interfaces/Medialibrary.java b/medialibrary/src/org/videolan/medialibrary/interfaces/Medialibrary.java
index 8fa2f3f925..b9e832ca36 100644
--- a/medialibrary/src/org/videolan/medialibrary/interfaces/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/interfaces/Medialibrary.java
@@ -811,4 +811,5 @@ abstract public class Medialibrary {
abstract public int getSubscriptionMaxCachedMedia();
abstract public long getSubscriptionMaxCacheSize();
abstract public long getGlobalSubscriptionMaxCacheSize();
+ abstract public boolean refreshAllSubscriptions();
}
diff --git a/medialibrary/src/org/videolan/medialibrary/stubs/StubMedialibrary.java b/medialibrary/src/org/videolan/medialibrary/stubs/StubMedialibrary.java
index 354dbc2083..83469089c5 100644
--- a/medialibrary/src/org/videolan/medialibrary/stubs/StubMedialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/stubs/StubMedialibrary.java
@@ -730,4 +730,9 @@ public class StubMedialibrary extends Medialibrary {
public long getGlobalSubscriptionMaxCacheSize() {
return -1L;
}
+
+ @Override
+ public boolean refreshAllSubscriptions() {
+ return false;
+ }
}
More information about the Android
mailing list