[Android] Implement medialibrary forceRescan()
Geoffrey Métais
git at videolan.org
Mon Jan 29 16:47:42 CET 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jan 29 16:04:34 2018 +0100| [7d8cfdad497b8f8446962330ae509b0713ebd01f] | committer: Geoffrey Métais
Implement medialibrary forceRescan()
> https://code.videolan.org/videolan/vlc-android/commit/7d8cfdad497b8f8446962330ae509b0713ebd01f
---
medialibrary/jni/AndroidMediaLibrary.cpp | 6 ++++++
medialibrary/jni/AndroidMediaLibrary.h | 1 +
medialibrary/jni/medialibrary.cpp | 8 ++++++++
medialibrary/src/org/videolan/medialibrary/Medialibrary.java | 8 ++++++--
4 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/medialibrary/jni/AndroidMediaLibrary.cpp b/medialibrary/jni/AndroidMediaLibrary.cpp
index e9acb4fd4..3d6805b5a 100644
--- a/medialibrary/jni/AndroidMediaLibrary.cpp
+++ b/medialibrary/jni/AndroidMediaLibrary.cpp
@@ -166,6 +166,12 @@ AndroidMediaLibrary::forceParserRetry()
p_ml->forceParserRetry();
}
+void
+AndroidMediaLibrary::forceRescan()
+{
+ p_ml->forceRescan();
+}
+
bool
AndroidMediaLibrary::increasePlayCount(int64_t mediaId)
{
diff --git a/medialibrary/jni/AndroidMediaLibrary.h b/medialibrary/jni/AndroidMediaLibrary.h
index 8a0dc136d..57ebf3d5c 100644
--- a/medialibrary/jni/AndroidMediaLibrary.h
+++ b/medialibrary/jni/AndroidMediaLibrary.h
@@ -45,6 +45,7 @@ public:
void reload();
void reload( const std::string& entryPoint );
void forceParserRetry();
+ void forceRescan();
bool increasePlayCount(int64_t mediaId);
/* History */
std::vector<medialibrary::MediaPtr> lastMediaPlayed();
diff --git a/medialibrary/jni/medialibrary.cpp b/medialibrary/jni/medialibrary.cpp
index 99f233145..a0b5173b8 100644
--- a/medialibrary/jni/medialibrary.cpp
+++ b/medialibrary/jni/medialibrary.cpp
@@ -191,6 +191,13 @@ forceParserRetry(JNIEnv* env, jobject thiz)
aml->forceParserRetry();
}
+void
+forceRescan(JNIEnv* env, jobject thiz)
+{
+ AndroidMediaLibrary *aml = MediaLibrary_getInstance(env, thiz);
+ aml->forceRescan();
+}
+
jboolean
increasePlayCount(JNIEnv* env, jobject thiz, jlong id)
{
@@ -804,6 +811,7 @@ static JNINativeMethod methods[] = {
{"nativeReload", "()V", (void*)reload },
{"nativeReload", "(Ljava/lang/String;)V", (void*)reloadEntryPoint },
{"nativeForceParserRetry", "()V", (void*)forceParserRetry },
+ {"nativeForceRescan", "()V", (void*)forceRescan },
{"nativeIncreasePlayCount", "(J)Z", (void*)increasePlayCount },
{"nativeSetMediaUpdatedCbFlag", "(I)V", (void*)setMediaUpdatedCbFlag },
{"nativeSetMediaAddedCbFlag", "(I)V", (void*)setMediaAddedCbFlag },
diff --git a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
index 04dc968c3..c2220cae2 100644
--- a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
@@ -242,8 +242,11 @@ public class Medialibrary {
}
public void forceParserRetry() {
- if (mIsInitiated)
- nativeForceParserRetry();
+ if (mIsInitiated) nativeForceParserRetry();
+ }
+
+ public void forceRescan() {
+ if (mIsInitiated) nativeForceRescan();
}
@WorkerThread
@@ -651,6 +654,7 @@ public class Medialibrary {
private native void nativeReload();
private native void nativeReload(String entryPoint);
private native void nativeForceParserRetry();
+ private native void nativeForceRescan();
private native boolean nativeIncreasePlayCount(long mediaId);
private native void nativeSetMediaUpdatedCbFlag(int flags);
private native void nativeSetMediaAddedCbFlag(int flags);
More information about the Android
mailing list