[Android] Use the new libvlc track info struct included in vlc.git
Martin Storsjö
git at videolan.org
Tue Feb 12 22:08:08 CET 2013
vlc-ports/android | branch: master | Martin Storsjö <martin at martin.st> | Mon Feb 11 22:11:14 2013 +0200| [5b57bd95f6d7dcb3931aabe7968a7ce7889be80a] | committer: Martin Storsjö
Use the new libvlc track info struct included in vlc.git
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=5b57bd95f6d7dcb3931aabe7968a7ce7889be80a
---
compile.sh | 10 +--
...language-and-frame-rate-to-libvlc_media_t.patch | 86 --------------------
vlc-android/jni/libvlcjni.c | 28 +++----
3 files changed, 15 insertions(+), 109 deletions(-)
diff --git a/compile.sh b/compile.sh
index 038749e..719a9e0 100755
--- a/compile.sh
+++ b/compile.sh
@@ -78,19 +78,12 @@ NDK_TOOLCHAIN_PATH=${ANDROID_NDK}/toolchains/${PATH_HOST}-${GCCVER}/prebuilt/`un
export PATH=${NDK_TOOLCHAIN_PATH}:${PATH}
# 1/ libvlc, libvlccore and its plugins
-TESTED_HASH=9b0916a50e2
+TESTED_HASH=59a6c9693c2
if [ ! -d "vlc" ]; then
echo "VLC source not found, cloning"
git clone git://git.videolan.org/vlc.git vlc
cd vlc
git checkout -B android ${TESTED_HASH}
- echo "Applying the patches"
- git am -3 ../patches/*.patch
- if [ $? -ne 0 ]; then
- git am --abort
- echo "Applying the patches failed, aborting git-am"
- exit 1
- fi
else
echo "VLC source found"
cd vlc
@@ -106,7 +99,6 @@ cd vlc
git reset --hard origin
git pull origin master
git checkout -B android ${TESTED_HASH}
-git am -3 ../patches/*
*** : This will delete any changes you made to the current branch ***
diff --git a/patches/0002-libvlc-add-language-and-frame-rate-to-libvlc_media_t.patch b/patches/0002-libvlc-add-language-and-frame-rate-to-libvlc_media_t.patch
deleted file mode 100644
index 31cc150..0000000
--- a/patches/0002-libvlc-add-language-and-frame-rate-to-libvlc_media_t.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-From 729b7568895cd6fa0b6a1b43c27a234132672bd2 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?S=C3=A9bastien=20Toque?= <xilasz at gmail.com>
-Date: Sun, 22 Apr 2012 09:35:52 +0200
-Subject: [PATCH 2/2] libvlc: add language and frame rate to
- libvlc_media_track_info_t
-
----
- include/vlc/libvlc_media.h | 14 ++++++++++++++
- lib/media.c | 15 +++++++++++++++
- 2 files changed, 29 insertions(+)
-
-diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
-index f8b267d..5773ad2 100644
---- a/include/vlc/libvlc_media.h
-+++ b/include/vlc/libvlc_media.h
-@@ -164,9 +164,12 @@ typedef struct libvlc_media_track_info_t
- /* Video specific */
- unsigned i_height;
- unsigned i_width;
-+ float f_frame_rate;
- } video;
- } u;
-
-+ char *psz_language;
-+
- } libvlc_media_track_info_t;
-
-
-@@ -512,6 +515,17 @@ LIBVLC_API
- int libvlc_media_get_tracks_info( libvlc_media_t *p_md,
- libvlc_media_track_info_t **tracks );
-
-+/**
-+ * Release media descriptor's elementary streams description array
-+ *
-+ * \param p_tracks tracks info array to release
-+ * \param i_count number of elements in the array
-+ */
-+LIBVLC_API
-+void libvlc_media_tracks_info_release( libvlc_media_track_info_t *p_tracks,
-+ int i_count );
-+
-+
- /** @}*/
-
- # ifdef __cplusplus
-diff --git a/lib/media.c b/lib/media.c
-index 600e10a..ab33fd6 100644
---- a/lib/media.c
-+++ b/lib/media.c
-@@ -706,6 +706,8 @@ libvlc_media_get_tracks_info( libvlc_media_t *p_md, libvlc_media_track_info_t **
- p_mes->i_codec = p_es->i_codec;
- p_mes->i_id = p_es->i_id;
-
-+ p_mes->psz_language = p_es->psz_language != NULL ? strdup(p_es->psz_language) : NULL;
-+
- p_mes->i_profile = p_es->i_profile;
- p_mes->i_level = p_es->i_level;
-
-@@ -719,6 +721,7 @@ libvlc_media_get_tracks_info( libvlc_media_t *p_md, libvlc_media_track_info_t **
- p_mes->i_type = libvlc_track_video;
- p_mes->u.video.i_height = p_es->video.i_height;
- p_mes->u.video.i_width = p_es->video.i_width;
-+ p_mes->u.video.f_frame_rate = p_es->video.i_frame_rate / (float) p_es->video.i_frame_rate_base;
- break;
- case AUDIO_ES:
- p_mes->i_type = libvlc_track_audio;
-@@ -734,3 +737,15 @@ libvlc_media_get_tracks_info( libvlc_media_t *p_md, libvlc_media_track_info_t **
- vlc_mutex_unlock( &p_input_item->lock );
- return i_es;
- }
-+
-+/**************************************************************************
-+ * Release media descriptor's elementary streams description array
-+ **************************************************************************/
-+void libvlc_media_tracks_info_release( libvlc_media_track_info_t *p_tracks, int i_count )
-+{
-+ if (!p_tracks)
-+ return;
-+ for (int i = 0; i < i_count; ++i)
-+ free( p_tracks[i].psz_language );
-+ free( p_tracks );
-+}
---
-1.7.12.1
-
diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index 82e85c3..7aa95a2 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -772,9 +772,9 @@ jobjectArray read_track_info_internal(JNIEnv *env, jobject thiz, libvlc_media_t*
}
/* Get the tracks information of the media. */
- libvlc_media_track_info_t *p_tracks;
+ libvlc_media_track_t **p_tracks;
- int i_nbTracks = libvlc_media_get_tracks_info(p_m, &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;
@@ -800,26 +800,26 @@ jobjectArray read_track_info_internal(JNIEnv *env, jobject thiz, libvlc_media_t*
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, "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);
- if (p_tracks[i].i_type == libvlc_track_video)
+ if (p_tracks[i]->i_type == libvlc_track_video)
{
- setInt(env, item, "Height", p_tracks[i].u.video.i_height);
- setInt(env, item, "Width", p_tracks[i].u.video.i_width);
- setFloat(env, item, "Framerate", p_tracks[i].u.video.f_frame_rate);
+ 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)
+ if (p_tracks[i]->i_type == libvlc_track_audio)
{
- setInt(env, item, "Channels", p_tracks[i].u.audio.i_channels);
- setInt(env, item, "Samplerate", p_tracks[i].u.audio.i_rate);
+ setInt(env, item, "Channels", p_tracks[i]->audio->i_channels);
+ setInt(env, item, "Samplerate", p_tracks[i]->audio->i_rate);
}
}
}
- libvlc_media_tracks_info_release(p_tracks, i_nbTracks);
+ libvlc_media_tracks_release(p_tracks, i_nbTracks);
return array;
}
More information about the Android
mailing list