[vlc-devel] [PATCH 2/4] input: InputGetExtraFilesPattern: include scheme in concat-list entries

Filip Roséen filip at atch.se
Thu May 25 21:58:03 CEST 2017


This allows for easier implementation for modules using the
concat-list, as it can assume that all entries can be passed directly
to functions such as vlc_stream_NewURL (as they are now valid URIs).

These changes also makes it so that the contents of concat-list
matches that of the documentation, as it uses the notion "input URLs".
---
 src/input/input.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index f68bc7e631..479dd50238 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2845,7 +2845,6 @@ static void InputGetExtraFilesPattern( input_thread_t *p_input,
 {
     int i_list;
     char **ppsz_list;
-
     TAB_INIT( i_list, ppsz_list );
 
     char *psz_base = strdup( psz_path );
@@ -2860,24 +2859,28 @@ static void InputGetExtraFilesPattern( input_thread_t *p_input,
     /* Try to list files */
     for( int i = i_start; i <= i_stop; i++ )
     {
-        struct stat st;
-        char *psz_file;
-
-        if( asprintf( &psz_file, psz_format, psz_base, i ) < 0 )
+        char *psz_probe;
+        if( asprintf( &psz_probe, psz_format, psz_base, i ) < 0 )
             break;
 
-        char *psz_tmp_path = get_path( psz_file );
+        char *psz_path = get_path( psz_probe );
 
-        if( vlc_stat( psz_tmp_path, &st ) || !S_ISREG( st.st_mode ) || !st.st_size )
+        struct stat st;
+        if( vlc_stat( psz_path, &st ) || !S_ISREG( st.st_mode ) || !st.st_size )
         {
-            free( psz_file );
-            free( psz_tmp_path );
+            free( psz_path );
+            free( psz_probe );
             break;
         }
 
-        msg_Dbg( p_input, "Detected extra file `%s'", psz_file );
-        TAB_APPEND( i_list, ppsz_list, psz_file );
-        free( psz_tmp_path );
+        msg_Dbg( p_input, "Detected extra file `%s'", psz_path );
+
+        char* psz_uri = vlc_path2uri( psz_path, NULL );
+        if( psz_uri )
+            TAB_APPEND( i_list, ppsz_list, psz_uri );
+
+        free( psz_path );
+        free( psz_probe );
     }
     free( psz_base );
 exit:
-- 
2.13.0


More information about the vlc-devel mailing list