[vlc-devel] [PATCH 04/14] filter_chain: only set the video owner for video filters

Steve Lhomme robux4 at ycbcr.xyz
Thu Jul 25 12:34:03 CEST 2019


spu filters don't set an owner for the filter chain (for now)
---
 src/misc/filter_chain.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index ac7a809466..4ff34658ea 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -70,7 +70,7 @@ static void FilterDeletePictures( picture_t * );
 
 static filter_chain_t *filter_chain_NewInner( vlc_object_t *obj,
     const char *cap, const char *conv_cap, bool fmt_out_change,
-    const video_filter_owner_t *owner, enum es_format_category_e cat )
+    enum es_format_category_e cat )
 {
     assert( obj != NULL );
     assert( cap != NULL );
@@ -80,10 +80,6 @@ static filter_chain_t *filter_chain_NewInner( vlc_object_t *obj,
         return NULL;
 
     chain->obj = obj;
-    if( owner != NULL )
-        chain->parent_video_owner = *owner;
-    else
-        chain->parent_video_owner =  (video_filter_owner_t){};
     chain->first = NULL;
     chain->last = NULL;
     es_format_Init( &chain->fmt_in, cat, 0 );
@@ -100,7 +96,7 @@ static filter_chain_t *filter_chain_NewInner( vlc_object_t *obj,
  */
 filter_chain_t *filter_chain_NewSPU( vlc_object_t *obj, const char *cap )
 {
-    return filter_chain_NewInner( obj, cap, NULL, false, NULL, SPU_ES );
+    return filter_chain_NewInner( obj, cap, NULL, false, SPU_ES );
 }
 
 /** Chained filter picture allocator function */
@@ -134,8 +130,21 @@ static const struct filter_video_callbacks filter_chain_video_cbs =
 filter_chain_t *filter_chain_NewVideo( vlc_object_t *obj, bool allow_change,
                                        const video_filter_owner_t *restrict owner )
 {
-    return filter_chain_NewInner( obj, "video filter",
-                                  "video converter", allow_change, owner, VIDEO_ES );
+    filter_chain_t *chain =
+        filter_chain_NewInner( obj, "video filter",
+                                  "video converter", allow_change, VIDEO_ES );
+    if (unlikely(chain == NULL))
+        return NULL;
+
+    if( owner != NULL && owner->video != NULL )
+    {
+        // keep this to get pictures for the last filter in the chain
+        assert( owner->video->buffer_new != NULL );
+        chain->parent_video_owner = *owner;
+    }
+    else
+        chain->parent_video_owner = (video_filter_owner_t){};
+    return chain;
 }
 
 /**
-- 
2.17.1



More information about the vlc-devel mailing list