Commit 380c3d1d authored by Geoffrey Métais's avatar Geoffrey Métais

Add medialibrary JNI calls for 'unbanFolder'

parent b757400c
......@@ -98,6 +98,12 @@ AndroidMediaLibrary::banFolder(const std::string& path)
p_ml->banFolder(path);
}
void
AndroidMediaLibrary::unbanFolder(const std::string& path)
{
p_ml->unbanFolder(path);
}
void
AndroidMediaLibrary::discover(const std::string& libraryPath)
{
......
......@@ -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();
......
......@@ -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 },
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment