[vlc-commits] input: InputGetExtraFilesPattern: include scheme in concat-list entries

Filip Roséen git at videolan.org
Mon May 29 11:52:32 CEST 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Thu May 25 22:08:58 2017 +0200| [f2c9cf7250fd3fa6e86ab766200269fcb0bd6d81] | committer: Jean-Baptiste Kempf

input: InputGetExtraFilesPattern: include scheme in concat-list entries

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".

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 src/input/input.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index f68bc7e631..036785711f 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,29 @@ 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( psz_path == NULL ||
+            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:



More information about the vlc-commits mailing list