[vlc-devel] [PATCH 1/2] Revert "preparser: pass meta request options to Preparse"

Thomas Guillem thomas at gllm.fr
Thu Mar 19 18:06:28 CET 2015


It introduced too much regressions, see #13872 and #13850.
It also preparsed recursively all children of a directory.

Fixes #13872
Fixes #13850

This reverts commit f65838e2a37cb453dc55f5490dad32f6353a118a.
---
 src/playlist/preparser.c | 51 +++++++++---------------------------------------
 1 file changed, 9 insertions(+), 42 deletions(-)

diff --git a/src/playlist/preparser.c b/src/playlist/preparser.c
index e13862c..2d3887d 100644
--- a/src/playlist/preparser.c
+++ b/src/playlist/preparser.c
@@ -34,14 +34,6 @@
 /*****************************************************************************
  * Structures/definitions
  *****************************************************************************/
-typedef struct preparser_entry_t preparser_entry_t;
-
-struct preparser_entry_t
-{
-    input_item_t    *p_item;
-    input_item_meta_request_option_t i_options;
-};
-
 struct playlist_preparser_t
 {
     vlc_object_t        *object;
@@ -50,7 +42,7 @@ struct playlist_preparser_t
     vlc_mutex_t     lock;
     vlc_cond_t      wait;
     bool            b_live;
-    preparser_entry_t  **pp_waiting;
+    input_item_t  **pp_waiting;
     int             i_waiting;
 };
 
@@ -82,17 +74,12 @@ playlist_preparser_t *playlist_preparser_New( vlc_object_t *parent )
 void playlist_preparser_Push( playlist_preparser_t *p_preparser, input_item_t *p_item,
                               input_item_meta_request_option_t i_options )
 {
-    preparser_entry_t *p_entry = malloc( sizeof(preparser_entry_t) );
-
-    if ( !p_entry )
-        return;
-    p_entry->p_item = p_item;
-    p_entry->i_options = i_options;
-    vlc_gc_incref( p_entry->p_item );
+    vlc_gc_incref( p_item );
+    VLC_UNUSED( i_options );
 
     vlc_mutex_lock( &p_preparser->lock );
     INSERT_ELEM( p_preparser->pp_waiting, p_preparser->i_waiting,
-                 p_preparser->i_waiting, p_entry );
+                 p_preparser->i_waiting, p_item );
     if( !p_preparser->b_live )
     {
         if( vlc_clone_detach( NULL, Thread, p_preparser,
@@ -117,9 +104,7 @@ void playlist_preparser_Delete( playlist_preparser_t *p_preparser )
     /* Remove pending item to speed up preparser thread exit */
     while( p_preparser->i_waiting > 0 )
     {
-        preparser_entry_t *p_entry = p_preparser->pp_waiting[0];
-        vlc_gc_decref( p_entry->p_item );
-        free( p_entry );
+        vlc_gc_decref( p_preparser->pp_waiting[0] );
         REMOVE_ELEM( p_preparser->pp_waiting, p_preparser->i_waiting, 0 );
     }
 
@@ -142,27 +127,13 @@ void playlist_preparser_Delete( playlist_preparser_t *p_preparser )
 /**
  * This function preparses an item when needed.
  */
-static void Preparse( vlc_object_t *obj, input_item_t *p_item,
-                      input_item_meta_request_option_t i_options )
+static void Preparse( vlc_object_t *obj, input_item_t *p_item )
 {
     vlc_mutex_lock( &p_item->lock );
     int i_type = p_item->i_type;
     vlc_mutex_unlock( &p_item->lock );
 
-    bool b_preparse = false;
-    switch (i_type) {
-    case ITEM_TYPE_FILE:
-    case ITEM_TYPE_DIRECTORY:
-    case ITEM_TYPE_PLAYLIST:
-    case ITEM_TYPE_NODE:
-        b_preparse = true;
-        break;
-    case ITEM_TYPE_NET:
-        if (i_options & META_REQUEST_OPTION_SCOPE_NETWORK)
-            b_preparse = true;
-        break;
-    }
-    if( !b_preparse )
+    if( i_type != ITEM_TYPE_FILE )
     {
         input_item_SetPreparsed( p_item, true );
         input_item_SignalPreparseEnded( p_item );
@@ -232,16 +203,12 @@ static void *Thread( void *data )
     for( ;; )
     {
         input_item_t *p_current;
-        input_item_meta_request_option_t i_options;
 
         /* */
         vlc_mutex_lock( &p_preparser->lock );
         if( p_preparser->i_waiting > 0 )
         {
-            preparser_entry_t *p_entry = p_preparser->pp_waiting[0];
-            p_current = p_entry->p_item;
-            i_options = p_entry->i_options;
-            free( p_entry );
+            p_current = p_preparser->pp_waiting[0];
             REMOVE_ELEM( p_preparser->pp_waiting, p_preparser->i_waiting, 0 );
         }
         else
@@ -255,7 +222,7 @@ static void *Thread( void *data )
         if( !p_current )
             break;
 
-        Preparse( obj, p_current, i_options );
+        Preparse( obj, p_current );
 
         Art( p_preparser, p_current );
         vlc_gc_decref(p_current);
-- 
2.1.3




More information about the vlc-devel mailing list