[Android] Imlement new start() method

Geoffrey Métais git at videolan.org
Wed Apr 19 14:46:00 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Apr 18 19:12:12 2017 +0200| [741ae3a3eb0a3c8ef955fa8a7235940c459921b0] | committer: Geoffrey Métais

Imlement new start() method

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

 medialibrary/jni/AndroidMediaLibrary.cpp                     |  6 ++++++
 medialibrary/jni/AndroidMediaLibrary.h                       |  1 +
 medialibrary/jni/medialibrary.cpp                            | 10 +++++++++-
 medialibrary/src/org/videolan/medialibrary/Medialibrary.java |  5 +++++
 4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/medialibrary/jni/AndroidMediaLibrary.cpp b/medialibrary/jni/AndroidMediaLibrary.cpp
index cb293c9..87b293a 100644
--- a/medialibrary/jni/AndroidMediaLibrary.cpp
+++ b/medialibrary/jni/AndroidMediaLibrary.cpp
@@ -61,6 +61,12 @@ AndroidMediaLibrary::initML(const std::string& dbPath, const std::string& thumbs
     return p_ml->initialize(dbPath, thumbsPath, this);
 }
 
+void
+AndroidMediaLibrary::start()
+{
+    p_ml->start();
+}
+
 bool
 AndroidMediaLibrary::addDevice(const std::string& uuid, const std::string& path, bool removable)
 {
diff --git a/medialibrary/jni/AndroidMediaLibrary.h b/medialibrary/jni/AndroidMediaLibrary.h
index a01e2ca..0f24c4b 100644
--- a/medialibrary/jni/AndroidMediaLibrary.h
+++ b/medialibrary/jni/AndroidMediaLibrary.h
@@ -29,6 +29,7 @@ public:
     ~AndroidMediaLibrary();
 
     bool initML(const std::string& dbPath, const std::string& thumbsPath);
+    void start();
     bool addDevice(const std::string& uuid, const std::string& path, bool removable);
     std::vector<std::tuple<std::string, std::string, bool>> devices();
     bool removeDevice(const std::string& uuid);
diff --git a/medialibrary/jni/medialibrary.cpp b/medialibrary/jni/medialibrary.cpp
index e1eab2d..e54249b 100644
--- a/medialibrary/jni/medialibrary.cpp
+++ b/medialibrary/jni/medialibrary.cpp
@@ -40,7 +40,14 @@ init(JNIEnv* env, jobject thiz, jstring dbPath, jstring thumbsPath)
     return m_IsInitialized;
 }
 
-void release(JNIEnv* env, jobject thiz)
+void
+start(JNIEnv* env, jobject thiz)
+{
+    MediaLibrary_getInstance(env, thiz)->start();
+}
+
+void
+release(JNIEnv* env, jobject thiz)
 {
     LOGD("/!\\ release medialib. /!\\");
     AndroidMediaLibrary *aml = MediaLibrary_getInstance(env, thiz);
@@ -743,6 +750,7 @@ playlistDelete(JNIEnv* env, jobject thiz, jobject medialibrary, jlong playlistId
 static JNINativeMethod methods[] = {
     {"nativeSetup", "()V", (void*)setup },
     {"nativeInit", "(Ljava/lang/String;Ljava/lang/String;)Z", (void*)init },
+    {"nativeStart", "()V", (void*)start },
     {"nativeRelease", "()V", (void*)release },
     {"nativeAddDevice", "(Ljava/lang/String;Ljava/lang/String;Z)Z", (void*)addDevice },
     {"nativeDevices", "()[Ljava/lang/String;", (void*)devices },
diff --git a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
index 0d775ce..b7aef30 100644
--- a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
@@ -74,6 +74,10 @@ public class Medialibrary {
         return mIsInitiated;
     }
 
+    public void start() {
+        nativeStart();
+    }
+
     public void banFolder(String path) {
         if (mIsInitiated && new File(path).exists())
             nativeBanFolder(Tools.encodeVLCMrl(path));
@@ -536,6 +540,7 @@ public class Medialibrary {
     // Native methods
     private native void nativeSetup();
     private native boolean nativeInit(String dbPath, String thumbsPath);
+    private native void nativeStart();
     private native void nativeRelease();
     private native void nativeBanFolder(String path);
     private native boolean nativeAddDevice(String uuid, String path, boolean removable);



More information about the Android mailing list