[vlc-devel] [PATCH 3/4] input: allow InputGetExtraFiles to force an access

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


As extensions, such as .001, are heavily coupled with access/concat,
this allows a certain pattern to force a specific access module to
handle the incoming data.
---
 src/input/input.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 479dd50238..2be495a32a 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -94,7 +94,7 @@ static void InputMetaUser( input_thread_t *p_input, vlc_meta_t *p_meta );
 static void InputUpdateMeta( input_thread_t *p_input, demux_t *p_demux );
 static void InputGetExtraFiles( input_thread_t *p_input,
                                 int *pi_list, char ***pppsz_list,
-                                const char *psz_access, const char *psz_path );
+                                const char **psz_access, const char *psz_path );
 
 static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_attachment,
                               const demux_t ***ppp_attachment_demux,
@@ -2422,7 +2422,7 @@ static input_source_t *InputSourceNew( input_thread_t *p_input,
         char **tab;
 
         TAB_INIT( count, tab );
-        InputGetExtraFiles( p_input, &count, &tab, psz_access, psz_path );
+        InputGetExtraFiles( p_input, &count, &tab, &psz_access, psz_path );
         if( count > 0 )
         {
             char *list = NULL;
@@ -2445,7 +2445,6 @@ static input_source_t *InputSourceNew( input_thread_t *p_input,
                 var_SetString( p_input, "concat-list", list );
                 free( list );
             }
-            psz_access = "concat";
         }
         TAB_CLEAN( count, tab );
     }
@@ -2890,22 +2889,23 @@ exit:
 
 static void InputGetExtraFiles( input_thread_t *p_input,
                                 int *pi_list, char ***pppsz_list,
-                                const char *psz_access, const char *psz_path )
+                                const char **ppsz_access, const char *psz_path )
 {
     static const struct pattern
     {
+        const char *psz_access_force;
         const char *psz_match;
         const char *psz_format;
         int i_start;
         int i_stop;
     } patterns[] = {
         /* XXX the order is important */
-        { ".001", "%s.%.3d", 2, 999 },
+        { "concat", ".001", "%s.%.3d", 2, 999 },
     };
 
     TAB_INIT( *pi_list, *pppsz_list );
 
-    if( ( psz_access && *psz_access && strcmp( psz_access, "file" ) ) || !psz_path )
+    if( ( **ppsz_access && strcmp( *ppsz_access, "file" ) ) || !psz_path )
         return;
 
     const size_t i_path = strlen(psz_path);
@@ -2922,6 +2922,9 @@ static void InputGetExtraFiles( input_thread_t *p_input,
         {
             InputGetExtraFilesPattern( p_input, pi_list, pppsz_list, psz_path,
                 pat->psz_match, pat->psz_format, pat->i_start, pat->i_stop );
+
+            if( *pi_list > 0 && pat->psz_access_force )
+                *ppsz_access = pat->psz_access_force;
             return;
         }
     }
-- 
2.13.0


More information about the vlc-devel mailing list