[vlc-commits] input: add vlc_InputItemPreparseEnded event
Thomas Guillem
git at videolan.org
Wed Feb 4 15:19:40 CET 2015
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb 4 08:55:52 2015 +0000| [4935cbe1fe29346d694dc44792c7d6e309a2c063] | committer: Jean-Baptiste Kempf
input: add vlc_InputItemPreparseEnded event
This event is sent from playlist/preparsed thread to notify when an item is
preparsed. This event is sent when the preparse function terminate, ie. when
meta and sub items are parsed. It is also sent when the preparse function fails
to parse anything.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4935cbe1fe29346d694dc44792c7d6e309a2c063
---
include/vlc_events.h | 1 +
src/input/input_interface.h | 1 +
src/input/item.c | 8 ++++++++
src/playlist/preparser.c | 2 ++
src/playlist/preparser.h | 2 ++
5 files changed, 14 insertions(+)
diff --git a/include/vlc_events.h b/include/vlc_events.h
index c342510..bca1b2a 100644
--- a/include/vlc_events.h
+++ b/include/vlc_events.h
@@ -123,6 +123,7 @@ typedef enum vlc_event_type_t {
vlc_InputItemNameChanged,
vlc_InputItemInfoChanged,
vlc_InputItemErrorWhenReadingChanged,
+ vlc_InputItemPreparseEnded,
/* Service Discovery event */
vlc_ServicesDiscoveryItemAdded,
diff --git a/src/input/input_interface.h b/src/input/input_interface.h
index a14d5a3..e7b634a 100644
--- a/src/input/input_interface.h
+++ b/src/input/input_interface.h
@@ -30,6 +30,7 @@
/**********************************************************************
* Item metadata
**********************************************************************/
+void input_item_SignalPreparseEnded( input_item_t *p_i );
void input_item_SetPreparsed( input_item_t *p_i, bool b_preparsed );
void input_item_SetArtNotFound( input_item_t *p_i, bool b_not_found );
void input_item_SetArtFetched( input_item_t *p_i, bool b_art_fetched );
diff --git a/src/input/item.c b/src/input/item.c
index 33c7b26..76fc818 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -57,6 +57,13 @@ void input_item_SetErrorWhenReading( input_item_t *p_i, bool b_error )
vlc_event_send( &p_i->event_manager, &event );
}
}
+void input_item_SignalPreparseEnded( input_item_t *p_i )
+{
+ vlc_event_t event;
+ event.type = vlc_InputItemPreparseEnded;
+ vlc_event_send( &p_i->event_manager, &event );
+}
+
void input_item_SetPreparsed( input_item_t *p_i, bool b_preparsed )
{
bool b_send_event = false;
@@ -874,6 +881,7 @@ input_item_NewWithType( const char *psz_uri, const char *psz_name,
vlc_event_manager_register_event_type( p_em, vlc_InputItemNameChanged );
vlc_event_manager_register_event_type( p_em, vlc_InputItemInfoChanged );
vlc_event_manager_register_event_type( p_em, vlc_InputItemErrorWhenReadingChanged );
+ vlc_event_manager_register_event_type( p_em, vlc_InputItemPreparseEnded );
if( type != ITEM_TYPE_UNKNOWN )
p_input->i_type = type;
diff --git a/src/playlist/preparser.c b/src/playlist/preparser.c
index 96171e3..e13862c 100644
--- a/src/playlist/preparser.c
+++ b/src/playlist/preparser.c
@@ -165,6 +165,7 @@ static void Preparse( vlc_object_t *obj, input_item_t *p_item,
if( !b_preparse )
{
input_item_SetPreparsed( p_item, true );
+ input_item_SignalPreparseEnded( p_item );
return;
}
@@ -176,6 +177,7 @@ static void Preparse( vlc_object_t *obj, input_item_t *p_item,
var_SetAddress( obj, "item-change", p_item );
}
+ input_item_SignalPreparseEnded( p_item );
}
/**
diff --git a/src/playlist/preparser.h b/src/playlist/preparser.h
index 54b276f..2b28863 100644
--- a/src/playlist/preparser.h
+++ b/src/playlist/preparser.h
@@ -45,6 +45,8 @@ playlist_preparser_t *playlist_preparser_New( vlc_object_t * );
*
* The input item is retained until the preparsing is done or until the
* preparser object is deleted.
+ * Listen to vlc_InputItemPreparseEnded event to get notified when item is
+ * preparsed.
*/
void playlist_preparser_Push( playlist_preparser_t *, input_item_t *,
input_item_meta_request_option_t );
More information about the vlc-commits
mailing list