[Android] medialib: Update to recent metadata API changes

Hugo Beauzée-Luyssen git at videolan.org
Wed Dec 28 16:24:54 CET 2016


vlc-android | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Sun Dec 25 09:29:18 2016 +0100| [9f7057fdcff314276c9978070c3d54e61f27703f] | committer: Hugo Beauzée-Luyssen

medialib: Update to recent metadata API changes

> https://code.videolan.org/videolan/vlc-android/commit/9f7057fdcff314276c9978070c3d54e61f27703f
---

 medialibrary/jni/AndroidMediaLibrary.cpp | 2 +-
 medialibrary/jni/utils.cpp               | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/medialibrary/jni/AndroidMediaLibrary.cpp b/medialibrary/jni/AndroidMediaLibrary.cpp
index 976bcc0..756dd19 100644
--- a/medialibrary/jni/AndroidMediaLibrary.cpp
+++ b/medialibrary/jni/AndroidMediaLibrary.cpp
@@ -165,7 +165,7 @@ AndroidMediaLibrary::updateProgress(int64_t mediaId, int64_t time)
     if (progress > 0.95)
         progress = 0.0;
     LOGD("update progress %f", progress);
-    return media->setProgress(progress);
+    return media->setMetadata( medialibrary::IMedia::MetadataType::Progress, progress * 100 );
 }
 
 std::vector<medialibrary::MediaPtr>
diff --git a/medialibrary/jni/utils.cpp b/medialibrary/jni/utils.cpp
index 009b2b5..a985322 100644
--- a/medialibrary/jni/utils.cpp
+++ b/medialibrary/jni/utils.cpp
@@ -56,7 +56,7 @@ mediaToMediaWrapper(JNIEnv* env, fields *fields, medialibrary::MediaPtr const& m
     unsigned int width = hasVideoTracks ? videoTracks.at(0)->width() : 0;
     unsigned int height = hasVideoTracks ? videoTracks.at(0)->height() : 0;
     int64_t duration = mediaPtr->duration();
-    int64_t progress = duration* mediaPtr->progress();
+    int64_t progress = duration * ( mediaPtr->metadata( medialibrary::IMedia::MetadataType::Progress ).integer() / 100.0 );
 
     jobject item = env->NewObject(fields->MediaWrapper.clazz, fields->MediaWrapper.initID,
                           (jlong) mediaPtr->id(), mrl,(jlong) progress, (jlong) duration, type,



More information about the Android mailing list