[vlc-devel] Revised patches for MRL-stream handling
Filip Roséen
filip at atch.se
Wed Mar 29 10:43:35 CEST 2017
Hi,
Attached to this email is an `mbox` that contains the revised
patches related to the [previously submitted patch-batch][1].
Best Regards,\
Filip
[1]: https://mailman.videolan.org/pipermail/vlc-devel/2017-March/112232.html
-------------------------------------------------------------------------
Summary
-------------------------------------------------------------------------
As the changes are relatively minor I will outline the changes in this
email instead of fully resubmitting all of the patches where most
patches are only affected by a single line-change:
- The declaration for `vlc_stream_NewMRL` has been moved from
`include/vlc_stream.h` to `include/vlc_stream_extractor.h` to
prevent people from "accidentally" using the function due to
ignorance.
- The documentation for `vlc_stream_NewMRL` has been rewritten:
- The summary-line has been shortened.
- The wording has changed in an attempt to be more explicit about
when `vlc_stream_NewMRL` is required compared to
`vlc_strean_NewURL`.
- The documentation for the internal function `stream_extractor_AttachParsed`
has been revised to fit better in the doxygen format.
- A slight error has been corrected in `vlc_stream_NewMRL` that
leaked allocated resource on error.
- Usage of `vlc_stream_NewMRL` now requires include of
`include/vlc_stream_extractor.h`, and the affected patches has been
updated.
The patch-batch in its current state is currently available at the
[relevant branch][2] on my public github repo.
[2]: https://github.com/FilipRoseen-refp/vlc/commits/stream_extractor-MRL
-------------------------------------------------------------------------
*diff* related to changes
-------------------------------------------------------------------------
Below is the *diff* between the previous submission, and the updated one
(for those who prefer viewing cold hard diffs instead of reading the
previous stated summary).
diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index 8341c8a19f..a2a84065f8 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -366,22 +366,6 @@ VLC_USED;
#define vlc_stream_NewURL(a, b) vlc_stream_NewURL(VLC_OBJECT(a), b)
/**
- * Create a stream_t reading from a \ref MRL.
- * You must delete it using vlc_stream_Delete.
- *
- * \warning This function shall only be used when MRL functionality is
- * explicitly needed (such as when referring to items within an
- * archive). \ref vlc_stream_NewURL shall be used where applicable.
- *
- * \param obj the parent of the requested stream
- * \param mrl the mrl for which the stream_t should be created
- * \return NULL on error, pointer to stream_t on success
- */
-VLC_API stream_t * vlc_stream_NewMRL(vlc_object_t *obj, const char *mrl)
-VLC_USED;
-#define vlc_stream_NewMRL(a, b) vlc_stream_NewMRL(VLC_OBJECT(a), b)
-
-/**
* \defgroup stream_fifo FIFO stream
* In-memory anonymous pipe
@{
diff --git a/include/vlc_stream_extractor.h b/include/vlc_stream_extractor.h
index bc90879016..45c46d566d 100644
--- a/include/vlc_stream_extractor.h
+++ b/include/vlc_stream_extractor.h
@@ -90,6 +90,29 @@ typedef struct stream_directory_t {
} stream_directory_t;
/**
+ * Create a stream for the data referred to by a \ref mrl
+ *
+ * This function will create a \ref stream that reads from the specified \ref
+ * mrl, potentially making use of \ref stream_extractor%s to access named
+ * entities within the data read from the original source.
+ *
+ * - See the \ref mrl specification for further information.
+ * - The returned resource shall be deleted through \ref vlc_stream_Delete.
+ *
+ * \warning This function is only be used when \ref mrl functionality is
+ * explicitly needed, \ref vlc_stream_NewURL shall be used where
+ * applicable (and functionality associated with \ref MRL is not
+ * wanted nor needed).
+ *
+ * \param obj the owner of the requested stream
+ * \param mrl the mrl for which the stream_t should be created
+ * \return `NULL` on error, a pointer to \ref stream_t on success.
+ **/
+VLC_API stream_t * vlc_stream_NewMRL(vlc_object_t *obj, const char *mrl)
+VLC_USED;
+#define vlc_stream_NewMRL(a, b) vlc_stream_NewMRL(VLC_OBJECT(a), b)
+
+/**
* Create a relative MRL for the associated entity
*
* This function shall be used by stream_directory_t's in order to
diff --git a/modules/misc/addons/fsstorage.c b/modules/misc/addons/fsstorage.c
index 6da5f28319..d9133e4ad3 100644
--- a/modules/misc/addons/fsstorage.c
+++ b/modules/misc/addons/fsstorage.c
@@ -30,6 +30,7 @@
#include <vlc_plugin.h>
#include <vlc_modules.h>
#include <vlc_stream.h>
+#include <vlc_stream_extractor.h>
#include <vlc_addons.h>
#include <vlc_fs.h>
#include <vlc_strings.h>
diff --git a/modules/misc/addons/vorepository.c b/modules/misc/addons/vorepository.c
index f2cd6ee383..375a1a6ee6 100644
--- a/modules/misc/addons/vorepository.c
+++ b/modules/misc/addons/vorepository.c
@@ -29,6 +29,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_stream.h>
+#include <vlc_stream_extractor.h>
#include <vlc_addons.h>
#include <vlc_xml.h>
#include <vlc_fs.h>
diff --git a/src/input/stream.c b/src/input/stream.c
index 063daa4c95..6045f53cee 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -145,12 +145,13 @@ stream_t *(vlc_stream_NewMRL)(vlc_object_t* parent, const char* mrl )
char const* anchor = strchr( mrl, '#' );
if( anchor == NULL )
- anchor = "#";
+ return stream;
char const* extra;
if( stream_extractor_AttachParsed( &stream, anchor + 1, &extra ) )
{
msg_Err( parent, "unable to open %s", mrl );
+ vlc_stream_Delete( stream );
return NULL;
}
diff --git a/src/input/stream.h b/src/input/stream.h
index 2f5ca8b9b7..97d1957b26 100644
--- a/src/input/stream.h
+++ b/src/input/stream.h
@@ -54,8 +54,11 @@ stream_t *stream_FilterAutoNew( stream_t *source ) VLC_USED;
stream_t *stream_FilterChainNew( stream_t *p_source, const char *psz_chain );
/**
- * This function will parse the passed data, and try to attach
- * stream-extractors for each specified entity as per \ref mrl,
+ * 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170329/4256ea7b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stream-extractor_mrl.mbox
Type: application/mbox
Size: 16195 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170329/4256ea7b/attachment.mbox>
More information about the vlc-devel
mailing list