[Android] Medialibrary: match API changes

Geoffrey Métais git at videolan.org
Wed Jul 31 10:13:12 CEST 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jul 31 10:12:49 2019 +0200| [21eb30e84b60cacc94c1f86334d89509567ac180] | committer: Geoffrey Métais

Medialibrary: match API changes

> https://code.videolan.org/videolan/vlc-android/commit/21eb30e84b60cacc94c1f86334d89509567ac180
---

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

diff --git a/medialibrary/jni/medialibrary.cpp b/medialibrary/jni/medialibrary.cpp
index 5a45cf61f..3e43cde13 100644
--- a/medialibrary/jni/medialibrary.cpp
+++ b/medialibrary/jni/medialibrary.cpp
@@ -1430,7 +1430,7 @@ getMediaLongMetadata(JNIEnv* env, jobject thiz, jobject medialibrary, jlong id,
     medialibrary::MediaPtr media = aml->media(id);
     if (media == nullptr) return 0L;
     const medialibrary::IMetadata& metadata = media->metadata((medialibrary::IMedia::MetadataType)metadataType);
-    return metadata.isSet() ? metadata.integer() : 0L;
+    return metadata.isSet() ? metadata.asInt() : 0L;
 }
 
 jobject
@@ -1440,7 +1440,7 @@ getMediaStringMetadata(JNIEnv* env, jobject thiz, jobject medialibrary, jlong id
     medialibrary::MediaPtr media = aml->media(id);
     if (media == nullptr) return 0L;
     const medialibrary::IMetadata& metadata = media->metadata((medialibrary::IMedia::MetadataType)metadataType);
-    return metadata.isSet() ? env->NewStringUTF(metadata.str().c_str()) : nullptr;
+    return metadata.isSet() ? env->NewStringUTF(metadata.asStr().c_str()) : nullptr;
 }
 
 void
diff --git a/medialibrary/jni/utils.cpp b/medialibrary/jni/utils.cpp
index 4a44d14ca..d5a5da9b4 100644
--- a/medialibrary/jni/utils.cpp
+++ b/medialibrary/jni/utils.cpp
@@ -58,9 +58,9 @@ mediaToMediaWrapper(JNIEnv* env, fields *fields, medialibrary::MediaPtr const& m
         discNumber = p_albumTrack->discNumber();
     }
     const medialibrary::IMetadata& metaAudioTrack = mediaPtr->metadata(medialibrary::IMedia::MetadataType::AudioTrack);
-    jint  audioTrack = metaAudioTrack.isSet() ? metaAudioTrack.integer() : -2;
+    jint  audioTrack = metaAudioTrack.isSet() ? metaAudioTrack.asInt() : -2;
     const medialibrary::IMetadata& metaSpuTrack = mediaPtr->metadata(medialibrary::IMedia::MetadataType::SubtitleTrack);
-    jint  spuTrack = metaSpuTrack.isSet() ? metaSpuTrack.integer() : -2;
+    jint  spuTrack = metaSpuTrack.isSet() ? metaSpuTrack.asInt() : -2;
     title = mediaPtr->title().empty() ? NULL : env->NewStringUTF(mediaPtr->title().c_str());
     filename = mediaPtr->fileName().empty() ? NULL : env->NewStringUTF(mediaPtr->fileName().c_str());
     try {
@@ -75,11 +75,11 @@ mediaToMediaWrapper(JNIEnv* env, fields *fields, medialibrary::MediaPtr const& m
     unsigned int height = hasVideoTracks ? videoTracks.at(0)->height() : 0;
     int64_t duration = mediaPtr->duration();
     const medialibrary::IMetadata& progressMeta = mediaPtr->metadata( medialibrary::IMedia::MetadataType::Progress );
-    int64_t progress = progressMeta.isSet() ? progressMeta.integer() : 0;
+    int64_t progress = progressMeta.isSet() ? progressMeta.asInt() : 0;
     // workaround to convert legacy percentage progress
     if (progress != 0 && progress < 100) progress = duration * ( progress / 100.0 );
     const medialibrary::IMetadata& seenMeta =  mediaPtr->metadata( medialibrary::IMedia::MetadataType::Seen );
-    int64_t seen = seenMeta.isSet() ? seenMeta.integer() : 0;
+    int64_t seen = seenMeta.isSet() ? seenMeta.asInt() : 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