[Android] Implement forceParserRetry medialibrary feature

Geoffrey Métais git at videolan.org
Mon Feb 13 17:36:27 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Feb 13 17:32:03 2017 +0100| [1dbbedca08a69d871a706065587b8da431550299] | committer: Geoffrey Métais

Implement forceParserRetry medialibrary feature

> https://code.videolan.org/videolan/vlc-android/commit/1dbbedca08a69d871a706065587b8da431550299
---

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

diff --git a/medialibrary/jni/AndroidMediaLibrary.cpp b/medialibrary/jni/AndroidMediaLibrary.cpp
index 1d57b47..e184118 100644
--- a/medialibrary/jni/AndroidMediaLibrary.cpp
+++ b/medialibrary/jni/AndroidMediaLibrary.cpp
@@ -152,6 +152,12 @@ AndroidMediaLibrary::reload( const std::string& entryPoint )
     p_ml->reload(entryPoint);
 }
 
+void
+AndroidMediaLibrary::forceParserRetry()
+{
+    p_ml->forceParserRetry();
+}
+
 bool
 AndroidMediaLibrary::increasePlayCount(int64_t mediaId)
 {
diff --git a/medialibrary/jni/AndroidMediaLibrary.h b/medialibrary/jni/AndroidMediaLibrary.h
index 194cd71..e6f3700 100644
--- a/medialibrary/jni/AndroidMediaLibrary.h
+++ b/medialibrary/jni/AndroidMediaLibrary.h
@@ -43,6 +43,7 @@ public:
     void resumeBackgroundOperations();
     void reload();
     void reload( const std::string& entryPoint );
+    void forceParserRetry();
     bool increasePlayCount(int64_t mediaId);
     /* History */
     std::vector<medialibrary::MediaPtr> lastMediaPlayed();
diff --git a/medialibrary/jni/medialibrary.cpp b/medialibrary/jni/medialibrary.cpp
index 3903bae..b305ac6 100644
--- a/medialibrary/jni/medialibrary.cpp
+++ b/medialibrary/jni/medialibrary.cpp
@@ -178,6 +178,13 @@ reloadEntryPoint(JNIEnv* env, jobject thiz, jstring entryPoint)
     env->ReleaseStringUTFChars(entryPoint, path);
 }
 
+void
+forceParserRetry(JNIEnv* env, jobject thiz)
+{
+    AndroidMediaLibrary *aml = MediaLibrary_getInstance(env, thiz);
+    aml->forceParserRetry();
+}
+
 jboolean
 increasePlayCount(JNIEnv* env, jobject thiz, jlong id)
 {
@@ -669,6 +676,7 @@ static JNINativeMethod methods[] = {
     {"nativeResumeBackgroundOperations", "()V", (void*)resumeBackgroundOperations },
     {"nativeReload", "()V", (void*)reload },
     {"nativeReload", "(Ljava/lang/String;)V", (void*)reloadEntryPoint },
+    {"nativeForceParserRetry", "()V", (void*)forceParserRetry },
     {"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 6f78b45..ccb1ad8 100644
--- a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
@@ -187,6 +187,11 @@ public class Medialibrary {
             nativeReload(entryPoint);
     }
 
+    public void forceParserRetry() {
+        if (mIsInitiated)
+            nativeForceParserRetry();
+    }
+
     public MediaWrapper[] lastMediaPlayed() {
         return mIsInitiated ? nativeLastMediaPlayed() : EMPTY_COLLECTION;
     }
@@ -533,6 +538,7 @@ public class Medialibrary {
     private native void nativeResumeBackgroundOperations();
     private native void nativeReload();
     private native void nativeReload(String entryPoint);
+    private native void nativeForceParserRetry();
     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