Adds an input option "meta-file" to be used by input that aren't real inputs (like...
authorRafaël Carré <funman@videolan.org>
Fri, 28 Sep 2007 16:08:55 +0000 (16:08 +0000)
committerRafaël Carré <funman@videolan.org>
Fri, 28 Sep 2007 16:08:55 +0000 (16:08 +0000)
Re-enables media library.
Fixes #1047 (nth attempt).

include/vlc_playlist.h
src/input/input.c
src/playlist/loadsave.c

index 6362661..8fcc797 100644 (file)
@@ -446,7 +446,9 @@ static inline int playlist_Import( playlist_t *p_playlist, const char *psz_file)
     char psz_uri[256+10];
     input_item_t *p_input;
     snprintf( psz_uri, 256+9, "file/://%s", psz_file );
-    p_input = input_ItemNewExt( p_playlist, psz_uri, psz_file, 0, NULL, -1 );
+    const char *const psz_option = "meta-file";
+    p_input = input_ItemNewExt( p_playlist, psz_uri, psz_file,
+                                1, &psz_option, -1 );
     playlist_AddInput( p_playlist, p_input, PLAYLIST_APPEND, PLAYLIST_END,
                        VLC_TRUE, VLC_FALSE );
     input_Read( p_playlist, p_input, VLC_TRUE );
index cb93cb7..be0d985 100644 (file)
@@ -761,6 +761,20 @@ static int Init( input_thread_t * p_input )
     memset( &p_input->p->counters, 0, sizeof( p_input->p->counters ) );
     vlc_mutex_init( p_input, &p_input->p->counters.counters_lock );
 
+    for( i = 0; i < p_input->p->input.p_item->i_options; i++ )
+    {
+        if( !strncmp( p_input->p->input.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", VLC_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", VLC_FALSE );
+        }
+    }
+
     if( !p_input->b_preparsing )
     {
         /* Prepare statistics */
index c865241..f4b3030 100644 (file)
@@ -89,7 +89,6 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename ,
 
 int playlist_MLLoad( playlist_t *p_playlist )
 {
-#if 0
     const char *psz_datadir = p_playlist->p_libvlc->psz_datadir;
     char *psz_uri = NULL;
     input_item_t *p_input;
@@ -122,8 +121,9 @@ int playlist_MLLoad( playlist_t *p_playlist )
         goto error;
     }
 
+    const char *const psz_option = "meta-file";
     p_input = input_ItemNewExt( p_playlist, psz_uri,
-                                _("Media Library"), 0, NULL, -1 );
+                                _("Media Library"), 1, &psz_option, -1 );
     if( p_input == NULL )
         goto error;
 
@@ -142,7 +142,6 @@ int playlist_MLLoad( playlist_t *p_playlist )
 
 error:
     free( psz_uri );
-#endif
     return VLC_ENOMEM;
 }