From cf4c9556158a88c8856f46026529627cb1d483c0 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 16 May 2011 18:29:29 +0200 Subject: [PATCH] capsfilter: allow NULL filters and fix refcounting --- plugins/elements/gstcapsfilter.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/elements/gstcapsfilter.c b/plugins/elements/gstcapsfilter.c index 192939e..b70b93b 100644 --- a/plugins/elements/gstcapsfilter.c +++ b/plugins/elements/gstcapsfilter.c @@ -258,8 +258,14 @@ gst_capsfilter_transform_caps (GstBaseTransform * base, filter_caps = gst_caps_ref (capsfilter->filter_caps); GST_OBJECT_UNLOCK (capsfilter); - tmp = gst_caps_intersect_full (filter, filter_caps, GST_CAPS_INTERSECT_FIRST); - ret = gst_caps_intersect_full (tmp, caps, GST_CAPS_INTERSECT_FIRST); + if (filter) { + tmp = + gst_caps_intersect_full (filter, filter_caps, GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (filter_caps); + filter_caps = tmp; + } + + ret = gst_caps_intersect_full (filter_caps, caps, GST_CAPS_INTERSECT_FIRST); GST_DEBUG_OBJECT (capsfilter, "input: %" GST_PTR_FORMAT, caps); GST_DEBUG_OBJECT (capsfilter, "filter: %" GST_PTR_FORMAT, filter); -- 2.7.4