Skip to content
Snippets Groups Projects
Commit 0f9d2a04 authored by Thomas Guillem's avatar Thomas Guillem
Browse files

LibVLC: handle libvlc_MediaParsedStatus event

parent e7e6f012
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment