[Android] LibVLC: handle libvlc_MediaParsedStatus event
Thomas Guillem
git at videolan.org
Mon Apr 18 10:23:30 CEST 2016
vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Apr 18 10:20:08 2016 +0200| [0f9d2a04a31834a04255b5ec0978372295ece557] | committer: Thomas Guillem
LibVLC: handle libvlc_MediaParsedStatus event
> https://code.videolan.org/videolan/vlc-android/commit/0f9d2a04a31834a04255b5ec0978372295ece557
---
libvlc/jni/libvlcjni-media.c | 8 ++++++--
libvlc/src/org/videolan/libvlc/Media.java | 6 ++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/libvlc/jni/libvlcjni-media.c b/libvlc/jni/libvlcjni-media.c
index db85d13..8889633 100644
--- a/libvlc/jni/libvlcjni-media.c
+++ b/libvlc/jni/libvlcjni-media.c
@@ -39,6 +39,7 @@ static const libvlc_event_type_t m_events[] = {
libvlc_MediaDurationChanged,
libvlc_MediaStateChanged,
libvlc_MediaParsedChanged,
+ libvlc_MediaParsedStatus,
libvlc_MediaSubItemTreeAdded,
-1,
};
@@ -52,11 +53,12 @@ Media_event_cb(vlcjni_object *p_obj, const libvlc_event_t *p_ev,
pthread_mutex_lock(&p_sys->lock);
- if (p_ev->type == libvlc_MediaParsedChanged)
+ if (p_ev->type == libvlc_MediaParsedStatus)
{
- /* no need to send libvlc_MediaParsedChanged when parsing is synchronous */
+ /* no need to send libvlc_MediaParsedStatus when parsing is synchronous */
if (p_sys->b_parsing_sync)
b_dispatch = false;
+
p_sys->b_parsing_sync = false;
p_sys->b_parsing_async = false;
pthread_cond_signal(&p_sys->wait);
@@ -87,6 +89,8 @@ Media_event_cb(vlcjni_object *p_obj, const libvlc_event_t *p_ev,
break;
case libvlc_MediaStateChanged:
p_java_event->arg1 = p_ev->u.media_state_changed.new_state;
+ case libvlc_MediaParsedStatus:
+ p_java_event->arg1 = p_ev->u.media_parsed_status.new_status;
}
p_java_event->type = p_ev->type;
return true;
diff --git a/libvlc/src/org/videolan/libvlc/Media.java b/libvlc/src/org/videolan/libvlc/Media.java
index e0d4879..2743cff 100644
--- a/libvlc/src/org/videolan/libvlc/Media.java
+++ b/libvlc/src/org/videolan/libvlc/Media.java
@@ -39,6 +39,7 @@ public class Media extends VLCObject<Media.Event> {
//public static final int Freed = 4;
public static final int StateChanged = 5;
public static final int SubItemTreeAdded = 6;
+ public static final int ParsedStatus = 7;
protected Event(int type) {
super(type);
@@ -387,6 +388,9 @@ public class Media extends VLCObject<Media.Event> {
case Event.ParsedChanged:
postParse();
break;
+ case Event.ParsedStatus:
+ postParse();
+ return new Event(eventType, arg1);
case Event.StateChanged:
mState = -1;
break;
@@ -459,6 +463,8 @@ public class Media extends VLCObject<Media.Event> {
private synchronized void postParse() {
// fetch if parsed and not fetched
+ if ((mParseStatus & PARSE_STATUS_PARSED) != 0)
+ return;
mParseStatus &= ~PARSE_STATUS_PARSING;
mParseStatus |= PARSE_STATUS_PARSED;
mNativeTracks = null;
More information about the Android
mailing list