[Android] Add medialibrary JNI calls for 'unbanFolder'
Geoffrey Métais
git at videolan.org
Wed Dec 6 15:15:42 CET 2017
vlc-android | branch: 2.5.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Dec 6 14:52:47 2017 +0100| [c33c701f5f1fc8c3f0a1b48f24921a1c90b39576] | committer: Geoffrey Métais
Add medialibrary JNI calls for 'unbanFolder'
(cherry picked from commit 380c3d1d14d0ebb24e9240a520ffd16c579a1778)
> https://code.videolan.org/videolan/vlc-android/commit/c33c701f5f1fc8c3f0a1b48f24921a1c90b39576
---
medialibrary/jni/AndroidMediaLibrary.cpp | 6 ++++++
medialibrary/jni/AndroidMediaLibrary.h | 1 +
medialibrary/jni/medialibrary.cpp | 10 ++++++++++
medialibrary/src/org/videolan/medialibrary/Medialibrary.java | 6 ++++++
4 files changed, 23 insertions(+)
diff --git a/medialibrary/jni/AndroidMediaLibrary.cpp b/medialibrary/jni/AndroidMediaLibrary.cpp
index 2492481ef..de8c24940 100644
--- a/medialibrary/jni/AndroidMediaLibrary.cpp
+++ b/medialibrary/jni/AndroidMediaLibrary.cpp
@@ -99,6 +99,12 @@ AndroidMediaLibrary::banFolder(const std::string& path)
}
void
+AndroidMediaLibrary::unbanFolder(const std::string& path)
+{
+ p_ml->unbanFolder(path);
+}
+
+void
AndroidMediaLibrary::discover(const std::string& libraryPath)
{
p_ml->discover(libraryPath);
diff --git a/medialibrary/jni/AndroidMediaLibrary.h b/medialibrary/jni/AndroidMediaLibrary.h
index d21e3681a..b81a23df5 100644
--- a/medialibrary/jni/AndroidMediaLibrary.h
+++ b/medialibrary/jni/AndroidMediaLibrary.h
@@ -34,6 +34,7 @@ public:
std::vector<std::tuple<std::string, std::string, bool>> devices();
bool removeDevice(const std::string& uuid);
void banFolder(const std::string& path);
+ void unbanFolder(const std::string& path);
void discover(const std::string&);
void removeEntryPoint(const std::string& entryPoint);
std::vector<medialibrary::FolderPtr> entryPoints();
diff --git a/medialibrary/jni/medialibrary.cpp b/medialibrary/jni/medialibrary.cpp
index fef4d8d1c..ee242aac1 100644
--- a/medialibrary/jni/medialibrary.cpp
+++ b/medialibrary/jni/medialibrary.cpp
@@ -60,6 +60,15 @@ banFolder(JNIEnv* env, jobject thiz, jstring folderPath)
env->ReleaseStringUTFChars(folderPath, path);
}
+void
+unbanFolder(JNIEnv* env, jobject thiz, jstring folderPath)
+{
+ AndroidMediaLibrary *aml = MediaLibrary_getInstance(env, thiz);
+ const char *path = env->GetStringUTFChars(folderPath, JNI_FALSE);
+ aml->unbanFolder(path);
+ env->ReleaseStringUTFChars(folderPath, path);
+}
+
jboolean
addDevice(JNIEnv* env, jobject thiz, jstring uuid, jstring storagePath, jboolean removable)
{
@@ -767,6 +776,7 @@ static JNINativeMethod methods[] = {
{"nativeEntryPoints", "()[Ljava/lang/String;", (void*)entryPoints },
{"nativeRemoveDevice", "(Ljava/lang/String;)Z", (void*)removeDevice },
{"nativeBanFolder", "(Ljava/lang/String;)V", (void*)banFolder },
+ {"nativeUnbanFolder", "(Ljava/lang/String;)V", (void*)unbanFolder },
{"nativeLastMediaPlayed", "()[Lorg/videolan/medialibrary/media/MediaWrapper;", (void*)lastMediaPLayed },
{"nativeLastStreamsPlayed", "()[Lorg/videolan/medialibrary/media/HistoryItem;", (void*)lastStreamsPlayed },
{"nativeAddToHistory", "(Ljava/lang/String;Ljava/lang/String;)Z", (void*)addToHistory },
diff --git a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
index eb951045a..ea0a5b0e2 100644
--- a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
@@ -102,6 +102,11 @@ public class Medialibrary {
nativeBanFolder(Tools.encodeVLCMrl(path));
}
+ public void unbanFolder(@NonNull String path) {
+ if (mIsInitiated && new File(path).exists())
+ nativeUnbanFolder(Tools.encodeVLCMrl(path));
+ }
+
public String[] getDevices() {
return mIsInitiated ? nativeDevices() : new String[0];
}
@@ -594,6 +599,7 @@ public class Medialibrary {
private native void nativeStart();
private native void nativeRelease();
private native void nativeBanFolder(String path);
+ private native void nativeUnbanFolder(String path);
private native boolean nativeAddDevice(String uuid, String path, boolean removable);
private native String[] nativeDevices();
private native void nativeDiscover(String path);
More information about the Android
mailing list