[Android] Add meta informations in mediaWrapper from ML

Geoffrey Métais git at videolan.org
Thu Jul 13 11:04:13 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jul 13 11:03:11 2017 +0200| [f662492febbaa2febf4d4596e8617c48981b6e3d] | committer: Geoffrey Métais

Add meta informations in mediaWrapper from ML

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

 medialibrary/jni/utils.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/medialibrary/jni/utils.cpp b/medialibrary/jni/utils.cpp
index f10fb727c..6a9a19c91 100644
--- a/medialibrary/jni/utils.cpp
+++ b/medialibrary/jni/utils.cpp
@@ -36,7 +36,9 @@ mediaToMediaWrapper(JNIEnv* env, fields *fields, medialibrary::MediaPtr const& m
     }
     medialibrary::AlbumTrackPtr p_albumTrack = mediaPtr->albumTrack();
     jstring artist = NULL, genre = NULL, album = NULL, albumArtist = NULL, mrl = NULL, title = NULL, thumbnail = NULL;
-    if (p_albumTrack) {
+    jint trackNumber = 0, discNumber = 0;
+    if (p_albumTrack)
+    {
         medialibrary::ArtistPtr artistPtr = p_albumTrack->artist();
         medialibrary::GenrePtr genrePtr = p_albumTrack->genre();
         medialibrary::AlbumPtr albumPtr = p_albumTrack->album();
@@ -50,7 +52,13 @@ mediaToMediaWrapper(JNIEnv* env, fields *fields, medialibrary::MediaPtr const& m
             if (albumArtistPtr != NULL)
                 albumArtist = env->NewStringUTF(albumArtistPtr->name().c_str());
         }
+        trackNumber = p_albumTrack->trackNumber();
+        discNumber = p_albumTrack->discNumber();
     }
+    const medialibrary::IMediaMetadata& metaAudioTrack = mediaPtr->metadata(medialibrary::IMedia::MetadataType::AudioTrack);
+    jint  audioTrack = metaAudioTrack.isSet() ? metaAudioTrack.integer() : -2;
+    const medialibrary::IMediaMetadata& metaSpuTrack = mediaPtr->metadata(medialibrary::IMedia::MetadataType::SubtitleTrack);
+    jint  spuTrack = metaSpuTrack.isSet() ? metaSpuTrack.integer() : -2;
     title = mediaPtr->title().empty() ? NULL : env->NewStringUTF(mediaPtr->title().c_str());
     mrl = env->NewStringUTF(files.at(0)->mrl().c_str());
     thumbnail = mediaPtr->thumbnail().empty() ? NULL : env->NewStringUTF(mediaPtr->thumbnail().c_str());
@@ -66,7 +74,7 @@ mediaToMediaWrapper(JNIEnv* env, fields *fields, medialibrary::MediaPtr const& m
                           (jlong) mediaPtr->id(), mrl,(jlong) progress, (jlong) duration, type,
                           title, artist, genre, album,
                           albumArtist, width, height, thumbnail,
-                          (jint) -2, (jint) -2, (jint) 0, (jint) 0, (jlong) files.at(0)->lastModificationDate(), seen);
+                          audioTrack, spuTrack, trackNumber, discNumber, (jlong) files.at(0)->lastModificationDate(), seen);
     if (artist != NULL)
         env->DeleteLocalRef(artist);
     if (genre != NULL)



More information about the Android mailing list