[Android] [PATCH 3/5] Handled MediaPlayerTimeChanged event.
Jean-Baptiste Kempf
jb at videolan.org
Fri Jul 25 23:41:09 CEST 2014
Applied, but splitted.
Le 24/07/2014 19:14, Paulo Vitor Magacho da Silva a écrit :
> ---
> vlc-android/jni/libvlcjni.c | 11 ++++++++---
> vlc-android/src/org/videolan/libvlc/EventHandler.java | 2 +-
> 2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
> index af61f22..6a08d85 100644
> --- a/vlc-android/jni/libvlcjni.c
> +++ b/vlc-android/jni/libvlcjni.c
> @@ -137,9 +137,13 @@ static void vlc_event_callback(const libvlc_event_t *ev, void *data)
> jmethodID putString = (*env)->GetMethodID(env, clsBundle, "putString", "(Ljava/lang/String;Ljava/lang/String;)V" );
>
> if (ev->type == libvlc_MediaPlayerPositionChanged) {
> - jstring sData = (*env)->NewStringUTF(env, "data");
> - (*env)->CallVoidMethod(env, bundle, putFloat, sData, ev->u.media_player_position_changed.new_position);
> - (*env)->DeleteLocalRef(env, sData);
> + jstring sData = (*env)->NewStringUTF(env, "data");
> + (*env)->CallVoidMethod(env, bundle, putFloat, sData, ev->u.media_player_position_changed.new_position);
> + (*env)->DeleteLocalRef(env, sData);
> + } else if (ev->type == libvlc_MediaPlayerTimeChanged) {
> + jstring sData = (*env)->NewStringUTF(env, "data");
> + (*env)->CallVoidMethod(env, bundle, putInt, sData, (int) ev->u.media_player_time_changed.new_time);
> + (*env)->DeleteLocalRef(env, sData);
> } else if(ev->type == libvlc_MediaPlayerVout) {
> /* For determining the vout/ES track change */
> jstring sData = (*env)->NewStringUTF(env, "data");
> @@ -381,6 +385,7 @@ void Java_org_videolan_libvlc_LibVLC_playMRL(JNIEnv *env, jobject thiz, jlong in
> libvlc_MediaPlayerStopped,
> libvlc_MediaPlayerVout,
> libvlc_MediaPlayerPositionChanged,
> + libvlc_MediaPlayerTimeChanged,
> libvlc_MediaPlayerEncounteredError
> };
> for(int i = 0; i < (sizeof(mp_events) / sizeof(*mp_events)); i++)
> diff --git a/vlc-android/src/org/videolan/libvlc/EventHandler.java b/vlc-android/src/org/videolan/libvlc/EventHandler.java
> index 5c365a6..5a61fed 100644
> --- a/vlc-android/src/org/videolan/libvlc/EventHandler.java
> +++ b/vlc-android/src/org/videolan/libvlc/EventHandler.java
> @@ -50,7 +50,7 @@ public class EventHandler {
> //public static final int MediaPlayerBackward = 0x108;
> public static final int MediaPlayerEndReached = 0x109;
> public static final int MediaPlayerEncounteredError = 0x10a;
> - //public static final int MediaPlayerTimeChanged = 0x10b;
> + public static final int MediaPlayerTimeChanged = 0x10b;
> public static final int MediaPlayerPositionChanged = 0x10c;
> //public static final int MediaPlayerSeekableChanged = 0x10d;
> //public static final int MediaPlayerPausableChanged = 0x10e;
>
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the Android
mailing list