[vlc-commits] [Git][videolan/vlc][master] 5 commits: input: mrl_helper: fix array init/clean cycle

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Nov 29 11:10:18 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
62da0777 by François Cartegnie at 2023-11-29T10:38:54+00:00
input: mrl_helper: fix array init/clean cycle

can't be delegated to callee

- - - - -
e268271a by François Cartegnie at 2023-11-29T10:38:54+00:00
src: input: split and store mrl components using a dedicated struct

- - - - -
b84d09bd by François Cartegnie at 2023-11-29T10:38:54+00:00
stream_extractor: store volumes in MRL fragments

- - - - -
9856c789 by François Cartegnie at 2023-11-29T10:38:54+00:00
stream_extractor: store and forward volume information

Also propagates missing volume information to directories listing.
Until now it was assumed archives only had direcoty info in the first
volume.

- - - - -
4e1a51d8 by François Cartegnie at 2023-11-29T10:38:54+00:00
archive: replace concat-list variable with stream extractor volumes

- - - - -


10 changed files:

- include/vlc_stream_extractor.h
- modules/gui/skins2/src/theme_loader.cpp
- modules/lua/libs/stream.c
- modules/stream_extractor/archive.c
- src/input/input.c
- src/input/mrl_helpers.h
- src/input/stream.c
- src/input/stream.h
- src/input/stream_extractor.c
- src/test/mrl_helpers.c


Changes:

=====================================
include/vlc_stream_extractor.h
=====================================
@@ -64,6 +64,8 @@ typedef struct stream_extractor_t {
     int      (*pf_control)(struct stream_extractor_t*, int request, va_list args);
     /** @} */
 
+    char ** volumes;
+    size_t volumes_count;
     char const* identifier; /**< the name of the entity to be extracted */
     stream_t* source; /**< the source stream to be consumed */
     void* p_sys;      /**< private opaque handle to be used by the module */
@@ -84,6 +86,8 @@ typedef struct stream_directory_t {
     int (*pf_readdir)(struct stream_directory_t*, input_item_node_t* );
     /** @} */
 
+    char ** volumes;
+    size_t volumes_count;
     stream_t* source; /**< the source stream to be consumed */
     void* p_sys; /**< private opaque handle to be used by the module */
 
@@ -123,11 +127,14 @@ VLC_USED;
  *
  * \param extractor the stream_directory_t for which the entity belongs
  * \param subentry the name of the entity in question
+ * \param volumes media additional volumes MRLs
+ * \param volumes_count number of additional volumes
  *
  * \return a pointer to the resulting MRL on success, NULL on failure
  **/
 VLC_API char* vlc_stream_extractor_CreateMRL( stream_directory_t *extractor,
-                                              char const* subentry );
+                                              char const* subentry,
+                                              char const **volumes, size_t volumes_count );
 
 /**
  * \name Attach a stream-extractor to the passed stream
@@ -143,6 +150,8 @@ VLC_API char* vlc_stream_extractor_CreateMRL( stream_directory_t *extractor,
  * \param identifier (if present) NULL or a c-style string referring to the
  *                   desired entity
  * \param module_name NULL or an explicit stream-extractor module name
+ * \param volumes media additional volumes MRLs
+ * \param volumes_count number of additional volumes
  *
  * \return VLC_SUCCESS if a stream-extractor was successfully
  *         attached, an error-code on failure.
@@ -151,11 +160,13 @@ VLC_API char* vlc_stream_extractor_CreateMRL( stream_directory_t *extractor,
  **/
 
 VLC_API int vlc_stream_extractor_Attach( stream_t** source,
-                                         char const* identifier,
-                                         char const* module_name );
+                                        char const* identifier,
+                                        char const* module_name,
+                                        const char **volumes, size_t volumes_count );
 
 VLC_API int vlc_stream_directory_Attach( stream_t** source,
-                                         char const* module_name );
+                                        char const* module_name,
+                                        const char **volumes, size_t volumes_count );
 /**
  * @}
  */


