[Android] [PATCH 12/13] libvlc: remove TrackInfo and readTracksInfo*

Jean-Baptiste Kempf jb at videolan.org
Thu Jan 15 20:19:17 CET 2015


OK.

On 15 Jan, Thomas Guillem wrote :
> ---
>  libvlc/jni/libvlcjni-track.c                  | 117 --------------------------
>  libvlc/src/org/videolan/libvlc/LibVLC.java    |   4 -
>  libvlc/src/org/videolan/libvlc/TrackInfo.java |  56 ------------
>  3 files changed, 177 deletions(-)
>  delete mode 100644 libvlc/src/org/videolan/libvlc/TrackInfo.java
> 
> diff --git a/libvlc/jni/libvlcjni-track.c b/libvlc/jni/libvlcjni-track.c
> index ed13830..c4fe358 100644
> --- a/libvlc/jni/libvlcjni-track.c
> +++ b/libvlc/jni/libvlcjni-track.c
> @@ -110,123 +110,6 @@ jboolean Java_org_videolan_libvlc_LibVLC_hasVideoTrack(JNIEnv *env, jobject thiz
>          return JNI_FALSE;
>  }
>  
> -jobjectArray read_track_info_internal(JNIEnv *env, jobject thiz, libvlc_media_t* p_m)
> -{
> -    /* get java class */
> -    jclass cls = (*env)->FindClass( env, "org/videolan/libvlc/TrackInfo" );
> -    if ( !cls )
> -    {
> -        LOGE("Failed to load class (org/videolan/libvlc/TrackInfo)" );
> -        return NULL;
> -    }
> -
> -    /* get java class contructor */
> -    jmethodID clsCtor = (*env)->GetMethodID( env, cls, "<init>", "()V" );
> -    if ( !clsCtor )
> -    {
> -        LOGE("Failed to find class constructor (org/videolan/libvlc/TrackInfo)" );
> -        return NULL;
> -    }
> -
> -    /* Get the tracks information of the media. */
> -    libvlc_media_track_t **p_tracks;
> -
> -    int i_nbTracks = libvlc_media_tracks_get(p_m, &p_tracks);
> -
> -    jobjectArray array = (*env)->NewObjectArray(env, i_nbTracks + 1, cls, NULL);
> -
> -    unsigned i;
> -    if (array != NULL)
> -    {
> -        for (i = 0; i <= i_nbTracks; ++i)
> -        {
> -            jobject item = (*env)->NewObject(env, cls, clsCtor);
> -            if (item == NULL)
> -                continue;
> -            (*env)->SetObjectArrayElement(env, array, i, item);
> -
> -            // use last track for metadata
> -            if (i == i_nbTracks)
> -            {
> -#define SET_STRING_META(title, vlc_meta) do { \
> -    char *psz_meta = libvlc_media_get_meta(p_m, vlc_meta); \
> -    if (psz_meta) { \
> -        setString(env, item, title, psz_meta); \
> -        free(psz_meta); \
> -    } \
> -} while (0)
> -
> -                setInt(env, item, "Type", 3 /* TYPE_META */);
> -                setLong(env, item, "Length", libvlc_media_get_duration(p_m));
> -                SET_STRING_META("Title", libvlc_meta_Title);
> -                SET_STRING_META("Artist", libvlc_meta_Artist);
> -                SET_STRING_META("Album", libvlc_meta_Album);
> -                SET_STRING_META("Genre", libvlc_meta_Genre);
> -                SET_STRING_META("ArtworkURL", libvlc_meta_ArtworkURL);
> -                SET_STRING_META("NowPlaying", libvlc_meta_NowPlaying);
> -                SET_STRING_META("TrackNumber", libvlc_meta_TrackNumber);
> -                SET_STRING_META("AlbumArtist", libvlc_meta_AlbumArtist);
> -#undef SET_STRING_META
> -                continue;
> -            }
> -
> -            setInt(env, item, "Id", p_tracks[i]->i_id);
> -            setInt(env, item, "Type", p_tracks[i]->i_type);
> -            setString(env, item, "Codec", (const char*)vlc_fourcc_GetDescription(0,p_tracks[i]->i_codec));
> -            setString(env, item, "Language", p_tracks[i]->psz_language);
> -            setInt(env, item, "Bitrate", p_tracks[i]->i_bitrate);
> -
> -            if (p_tracks[i]->i_type == libvlc_track_video)
> -            {
> -                setInt(env, item, "Height", p_tracks[i]->video->i_height);
> -                setInt(env, item, "Width", p_tracks[i]->video->i_width);
> -                setFloat(env, item, "Framerate", (float)p_tracks[i]->video->i_frame_rate_num / p_tracks[i]->video->i_frame_rate_den);
> -            }
> -            if (p_tracks[i]->i_type == libvlc_track_audio)
> -            {
> -                setInt(env, item, "Channels", p_tracks[i]->audio->i_channels);
> -                setInt(env, item, "Samplerate", p_tracks[i]->audio->i_rate);
> -            }
> -        }
> -    }
> -
> -    libvlc_media_tracks_release(p_tracks, i_nbTracks);
> -    return array;
> -}
> -
> -jobjectArray Java_org_videolan_libvlc_LibVLC_readTracksInfo(JNIEnv *env, jobject thiz,
> -                                                            jstring mrl)
> -{
> -    /* Create a new item and assign it to the media player. */
> -    libvlc_media_t *p_m = new_media(env, thiz, mrl, false, false);
> -    if (p_m == NULL)
> -    {
> -        LOGE("Could not create the media!");
> -        return NULL;
> -    }
> -
> -    libvlc_media_parse(p_m);
> -    jobjectArray jar = read_track_info_internal(env, thiz, p_m);
> -    libvlc_media_release(p_m);
> -    return jar;
> -}
> -
> -
> -jobjectArray Java_org_videolan_libvlc_LibVLC_readTracksInfoInternal(JNIEnv *env, jobject thiz)
> -{
> -    libvlc_media_player_t* p_mp = getMediaPlayer(env, thiz);
> -    if (p_mp == NULL) {
> -        LOGE("No media player!");
> -        return NULL;
> -    }
> -    libvlc_media_t *p_m = libvlc_media_player_get_media(p_mp);
> -    if (p_m == NULL) {
> -        LOGE("Could not load internal media!");
> -        return NULL;
> -    } else
> -        return read_track_info_internal(env, thiz, p_m);
> -}
> -
>  jint Java_org_videolan_libvlc_LibVLC_getAudioTracksCount(JNIEnv *env, jobject thiz)
>  {
>      libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
> diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
> index 702d727..a585450 100644
> --- a/libvlc/src/org/videolan/libvlc/LibVLC.java
> +++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
> @@ -710,10 +710,6 @@ public class LibVLC {
>       */
>      public native boolean hasVideoTrack(String mrl) throws java.io.IOException;
>  
> -    public native TrackInfo[] readTracksInfo(String mrl);
> -
> -    public native TrackInfo[] readTracksInfoInternal();
> -
>      public native int getAudioTracksCount();
>  
>      public native Map<Integer,String> getAudioTrackDescription();
> diff --git a/libvlc/src/org/videolan/libvlc/TrackInfo.java b/libvlc/src/org/videolan/libvlc/TrackInfo.java
> deleted file mode 100644
> index 0ef1ab9..0000000
> --- a/libvlc/src/org/videolan/libvlc/TrackInfo.java
> +++ /dev/null
> @@ -1,56 +0,0 @@
> -/*****************************************************************************
> - * TrackInfo.java
> - *****************************************************************************
> - * Copyright © 2010-2013 VLC authors and VideoLAN
> - *
> - * This program is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU Lesser General Public License as published by
> - * the Free Software Foundation; either version 2.1 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU Lesser General Public License for more details.
> - *
> - * You should have received a copy of the GNU Lesser General Public License
> - * along with this program; if not, write to the Free Software Foundation,
> - * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
> - *****************************************************************************/
> -
> -package org.videolan.libvlc;
> -
> -public class TrackInfo {
> -
> -    public static final int TYPE_UNKNOWN = -1;
> -    public static final int TYPE_AUDIO = 0;
> -    public static final int TYPE_VIDEO = 1;
> -    public static final int TYPE_TEXT = 2;
> -    public static final int TYPE_META = 3;
> -
> -    public int Type;
> -    public int Id;
> -    public String Codec;
> -    public String Language;
> -    public int Bitrate;
> -
> -    /* Video */
> -    public int Height;
> -    public int Width;
> -    public float Framerate;
> -
> -    /* Audio */
> -    public int Channels;
> -    public int Samplerate;
> -
> -    /* MetaData */
> -    public long Length;
> -    public String Title;
> -    public String Artist;
> -    public String Album;
> -    public String Genre;
> -    public String ArtworkURL;
> -    public String NowPlaying;
> -    public String TrackNumber;
> -    public String AlbumArtist;
> -}
> -- 
> 2.1.3
> 
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android

-- 
With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device


More information about the Android mailing list