[vlc-commits] preparser: send a status code on PreparseEnded

Thomas Guillem git at videolan.org
Sun Apr 17 07:22:31 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Apr 14 17:00:03 2016 +0200| [01d3be267b4f7ea8ddca40280d085c1506e07c23] | committer: Thomas Guillem

preparser: send a status code on PreparseEnded

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=01d3be267b4f7ea8ddca40280d085c1506e07c23
---

 include/vlc_events.h        |    4 ++++
 include/vlc_input_item.h    |    8 ++++++++
 src/input/input_interface.h |    2 +-
 src/input/item.c            |    3 ++-
 src/playlist/preparser.c    |    6 ++++--
 5 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/include/vlc_events.h b/include/vlc_events.h
index bca1b2a..9ca571a 100644
--- a/include/vlc_events.h
+++ b/include/vlc_events.h
@@ -188,6 +188,10 @@ typedef struct vlc_event_t
         {
             bool new_value;
         } input_item_error_when_reading_changed;
+        struct input_item_preparse_ended
+        {
+            int new_status;
+        } input_item_preparse_ended;
 
         /* Service discovery events */
         struct vlc_services_discovery_item_added
diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 449ca10..9144fbb 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -337,6 +337,14 @@ typedef enum input_item_meta_request_option_t
     META_REQUEST_OPTION_DO_INTERACT   = 0x04
 } input_item_meta_request_option_t;
 
+/* status of the vlc_InputItemPreparseEnded event */
+enum input_item_preparse_status
+{
+    ITEM_PREPARSE_SKIPPED,
+    ITEM_PREPARSE_FAILED,
+    ITEM_PREPARSE_DONE
+};
+
 VLC_API int libvlc_MetaRequest(libvlc_int_t *, input_item_t *,
                                input_item_meta_request_option_t );
 VLC_API int libvlc_ArtRequest(libvlc_int_t *, input_item_t *,
diff --git a/src/input/input_interface.h b/src/input/input_interface.h
index a3890f7..0ec778c 100644
--- a/src/input/input_interface.h
+++ b/src/input/input_interface.h
@@ -30,7 +30,7 @@
 /**********************************************************************
  * Item metadata
  **********************************************************************/
-void input_item_SignalPreparseEnded( input_item_t *p_i );
+void input_item_SignalPreparseEnded( input_item_t *p_i, int new_status );
 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 f1abb5a..3fa257a 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -64,10 +64,11 @@ 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 )
+void input_item_SignalPreparseEnded( input_item_t *p_i, int status )
 {
     vlc_event_t event;
     event.type = vlc_InputItemPreparseEnded;
+    event.u.input_item_preparse_ended.new_status = status;
     vlc_event_send( &p_i->event_manager, &event );
 }
 
diff --git a/src/playlist/preparser.c b/src/playlist/preparser.c
index 8c94819..5315dc4 100644
--- a/src/playlist/preparser.c
+++ b/src/playlist/preparser.c
@@ -187,7 +187,7 @@ static void Preparse( playlist_preparser_t *preparser, input_item_t *p_item,
                                                        p_item );
         if( input == NULL )
         {
-            input_item_SignalPreparseEnded( p_item );
+            input_item_SignalPreparseEnded( p_item, ITEM_PREPARSE_FAILED );
             return;
         }
 
@@ -205,9 +205,11 @@ static void Preparse( playlist_preparser_t *preparser, input_item_t *p_item,
 
         var_SetAddress( preparser->object, "item-change", p_item );
         input_item_SetPreparsed( p_item, true );
+        input_item_SignalPreparseEnded( p_item, ITEM_PREPARSE_DONE );
     }
+    else if (!b_preparse)
+        input_item_SignalPreparseEnded( p_item, ITEM_PREPARSE_SKIPPED );
 
-    input_item_SignalPreparseEnded( p_item );
 }
 
 /**



More information about the vlc-commits mailing list