=====================================
modules/gui/skins2/src/theme_loader.cpp
=====================================
@@ -227,7 +227,7 @@ bool ThemeLoader::unarchive( const std::string& fileName, const std::string &tem
     }
 
     stream_t* stream = input.get();
-    if( vlc_stream_directory_Attach( &stream, NULL ) )
+    if( vlc_stream_directory_Attach( &stream, NULL, NULL, 0 ) )
     {
         msg_Err( getIntf(), "unable to attach stream_directory, treat as XML!" );
     }


=====================================
modules/lua/libs/stream.c
=====================================
@@ -110,7 +110,7 @@ static int vlclua_directory_stream_new( lua_State *L )
     stream_t *p_stream = vlc_stream_NewURL( p_this, psz_url );
     if( !p_stream )
         return vlclua_error( L );
-    if( vlc_stream_directory_Attach( &p_stream, NULL ) != VLC_SUCCESS )
+    if( vlc_stream_directory_Attach( &p_stream, NULL, NULL, 0 ) != VLC_SUCCESS )
     {
         vlc_stream_Delete( p_stream );
         return vlclua_error( L );


=====================================
modules/stream_extractor/archive.c
=====================================
@@ -404,10 +404,10 @@ static int archive_extractor_reset( stream_extractor_t* p_extractor )
 
 /* ------------------------------------------------------------------------- */
 
-static private_sys_t* setup( vlc_object_t* obj, stream_t* source )
+static private_sys_t* setup( vlc_object_t* obj, stream_t* source,
+                             char **volumes, size_t volumes_count )
 {
     private_sys_t* p_sys  = calloc( 1, sizeof( *p_sys ) );
-    char* psz_files = var_InheritString( obj, "concat-list" );
 
     if( unlikely( !p_sys ) )
         goto error;
@@ -415,20 +415,11 @@ static private_sys_t* setup( vlc_object_t* obj, stream_t* source )
     if( archive_push_resource( p_sys, source, NULL ) )
         goto error;
 
-    if( psz_files )
-    {
-        for( char* state,
-                 * path = strtok_r( psz_files, ",", &state );
-             path; path = strtok_r(     NULL, ",", &state ) )
-        {
-            if( path == psz_files )
-                continue;
 
-            if( archive_push_resource( p_sys, NULL, path ) )
-                goto error;
-        }
-
-        free( psz_files );
+    for( size_t i=0; i<volumes_count; i++ )
+    {
+        if( archive_push_resource( p_sys, NULL, volumes[i] ) )
+            goto error;
     }
 
     p_sys->source = source;
@@ -437,7 +428,6 @@ static private_sys_t* setup( vlc_object_t* obj, stream_t* source )
     return p_sys;
 
 error:
-    free( psz_files );
     free( p_sys );
     return NULL;
 }
@@ -551,7 +541,9 @@ static int ReadDir( stream_directory_t* p_directory, input_item_node_t* p_node )
         if( unlikely( !path ) )
             break;
 
-        char*       mrl  = vlc_stream_extractor_CreateMRL( p_directory, path );
+        char* mrl = vlc_stream_extractor_CreateMRL( p_directory, path,
+                                                   (char const**) p_directory->volumes,
+                                                   p_directory->volumes_count );
 
         if( unlikely( !mrl ) )
             break;
@@ -721,12 +713,13 @@ static void ExtractorClose( vlc_object_t* p_obj )
     return CommonClose( p_extractor->p_sys );
 }
 
-static private_sys_t* CommonOpen( vlc_object_t* p_obj, stream_t* source  )
+static private_sys_t* CommonOpen( vlc_object_t* p_obj, stream_t* source,
+                                  char **volumes, size_t volumes_count  )
 {
     if( probe( source ) )
         return NULL;
 
-    private_sys_t* p_sys = setup( p_obj, source );
+    private_sys_t* p_sys = setup( p_obj, source, volumes, volumes_count );
 
     if( p_sys == NULL )
         return NULL;
@@ -743,7 +736,8 @@ static private_sys_t* CommonOpen( vlc_object_t* p_obj, stream_t* source  )
 static int DirectoryOpen( vlc_object_t* p_obj )
 {
     stream_directory_t* p_directory = (void*)p_obj;
-    private_sys_t* p_sys = CommonOpen( p_obj, p_directory->source );
+    private_sys_t* p_sys = CommonOpen( p_obj, p_directory->source,
+                                       p_directory->volumes, p_directory->volumes_count );
 
     if( p_sys == NULL )
         return VLC_EGENERIC;
@@ -757,7 +751,8 @@ static int DirectoryOpen( vlc_object_t* p_obj )
 static int ExtractorOpen( vlc_object_t* p_obj )
 {
     stream_extractor_t* p_extractor = (void*)p_obj;
-    private_sys_t* p_sys = CommonOpen( p_obj, p_extractor->source );
+    private_sys_t* p_sys = CommonOpen( p_obj, p_extractor->source,
+                                       p_extractor->volumes, p_extractor->volumes_count );
 
     if( p_sys == NULL )
         return VLC_EGENERIC;


=====================================
src/input/input.c
=====================================
@@ -44,6 +44,7 @@
 #include "resource.h"
 #include "stream.h"
 #include "stream_output/stream_output.h"
+#include "mrl_helpers.h"
 
 #include <vlc_aout.h>
 #include <vlc_dialog.h>
@@ -2535,23 +2536,34 @@ static int
 InputStreamHandleAnchor( input_thread_t *p_input, input_source_t *source,
                          stream_t **stream, char const *anchor )
 {
-    char const* extra;
-    if( stream_extractor_AttachParsed( stream, anchor, &extra ) )
+    struct mrl_info mrli;
+    mrl_info_Init( &mrli );
+    if( mrl_FragmentSplit( &mrli, anchor ) )
+    {
+        mrl_info_Clean( &mrli );
+        return VLC_EGENERIC;
+    }
+
+    if( stream_extractor_AttachParsed( stream, &mrli ) )
     {
         msg_Err( p_input, "unable to attach stream-extractors for %s",
             (*stream)->psz_url );
-
+        mrl_info_Clean( &mrli );
         return VLC_EGENERIC;
     }
 
-    if( vlc_stream_directory_Attach( stream, NULL ) )
+    if( vlc_stream_directory_Attach( stream, NULL,
+                                    (const char **) mrli.volumes.pp_elems,
+                                    mrli.volumes.i_count ) )
         msg_Dbg( p_input, "attachment of directory-extractor failed for %s",
             (*stream)->psz_url );
 
-    MRLSections( extra ? extra : "",
+    MRLSections( mrli.extra ? mrli.extra : "",
         &source->i_title_start, &source->i_title_end,
         &source->i_seekpoint_start, &source->i_seekpoint_end );
 
+    mrl_info_Clean( &mrli );
+
     return VLC_SUCCESS;
 }
 
@@ -2691,6 +2703,7 @@ static int InputSourceInit( input_source_t *in, input_thread_t *p_input,
         }
     }
 
+    char *psz_newanchor = NULL;
     if( strcasecmp( psz_access, "concat" ) )
     {   /* Autodetect extra files if none specified */
         int count;
@@ -2698,28 +2711,16 @@ static int InputSourceInit( input_source_t *in, input_thread_t *p_input,
 
         TAB_INIT( count, tab );
         InputGetExtraFiles( p_input, &count, &tab, &psz_access, psz_mrl );
-        if( count > 0 )
-        {
-            char *list = NULL;
 
-            for( int i = 0; i < count; i++ )
-            {
-                char *str;
-                if( asprintf( &str, "%s,%s", list ? list : psz_mrl,
-                              tab[i] ) < 0 )
-                    break;
-
-                free( tab[i] );
-                free( list );
-                list = str;
-            }
-
-            var_Create( p_input, "concat-list", VLC_VAR_STRING );
-            if( likely(list != NULL) )
+        for( int i = 0; i < count; i++ )
+        {
+            char *psz = mrl_AppendAnchorFragment( psz_newanchor ? psz_newanchor : psz_anchor, tab[i] );
+            if( psz )
             {
-                var_SetString( p_input, "concat-list", list );
-                free( list );
+                 free( psz_newanchor );
+                 psz_newanchor = psz;
             }
+            free( tab[i] );
         }
         TAB_CLEAN( count, tab );
     }
@@ -2736,12 +2737,13 @@ static int InputSourceInit( input_source_t *in, input_thread_t *p_input,
 
         if( es_out )
             in->p_demux = InputDemuxNew( p_input, es_out, in, url,
-                                         psz_demux, psz_anchor );
+                                         psz_demux, psz_newanchor ? psz_newanchor : psz_anchor );
         free( url );
     }
     else
         in->p_demux = NULL;
 
+    free( psz_newanchor );
     free( psz_demux_var );
     free( psz_dup );
 


=====================================
src/input/mrl_helpers.h
=====================================
@@ -89,6 +89,62 @@ mrl_EscapeFragmentIdentifier( char const* payload )
     return mstream.ptr;
 }
 
+static inline char *
+mrl_AppendAnchorFragment( const char *anchor, char const *payload )
+{
+    struct vlc_memstream mstream;
+    if( vlc_memstream_open( &mstream ) )
+        return NULL;
+
+    if( anchor )
+        vlc_memstream_puts( &mstream, anchor );
+    else
+        vlc_memstream_putc( &mstream, '#' );
+
+    char *escaped = mrl_EscapeFragmentIdentifier( payload );
+    if( escaped == NULL )
+    {
+        if( !vlc_memstream_close( &mstream ) )
+            free( mstream.ptr );
+        return NULL;
+    }
+
+    vlc_memstream_puts( &mstream, "!+" );
+    vlc_memstream_puts( &mstream, escaped );
+    free( escaped );
+
+    if( vlc_memstream_close( &mstream ) )
+        return NULL;
+
+    return mstream.ptr;
+}
+
+struct mrl_info
+{
+    vlc_array_t identifiers;
+    vlc_array_t volumes;
+    char const *extra;
+};
+
+static inline void
+mrl_info_Clean( struct mrl_info *mrli )
+{
+    for( size_t i = 0; i < vlc_array_count( &mrli->identifiers ); ++i )
+        free( vlc_array_item_at_index( &mrli->identifiers, i ) );
+    vlc_array_clear( &mrli->identifiers );
+    for( size_t i = 0; i < vlc_array_count( &mrli->volumes ); ++i )
+        free( vlc_array_item_at_index( &mrli->volumes, i ) );
+    vlc_array_clear( &mrli->volumes );
+}
+
+static inline void
+mrl_info_Init( struct mrl_info *mrli )
+{
+    vlc_array_init( &mrli->identifiers );
+    vlc_array_init( &mrli->volumes );
+    mrli->extra = NULL;
+}
+
 /**
  * Split an \link mrl_technical_fragment MRL-fragment\endlink into identifiers
  *
@@ -109,12 +165,9 @@ mrl_EscapeFragmentIdentifier( char const* payload )
  * \return VLC_SUCCESS on success, an error-code on failure
  **/
 static inline int
-mrl_FragmentSplit( vlc_array_t* out_items,
-                   char const** out_extra,
+mrl_FragmentSplit( struct mrl_info *mrli,
                    char const* payload )
 {
-    char const* extra = NULL;
-
     while( strncmp( payload, "!/", 2 ) == 0 )
     {
         payload += 2;
@@ -125,7 +178,25 @@ mrl_FragmentSplit( vlc_array_t* out_items,
         if( unlikely( !decoded ) || !vlc_uri_decode( decoded ) )
             goto error;
 
-        if( vlc_array_append( out_items, decoded ) )
+        if( vlc_array_append( &mrli->identifiers, decoded ) )
+        {
+            free( decoded );
+            goto error;
+        }
+        payload += len;
+    }
+
+    while( strncmp( payload, "!+", 2 ) == 0 )
+    {
+        payload += 2;
+
+        int len = strcspn( payload, "!?" );
+        char* decoded = strndup( payload, len );
+
+        if( unlikely( !decoded ) || !vlc_uri_decode( decoded ) )
+            goto error;
+
+        if( vlc_array_append( &mrli->volumes, decoded ) )
         {
             free( decoded );
             goto error;
@@ -138,19 +209,15 @@ mrl_FragmentSplit( vlc_array_t* out_items,
         if( *payload == '!' )
             goto error;
 
-        if( *payload == '?' && vlc_array_count( out_items ) )
+        if( *payload == '?' && vlc_array_count( &mrli->identifiers ) )
             ++payload;
 
-        extra = payload;
+        mrli->extra = payload;
     }
 
-    *out_extra = extra;
     return VLC_SUCCESS;
 
 error:
-    for( size_t i = 0; i < vlc_array_count( out_items ); ++i )
-        free( vlc_array_item_at_index( out_items, i ) );
-    vlc_array_clear( out_items );
     return VLC_EGENERIC;
 }
 


=====================================
src/input/stream.c
=====================================
@@ -176,16 +176,27 @@ stream_t *(vlc_stream_NewMRL)(vlc_object_t* parent, const char* mrl )
     if( anchor == NULL )
         return stream;
 
-    char const* extra;
-    if( stream_extractor_AttachParsed( &stream, anchor + 1, &extra ) )
+    struct mrl_info mrli;
+    mrl_info_Init( &mrli );
+    if( mrl_FragmentSplit( &mrli, anchor + 1 ) )
+    {
+        vlc_stream_Delete( stream );
+        mrl_info_Clean( &mrli );
+        return NULL;
+    }
+
+    if( stream_extractor_AttachParsed( &stream, &mrli ) )
     {
         msg_Err( parent, "unable to open %s", mrl );
         vlc_stream_Delete( stream );
+        mrl_info_Clean( &mrli );
         return NULL;
     }
 
-    if( extra && *extra )
-        msg_Warn( parent, "ignoring extra fragment data: %s", extra );
+    if( mrli.extra && *mrli.extra )
+        msg_Warn( parent, "ignoring extra fragment data: %s", mrli.extra );
+
+    mrl_info_Clean( &mrli );
 
     return stream;
 }


=====================================
src/input/stream.h
=====================================
@@ -27,6 +27,7 @@
 #include <vlc_common.h>
 #include <vlc_stream.h>
 #include "input_internal.h"
+#include "mrl_helpers.h"
 
 stream_t *vlc_stream_CustomNew(vlc_object_t *parent,
                                void (*destroy)(stream_t *), size_t extra_size,
@@ -123,8 +124,7 @@ stream_t *stream_FilterChainNew( stream_t *source, const char *list ) VLC_USED;
  *             in `psz_data` that does not specify an entity (if any).
  * \return VLC_SUCCESS on success, an error-code on failure
  **/
-int stream_extractor_AttachParsed( stream_t** stream, const char* data,
-                                   char const** out_extra );
+int stream_extractor_AttachParsed( stream_t** stream, const struct mrl_info * );
 
 /**
  * @}


=====================================
src/input/stream_extractor.c
=====================================
@@ -87,7 +87,8 @@ struct stream_extractor_private {
  **/
 
 VLC_MALLOC static char*
-StreamExtractorCreateMRL( char const* base, char const* subentry )
+StreamExtractorCreateMRL( char const* base, char const* subentry,
+                          char const** volumes, size_t volumes_count )
 {
     struct vlc_memstream buffer;
     char* escaped;
@@ -110,6 +111,12 @@ StreamExtractorCreateMRL( char const* base, char const* subentry )
     vlc_memstream_puts( &buffer, "!/" );
     vlc_memstream_puts( &buffer, escaped );
 
+    for( size_t i=0; i<volumes_count; i++ )
+    {
+        vlc_memstream_puts( &buffer, "!+" );
+        vlc_memstream_puts( &buffer, volumes[i] );
+    }
+
     free( escaped );
     return vlc_memstream_close( &buffer ) ? NULL : buffer.ptr;
 }
@@ -210,7 +217,9 @@ se_InitStream( struct stream_extractor_private* priv, stream_t* s )
     s->pf_seek = se_StreamSeek;
     s->pf_control = se_StreamControl;
     s->psz_url = StreamExtractorCreateMRL( priv->extractor.source->psz_url,
-                                           priv->extractor.identifier );
+                                           priv->extractor.identifier,
+                                           (char const **) priv->extractor.volumes,
+                                           priv->extractor.volumes_count );
     if( unlikely( !s->psz_url ) )
         return VLC_ENOMEM;
 
@@ -218,9 +227,20 @@ se_InitStream( struct stream_extractor_private* priv, stream_t* s )
 }
 
 static void
-se_CleanStream( struct stream_extractor_private* priv )
+se_CleanStreamExtractor( struct stream_extractor_private* priv )
 {
     free( (char*)priv->extractor.identifier );
+    for( size_t i=0; i<priv->extractor.volumes_count; i++ )
+        free( priv->extractor.volumes[i] );
+    free( priv->extractor.volumes );
+}
+
+static void
+se_CleanStreamDirectory( struct stream_extractor_private* priv )
+{
+    for( size_t i=0; i<priv->directory.volumes_count; i++ )
+        free( priv->directory.volumes[i] );
+    free( priv->directory.volumes );
 }
 
 static int
@@ -280,7 +300,7 @@ se_AttachWrapper( struct stream_extractor_private* priv, stream_t* source )
 
 static int
 StreamExtractorAttach( stream_t** source, char const* identifier,
-    char const* module_name )
+    char const* module_name, const char **volumes, size_t volumes_count )
 {
     const bool extractor = identifier != NULL;
     char const* capability = extractor ? "stream_extractor"
@@ -292,27 +312,49 @@ StreamExtractorAttach( stream_t** source, char const* identifier,
     if( unlikely( !priv ) )
         return VLC_ENOMEM;
 
+    char ***dst_volumes;
+    size_t * dst_volumes_count;
+
     if( extractor )
     {
         priv->object = VLC_OBJECT( &priv->extractor );
 
         priv->pf_init = se_InitStream;
-        priv->pf_clean = se_CleanStream;
+        priv->pf_clean = se_CleanStreamExtractor;
 
         priv->extractor.source = *source;
         priv->extractor.identifier = strdup( identifier );
 
         if( unlikely( !priv->extractor.identifier ) )
             goto error;
+
+        dst_volumes = &priv->extractor.volumes;
+        dst_volumes_count = &priv->extractor.volumes_count;
     }
     else
     {
         priv->object = VLC_OBJECT( &priv->directory );
 
         priv->pf_init = se_InitDirectory;
-        priv->pf_clean = NULL;
+        priv->pf_clean = se_CleanStreamDirectory;
 
         priv->directory.source = *source;
+
+        dst_volumes = &priv->directory.volumes;
+        dst_volumes_count = &priv->directory.volumes_count;
+    }
+
+    if( volumes_count )
+    {
+        *dst_volumes = malloc(volumes_count * sizeof(char *));
+        if( unlikely(!*dst_volumes) )
+            goto error;
+        for( *dst_volumes_count=0; *dst_volumes_count<volumes_count; (*dst_volumes_count)++ )
+        {
+            (*dst_volumes)[*dst_volumes_count] = strdup(volumes[*dst_volumes_count]);
+            if( unlikely(!(*dst_volumes)[*dst_volumes_count]) )
+                goto error;
+        }
     }
 
     priv->module = module_need( priv->object, capability, module_name, true );
@@ -329,53 +371,47 @@ error:
 }
 
 int
-vlc_stream_directory_Attach( stream_t** source, char const* module_name )
+vlc_stream_directory_Attach( stream_t** source, char const* module_name,
+                             const char **volumes, size_t volumes_count )
 {
-    return StreamExtractorAttach( source, NULL, module_name );
+    return StreamExtractorAttach( source, NULL, module_name, volumes, volumes_count );
 }
 
 int
 vlc_stream_extractor_Attach( stream_t** source, char const* identifier,
-                             char const* module_name )
+                             char const* module_name, const char **volumes, size_t volumes_count )
 {
-    return StreamExtractorAttach( source, identifier, module_name );
+    return StreamExtractorAttach( source, identifier, module_name, volumes, volumes_count );
 }
 
 int
-stream_extractor_AttachParsed( stream_t** source, char const* data,
-                               char const** out_extra )
+stream_extractor_AttachParsed( stream_t** source, const struct mrl_info *mrli )
 {
-    vlc_array_t identifiers;
-
-    vlc_array_init( &identifiers );
-    if( mrl_FragmentSplit( &identifiers, out_extra, data ) )
-        return VLC_EGENERIC;
-
-    size_t count = vlc_array_count( &identifiers );
+    size_t count = vlc_array_count( &mrli->identifiers );
     size_t idx = 0;
 
     while( idx < count )
     {
-        char* id = vlc_array_item_at_index( &identifiers, idx );
+        char* id = vlc_array_item_at_index( &mrli->identifiers, idx );
 
-        if( vlc_stream_extractor_Attach( source, id, NULL ) )
+        if( vlc_stream_extractor_Attach( source, id, NULL,
+                                        (char const **) mrli->volumes.pp_elems,
+                                        mrli->volumes.i_count ) )
             break;
 
         ++idx;
     }
 
-    for( size_t i = 0; i < count; ++i )
-        free( vlc_array_item_at_index( &identifiers, i ) );
-    vlc_array_clear( &identifiers );
-
     return idx == count ? VLC_SUCCESS : VLC_EGENERIC;
 }
 
 char*
 vlc_stream_extractor_CreateMRL( stream_directory_t* directory,
-                                char const* subentry )
+                                char const* subentry,
+                                char const **volumes, size_t volumes_count )
 {
-    return StreamExtractorCreateMRL( directory->source->psz_url, subentry );
+    return StreamExtractorCreateMRL( directory->source->psz_url, subentry,
+                                     volumes, volumes_count );
 }
 
 /**


=====================================
src/test/mrl_helpers.c
=====================================
@@ -71,23 +71,22 @@ int main (void)
 {
     for (size_t i = 0; i < ARRAY_SIZE(testcase); ++i)
     {
-        vlc_array_t out;
-        vlc_array_init(&out);
-        const char *extra = NULL;
-        int ret = mrl_FragmentSplit(&out, &extra, testcase[i].payload);
+        struct mrl_info mrli;
+        mrl_info_Init(&mrli);
+        int ret = mrl_FragmentSplit(&mrli, testcase[i].payload);
         if (testcase[i].success)
         {
             assert(ret == VLC_SUCCESS);
-            if (extra != NULL)
-                assert(strcmp(extra, testcase[i].extra) == 0);
+            if (mrli.extra != NULL)
+                assert(strcmp(mrli.extra, testcase[i].extra) == 0);
             else
                 assert(testcase[i].extra == NULL);
 
             const char *p = testcase[i].payload + 2;
             for (size_t j = 0; testcase[i].results[j] != NULL; ++j)
             {
-                assert(j < vlc_array_count(&out) && j < MAX_RESULT);
-                char *res = vlc_array_item_at_index(&out, j);
+                assert(j < vlc_array_count(&mrli.identifiers) && j < MAX_RESULT);
+                const char *res = vlc_array_item_at_index(&mrli.identifiers, j);
 
                 assert(strcmp(testcase[i].results[j], res) == 0);
 
@@ -97,14 +96,13 @@ int main (void)
                 p += strlen(res_escaped) + 2;
 
                 free(res_escaped);
-                free(res);
             }
         }
         else
         {
             assert(ret != VLC_SUCCESS);
         }
-        vlc_array_clear(&out);
+        mrl_info_Clean(&mrli);
     }
     return 0;
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d5d7cf93bcc50d64af94154ef069d849e9604ea9...4e1a51d8ea35f3487d704289ab968c9b192190d3

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d5d7cf93bcc50d64af94154ef069d849e9604ea9...4e1a51d8ea35f3487d704289ab968c9b192190d3
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list