[vlc-devel] [PATCH v1 07/33] filter: allow using filters with a sink callback to filter into a single picture

Rémi Denis-Courmont remi at remlab.net
Fri Sep 25 17:27:53 CEST 2020


Hi,

That API is fundamentally incompatible with asynchronous use as the filter would have no sink to output to outside the callback.

That's why decoders get an owner callback for this purpose instead.

While I don't expect that asynchronous filters will work quiet yet, I don't want to revector into an API that gets us further from the goal.

Le 25 septembre 2020 17:46:43 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>If a filter sending pictures to a sink send more than one picture to a
>sink,
>the code will assert. It means filter_FilterSingle was used with a
>filter that
>sends more than one picture. So filter_FilterSingle() should only be
>used with
>safe filters, ie not user defined ones bu mostly converters. This is
>already
>the case.
>---
> include/vlc_filter.h | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
>diff --git a/include/vlc_filter.h b/include/vlc_filter.h
>index 9f8da434fd4..e660e8c6d18 100644
>--- a/include/vlc_filter.h
>+++ b/include/vlc_filter.h
>@@ -219,8 +219,23 @@ static inline picture_t *filter_NewPicture(
>filter_t *p_filter )
>     return pic;
> }
> 
>+static inline int GetSingleResult(struct vlc_video_sink *sink,
>picture_t *output)
>+{
>+    picture_t **single_output = (picture_t **)sink->sys;
>+    vlc_assert(*single_output == NULL); // called filter_FilterSingle
>on wrong filter
>+    *single_output = output;
>+    return VLC_SUCCESS;
>+}
>+
>static inline picture_t *filter_FilterSingle( filter_t *p_filter,
>picture_t *pic )
> {
>+    if ( p_filter->pf_video_filter_into != NULL )
>+    {
>+        picture_t *result = NULL;
>+        struct vlc_video_sink sink = { &result, GetSingleResult };
>+        p_filter->pf_video_filter_into( p_filter, pic, &sink );
>+        return result;
>+    }
>     return p_filter->pf_video_filter( p_filter, pic );
> }
> 
>-- 
>2.26.2
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200925/3195cf8f/attachment.html>


More information about the vlc-devel mailing list