[Android] MediaPlayer: remove getMeta

Thomas Guillem git at videolan.org
Tue Jun 30 10:41:25 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jun 30 10:38:13 2015 +0200| [421d2664b6ae4a70483944fdff3720fe95d8528e] | committer: Thomas Guillem

MediaPlayer: remove getMeta

use getMedia().getMeta() instead

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=421d2664b6ae4a70483944fdff3720fe95d8528e
---

 libvlc/jni/libvlcjni-mediaplayer.c                 |   26 --------------------
 libvlc/src/org/videolan/libvlc/MediaPlayer.java    |    1 -
 vlc-android/src/org/videolan/vlc/MediaWrapper.java |   18 ++++++++------
 3 files changed, 11 insertions(+), 34 deletions(-)

diff --git a/libvlc/jni/libvlcjni-mediaplayer.c b/libvlc/jni/libvlcjni-mediaplayer.c
index 3705c62..e78f84e 100644
--- a/libvlc/jni/libvlcjni-mediaplayer.c
+++ b/libvlc/jni/libvlcjni-mediaplayer.c
@@ -475,32 +475,6 @@ Java_org_videolan_libvlc_MediaPlayer_getLength(JNIEnv *env, jobject thiz)
     return (jlong) libvlc_media_player_get_length(p_obj->u.p_mp);
 }
 
-/* TODO Remove: use MediaPlayer.GetMedia().GetMeta instead */
-jstring
-Java_org_videolan_libvlc_MediaPlayer_getMeta(JNIEnv *env, jobject thiz,
-                                             int meta)
-{
-    char *psz_meta;
-    jstring string = NULL;
-
-    vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
-
-    if (!p_obj)
-        return NULL;
-
-    libvlc_media_t *p_mp = libvlc_media_player_get_media(p_obj->u.p_mp);
-    if (!p_mp)
-        return NULL;
-
-    psz_meta = libvlc_media_get_meta(p_mp, meta);
-    if (psz_meta) {
-        string = (*env)->NewStringUTF(env, psz_meta);
-        free(psz_meta);
-    }
-    libvlc_media_release(p_mp);
-    return string;
-}
-
 jint
 Java_org_videolan_libvlc_MediaPlayer_getTitle(JNIEnv *env, jobject thiz)
 {
diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index eddfe55..03f23e5 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -273,7 +273,6 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> implements AWindow
      */
     public native long getLength();
 
-    public native String getMeta(int meta);
     public native int getTitle();
     public native void setTitle(int title);
     public native int getChapterCountForTitle(int title);
diff --git a/vlc-android/src/org/videolan/vlc/MediaWrapper.java b/vlc-android/src/org/videolan/vlc/MediaWrapper.java
index 146c7a4..e3c6878 100644
--- a/vlc-android/src/org/videolan/vlc/MediaWrapper.java
+++ b/vlc-android/src/org/videolan/vlc/MediaWrapper.java
@@ -220,13 +220,17 @@ public class MediaWrapper implements Parcelable {
     }
 
     public void updateMeta(MediaPlayer mediaPlayer) {
-        mTitle = mediaPlayer.getMeta(Meta.Title);
-        mArtist = mediaPlayer.getMeta(Meta.Artist);
-        mGenre = mediaPlayer.getMeta(Meta.Genre);
-        mAlbum = mediaPlayer.getMeta(Meta.Album);
-        mAlbumArtist = mediaPlayer.getMeta(Meta.AlbumArtist);
-        mNowPlaying = mediaPlayer.getMeta(Meta.NowPlaying);
-        mArtworkURL = mediaPlayer.getMeta(Meta.ArtworkURL);
+        final Media media = mediaPlayer.getMedia();
+        if (media == null)
+            return;
+        mTitle = media.getMeta(Meta.Title);
+        mArtist = media.getMeta(Meta.Artist);
+        mGenre = media.getMeta(Meta.Genre);
+        mAlbum = media.getMeta(Meta.Album);
+        mAlbumArtist = media.getMeta(Meta.AlbumArtist);
+        mNowPlaying = media.getMeta(Meta.NowPlaying);
+        mArtworkURL = media.getMeta(Meta.ArtworkURL);
+        media.release();
     }
 
     public String getFileName() {



More information about the Android mailing list