[vlc-devel] [RFC 04/10] stream_extractor: add vlc_stream_extractor_Attach

Rémi Denis-Courmont remi at remlab.net
Mon Nov 28 12:23:04 CET 2016


On November 28, 2016 4:22:23 AM GMT+02:00, "Filip Roséen" <filip at atch.se> wrote:
>The documentation associated with these changes should explain what
>the function does in detail, and why it is necessary. In short the
>function simply tries to attach a stream-extractor to a stream_t.
>---
> include/vlc_stream_extractor.h | 24 ++++++++++++++++++++++++
> src/input/stream_extractor.c   | 30 ++++++++++++++++++++++++++++++
> src/libvlccore.sym             |  1 +
> 3 files changed, 55 insertions(+)
>
>diff --git a/include/vlc_stream_extractor.h
>b/include/vlc_stream_extractor.h
>index f01dc9b..1f6d01a 100644
>--- a/include/vlc_stream_extractor.h
>+++ b/include/vlc_stream_extractor.h
>@@ -67,6 +67,30 @@ struct stream_extractor_t {
> typedef struct stream_extractor_t stream_extractor_t;
> 
> /**
>+ * Construct a new stream_extractor-based stream
>+ *
>+ * This function is used to create a stream_t where the underlying
>+ * resurce is a stream_extractor.
>+ *
>+ * If \p identifier is NULL the resulting stream_t (if any) is
>+ * guaranteed to refer to a directory, otherwise the \p identifier
>+ * denotes the specific subentry that one would like to access within
>+ * the stream.
>+ *
>+ * If \p identifier is not NULL, the resulting stream_t (if any)
>+ * will refer to the entity in question.
>+ *
>+ * \param source the stream the stream_extractor will read from
>+ * \param identifier NULL or a c-style string referring to the desired
>entity
>+ * \param module_name NULL or the explicit stream-extractor name *
>requested
>+ *
>+ * \return NULL on error, otherwise a handle into the extracted data
>+ **/
>+
>+VLC_API int vlc_stream_extractor_Attach( stream_t** source,
>+                                         char const* identifier,
>+                                         char const* module_name );
>+/**
>  * @}
>  */
> 
>diff --git a/src/input/stream_extractor.c
>b/src/input/stream_extractor.c
>index a926363..78800e4 100644
>--- a/src/input/stream_extractor.c
>+++ b/src/input/stream_extractor.c
>@@ -166,6 +166,36 @@ se_InitStream( struct stream_extractor_private*
>priv, stream_t* source )
>     return VLC_SUCCESS;
> }
> 
>+int
>+vlc_stream_extractor_Attach( stream_t** source, char const*
>identifier,
>+                             char const* module_name )
>+{
>+    struct stream_extractor_private* priv = vlc_custom_create(
>+        (*source)->obj.parent, sizeof( *priv ), "stream_extractor" );
>+
>+    if( unlikely( !priv ) )
>+        return VLC_ENOMEM;
>+
>+    priv->public.identifier = identifier ? strdup( identifier ) :
>NULL;
>+
>+    if( unlikely( identifier && !priv->public.identifier ) )
>+        goto error;
>+
>+    priv->public.source = *source;
>+    priv->module = module_need( &priv->public, "stream_extractor",
>+                                module_name, true );
>+
>+    if( !priv->module || se_InitStream( priv, *source ) )
>+        goto error;
>+
>+    *source = priv->stream;
>+    return VLC_SUCCESS;
>+
>+error:
>+    se_Release( priv );
>+    return VLC_EGENERIC;
>+}
>+
> /**
>  * @}
>  **/
>diff --git a/src/libvlccore.sym b/src/libvlccore.sym
>index d967523..cd8d0b5 100644
>--- a/src/libvlccore.sym
>+++ b/src/libvlccore.sym
>@@ -395,6 +395,7 @@ spu_ChangeFilters
> spu_Render
> spu_RegisterChannel
> spu_ClearChannel
>+vlc_stream_extractor_Attach
> vlc_stream_Block
> vlc_stream_CommonNew
> vlc_stream_Delete
>-- 
>2.10.2
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

Documentation and code don't seem to match here
-- 
Rémi Denis-Courmont


More information about the vlc-devel mailing list