Commit c04c5161 authored by Filip Roséen's avatar Filip Roséen Committed by Hugo Beauzée-Luyssen

input/stream: add stream_extractor_AttachedParsed

This function will be used by entities who would otherwise have to
manually attach stream-extractors to a stream through use of
mrl_FragmentSplit and repeated use of vlc_stream_extractor_Attach.

As this handles both, it will be prevent reimplementing the same
functionality for cases where this is required.
Signed-off-by: Hugo Beauzée-Luyssen's avatarHugo Beauzée-Luyssen <>
parent 87d62e28
......@@ -53,6 +53,35 @@ stream_t *stream_FilterAutoNew( stream_t *source ) VLC_USED;
stream_t *stream_FilterChainNew( stream_t *p_source, const char *psz_chain );
* Attach \ref stream_extractor%s according to specified data
* This function will parse the passed data, and try to attach a \ref
* stream_extractor for each specified entity as per the fragment specification
* associated with a \ref mrl,
* \warning The data in `*stream` can be modified even if this function only
* locates some of the entities specified in `psz_data`. It is up to
* the caller to free the resource referred to by `*stream`, no matter
* what this function returns.
* \warning Please see \ref vlc_stream_extractor_Attach for a function that
* will not modify the passed stream upon failure. \ref
* stream_extractor_AttachParsed shall only be used when the caller
* only cares about the stream on successful attachment of **all**
* stream-extractors referred to by `psz_data`, something which is not
* guaranteed.
* \param[out] source a pointer-to-pointer to stream where the attached
* stream-extractor will be applied. `*stream` will refer
* to the last successful attachment.
* \param[out] out_extra `*out_extra` will point to any additional data
* 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* psz_data,
char const** out_extra );
char *get_path(const char *location);
......@@ -337,6 +337,35 @@ vlc_stream_extractor_Attach( stream_t** source, char const* identifier,
return StreamExtractorAttach( source, identifier, module_name );
stream_extractor_AttachParsed( stream_t** source, char const* data,
char const** out_extra )
vlc_array_t identifiers;
if( mrl_FragmentSplit( &identifiers, out_extra, data ) )
size_t count = vlc_array_count( &identifiers );
size_t idx = 0;
while( idx < count )
char* id = vlc_array_item_at_index( &identifiers, idx );
if( vlc_stream_extractor_Attach( source, id, NULL ) )
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;
vlc_stream_extractor_CreateMRL( stream_directory_t* directory,
char const* subentry )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment