[vlc-commits] playlist: remove meta-file hack from input item code

Rémi Denis-Courmont git at videolan.org
Wed Apr 13 22:29:52 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr 13 23:16:13 2016 +0300| [227cb856435c508f3d182f1428c5b85db1f6643e] | committer: Rémi Denis-Courmont

playlist: remove meta-file hack from input item code

This still lives in input and playlist loader. It should be removed.

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

 src/input/input.c       |   21 +++++++++------------
 src/input/item.c        |    5 -----
 src/playlist/loadsave.c |   24 ++++++++++++++----------
 3 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 4a0caf4..19a01ba 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1143,18 +1143,15 @@ static int Init( input_thread_t * p_input )
 {
     input_source_t *master;
 
-    for( int i = 0; i < p_input->p->p_item->i_options; i++ )
-    {
-        if( !strncmp( p_input->p->p_item->ppsz_options[i], "meta-file", 9 ) )
-        {
-            msg_Dbg( p_input, "Input is a meta file: disabling unneeded options" );
-            var_SetString( p_input, "sout", "" );
-            var_SetBool( p_input, "sout-all", false );
-            var_SetString( p_input, "input-slave", "" );
-            var_SetInteger( p_input, "input-repeat", 0 );
-            var_SetString( p_input, "sub-file", "" );
-            var_SetBool( p_input, "sub-autodetect-file", false );
-        }
+    if( var_Type( p_input->p_parent, "meta-file" ) )
+    {
+        msg_Dbg( p_input, "Input is a meta file: disabling unneeded options" );
+        var_SetString( p_input, "sout", "" );
+        var_SetBool( p_input, "sout-all", false );
+        var_SetString( p_input, "input-slave", "" );
+        var_SetInteger( p_input, "input-repeat", 0 );
+        var_SetString( p_input, "sub-file", "" );
+        var_SetBool( p_input, "sub-autodetect-file", false );
     }
 
     InitStatistics( p_input );
diff --git a/src/input/item.c b/src/input/item.c
index 2b811da..c8a67eb 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -165,14 +165,9 @@ void input_item_CopyOptions( input_item_t *p_parent,
     vlc_mutex_lock( &p_parent->lock );
 
     for( int i = 0 ; i< p_parent->i_options; i++ )
-    {
-        if( !strcmp( p_parent->ppsz_options[i], "meta-file" ) )
-            continue;
-
         input_item_AddOption( p_child,
                               p_parent->ppsz_options[i],
                               p_parent->optflagv[i] );
-    }
 
     vlc_mutex_unlock( &p_parent->lock );
 }
diff --git a/src/playlist/loadsave.c b/src/playlist/loadsave.c
index 9215e2a..f05f96e 100644
--- a/src/playlist/loadsave.c
+++ b/src/playlist/loadsave.c
@@ -91,19 +91,24 @@ out:
 int playlist_Import( playlist_t *p_playlist, const char *psz_file )
 {
     input_item_t *p_input;
-    const char *const psz_option = "meta-file";
     char *psz_uri = vlc_path2uri( psz_file, NULL );
 
     if( psz_uri == NULL )
         return VLC_EGENERIC;
 
-    p_input = input_item_NewExt( psz_uri, psz_file,
-                                 1, &psz_option, VLC_INPUT_OPTION_TRUSTED, -1 );
+    p_input = input_item_NewExt( psz_uri, psz_file, 0, NULL, 0, -1 );
     free( psz_uri );
 
     playlist_AddInput( p_playlist, p_input, PLAYLIST_APPEND, PLAYLIST_END,
                        true, false );
-    return input_Read( p_playlist, p_input );
+
+    vlc_object_t *dummy = vlc_object_create( p_playlist, sizeof (*dummy) );
+    var_Create( dummy, "meta-file", VLC_VAR_VOID );
+
+    int ret = input_Read( dummy, p_input );
+
+    vlc_object_release( dummy );
+    return ret;
 }
 
 /*****************************************************************************
@@ -153,11 +158,7 @@ int playlist_MLLoad( playlist_t *p_playlist )
     if( psz_uri == NULL )
         return VLC_ENOMEM;
 
-    const char *const options[1] = { "meta-file", };
-    /* that option has to be cleaned in input_item_subitem_tree_added() */
-    /* vlc_gc_decref() in the same function */
-    p_input = input_item_NewExt( psz_uri, _("Media Library"),
-                                 1, options, VLC_INPUT_OPTION_TRUSTED, -1 );
+    p_input = input_item_NewExt( psz_uri, _("Media Library"), 0, NULL, 0, -1 );
     free( psz_uri );
     if( p_input == NULL )
         return VLC_EGENERIC;
@@ -172,7 +173,10 @@ int playlist_MLLoad( playlist_t *p_playlist )
                         input_item_subitem_tree_added, p_playlist );
     PL_UNLOCK;
 
-    input_Read( p_playlist, p_input );
+    vlc_object_t *dummy = vlc_object_create( p_playlist, sizeof (*dummy) );
+    var_Create( dummy, "meta-file", VLC_VAR_VOID );
+    input_Read( dummy, p_input );
+    vlc_object_release( dummy );
 
     vlc_event_detach( &p_input->event_manager, vlc_InputItemSubItemTreeAdded,
                         input_item_subitem_tree_added, p_playlist );



More information about the vlc-commits mailing list