[Android] [PATCH 04/13] merge libvlcjni-medialist.c with libvlcjni.c
Jean-Baptiste Kempf
jb at videolan.org
Thu Jan 15 20:13:05 CET 2015
I don't really see why, but no objection.
On 15 Jan, Thomas Guillem wrote :
> ---
> libvlc/jni/Android.mk | 2 +-
> libvlc/jni/libvlcjni-medialist.c | 83 ----------------------------------------
> libvlc/jni/libvlcjni.c | 39 +++++++++++++++++++
> 3 files changed, 40 insertions(+), 84 deletions(-)
> delete mode 100644 libvlc/jni/libvlcjni-medialist.c
>
> diff --git a/libvlc/jni/Android.mk b/libvlc/jni/Android.mk
> index dd7975b..e6308d1 100644
> --- a/libvlc/jni/Android.mk
> +++ b/libvlc/jni/Android.mk
> @@ -4,7 +4,7 @@ include $(CLEAR_VARS)
> LOCAL_MODULE := libvlcjni
>
> LOCAL_SRC_FILES := libvlcjni.c libvlcjni-util.c libvlcjni-track.c
> -LOCAL_SRC_FILES += libvlcjni-medialist.c libvlcjni-equalizer.c
> +LOCAL_SRC_FILES += libvlcjni-equalizer.c
> LOCAL_SRC_FILES += aout.c vout.c native_crash_handler.c thumbnailer.c
> ifneq ($(ANDROID_API),android-21)
> # compat functions not needed after android-21
> diff --git a/libvlc/jni/libvlcjni-medialist.c b/libvlc/jni/libvlcjni-medialist.c
> deleted file mode 100644
> index 7319439..0000000
> --- a/libvlc/jni/libvlcjni-medialist.c
> +++ /dev/null
> @@ -1,83 +0,0 @@
> -/*****************************************************************************
> - * libvlcjni-medialist.c
> - *****************************************************************************
> - * Copyright © 2013 VLC authors and VideoLAN
> - * Copyright © 2013 Edward Wang
> - *
> - * 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.
> - *****************************************************************************/
> -#include <jni.h>
> -#include <vlc/vlc.h>
> -#include <vlc/libvlc_media_list.h>
> -#include <stdlib.h>
> -#include <pthread.h>
> -
> -#include "utils.h"
> -#define LOG_TAG "VLC/JNI/MediaList"
> -#include "log.h"
> -
> -struct stopped_monitor {
> - pthread_mutex_t doneMutex;
> - pthread_cond_t doneCondVar;
> - bool stopped;
> -};
> -
> -static void stopped_callback(const libvlc_event_t *ev, void *data)
> -{
> - struct stopped_monitor* monitor = data;
> - pthread_mutex_lock(&monitor->doneMutex);
> - monitor->stopped = true;
> - pthread_cond_signal(&monitor->doneCondVar);
> - pthread_mutex_unlock(&monitor->doneMutex);
> -}
> -
> -static int expand_media_internal(JNIEnv *env, libvlc_instance_t* p_instance, jobject arrayList, libvlc_media_t* p_md) {
> - if(!p_md) {
> - return -1;
> - }
> - libvlc_media_list_t* p_subitems = libvlc_media_subitems(p_md);
> - libvlc_media_release(p_md);
> - if(p_subitems) {
> - // Expand any subitems if needed
> - int subitem_count = libvlc_media_list_count(p_subitems);
> - if(subitem_count > 0) {
> - LOGD("Found %d subitems, expanding", subitem_count);
> - jclass arrayListClass; jmethodID methodAdd;
> - arrayListGetIDs(env, &arrayListClass, &methodAdd, NULL);
> -
> - for(int i = subitem_count - 1; i >= 0; i--) {
> - libvlc_media_t* p_subitem = libvlc_media_list_item_at_index(p_subitems, i);
> - char* p_subitem_uri = libvlc_media_get_mrl(p_subitem);
> - arrayListStringAdd(env, arrayListClass, methodAdd, arrayList, p_subitem_uri);
> - free(p_subitem_uri);
> - }
> - }
> - libvlc_media_list_release(p_subitems);
> - if(subitem_count > 0) {
> - return 0;
> - } else {
> - return -1;
> - }
> - } else {
> - return -1;
> - }
> -}
> -
> -jint Java_org_videolan_libvlc_LibVLC_expandMedia(JNIEnv *env, jobject thiz, jobject children) {
> - return (jint)expand_media_internal(env,
> - getLibVlcInstance(env, thiz),
> - children,
> - (libvlc_media_t*)libvlc_media_player_get_media(getMediaPlayer(env, thiz)));
> -}
> diff --git a/libvlc/jni/libvlcjni.c b/libvlc/jni/libvlcjni.c
> index 23657b3..664092a 100644
> --- a/libvlc/jni/libvlcjni.c
> +++ b/libvlc/jni/libvlcjni.c
> @@ -666,6 +666,45 @@ void Java_org_videolan_libvlc_LibVLC_playerNavigate(JNIEnv *env, jobject thiz, j
> libvlc_media_player_navigate(mp, (unsigned) nav);
> }
>
> +static int expand_media_internal(JNIEnv *env, libvlc_instance_t* p_instance, jobject arrayList, libvlc_media_t* p_md) {
> + if(!p_md) {
> + return -1;
> + }
> + libvlc_media_list_t* p_subitems = libvlc_media_subitems(p_md);
> + libvlc_media_release(p_md);
> + if(p_subitems) {
> + // Expand any subitems if needed
> + int subitem_count = libvlc_media_list_count(p_subitems);
> + if(subitem_count > 0) {
> + LOGD("Found %d subitems, expanding", subitem_count);
> + jclass arrayListClass; jmethodID methodAdd;
> + arrayListGetIDs(env, &arrayListClass, &methodAdd, NULL);
> +
> + for(int i = subitem_count - 1; i >= 0; i--) {
> + libvlc_media_t* p_subitem = libvlc_media_list_item_at_index(p_subitems, i);
> + char* p_subitem_uri = libvlc_media_get_mrl(p_subitem);
> + arrayListStringAdd(env, arrayListClass, methodAdd, arrayList, p_subitem_uri);
> + free(p_subitem_uri);
> + }
> + }
> + libvlc_media_list_release(p_subitems);
> + if(subitem_count > 0) {
> + return 0;
> + } else {
> + return -1;
> + }
> + } else {
> + return -1;
> + }
> +}
> +
> +jint Java_org_videolan_libvlc_LibVLC_expandMedia(JNIEnv *env, jobject thiz, jobject children) {
> + return (jint)expand_media_internal(env,
> + getLibVlcInstance(env, thiz),
> + children,
> + (libvlc_media_t*)libvlc_media_player_get_media(getMediaPlayer(env, thiz)));
> +}
> +
> // TODO: remove static variables
> static int i_window_width = 0;
> static int i_window_height = 0;
> --
> 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