[vlc-devel] [PATCH 5/9] preparser: don't fetch art if preparse fails

Thomas Guillem thomas at gllm.fr
Wed Jun 1 13:24:49 CEST 2016


---
 src/playlist/preparser.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/playlist/preparser.c b/src/playlist/preparser.c
index a913c70..a5751c5 100644
--- a/src/playlist/preparser.c
+++ b/src/playlist/preparser.c
@@ -151,8 +151,8 @@ void playlist_preparser_Delete( playlist_preparser_t *p_preparser )
 /**
  * This function preparses an item when needed.
  */
-static void Preparse( playlist_preparser_t *preparser, input_item_t *p_item,
-                      input_item_meta_request_option_t i_options )
+static int Preparse( playlist_preparser_t *preparser, input_item_t *p_item,
+                     input_item_meta_request_option_t i_options )
 {
     vlc_mutex_lock( &p_item->lock );
     int i_type = p_item->i_type;
@@ -177,7 +177,7 @@ static void Preparse( playlist_preparser_t *preparser, input_item_t *p_item,
         if( preparser->input == NULL )
         {
             input_item_SignalPreparseEnded( p_item, ITEM_PREPARSE_FAILED );
-            return;
+            return VLC_EGENERIC;
         }
 
         vlc_mutex_unlock( &preparser->lock );
@@ -186,19 +186,24 @@ static void Preparse( playlist_preparser_t *preparser, input_item_t *p_item,
 
         input_Close( preparser->input );
         preparser->input = NULL;
+
         if( i_ret != VLC_SUCCESS )
         {
             input_item_SignalPreparseEnded( p_item, ITEM_PREPARSE_FAILED );
-            return;
+            return VLC_EGENERIC;
         }
 
-
         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 );
+        return VLC_EGENERIC;
+    }
+
+    return VLC_SUCCESS;
 }
 
 /**
@@ -273,9 +278,9 @@ static void *Thread( void *data )
         }
         assert( p_current );
 
-        Preparse( p_preparser, p_current, i_options );
+        if( Preparse( p_preparser, p_current, i_options ) == VLC_SUCCESS )
+            Art( p_preparser, p_current );
 
-        Art( p_preparser, p_current );
         vlc_gc_decref(p_current);
     }
     vlc_mutex_unlock( &p_preparser->lock );
-- 
2.8.1



More information about the vlc-devel mailing list