From bae90f595503022731c11f70be2d952ae4c09e05 Mon Sep 17 00:00:00 2001 From: mrcgran Date: Mon, 2 Oct 2006 10:06:17 +0000 Subject: [PATCH] gst/gstghostpad.c: Filter the proxied caps against the padtemplate if we have one. Original commit message from CVS: Patch by: mrcgran * gst/gstghostpad.c: (gst_proxy_pad_do_getcaps): Filter the proxied caps against the padtemplate if we have one. * gst/gstquery.c: (gst_query_new_segment): Add include for gstinfo.h so that compilation with -DGST_DISABLE_GST_DEBUG works again. Fixes #358436. --- ChangeLog | 11 +++++++++++ gst/gstghostpad.c | 23 +++++++++++++++++++---- gst/gstquery.c | 4 +++- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index bb7e02d1da..198cf57401 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-10-02 Wim Taymans + + Patch by: mrcgran + + * gst/gstghostpad.c: (gst_proxy_pad_do_getcaps): + Filter the proxied caps against the padtemplate if we have one. + + * gst/gstquery.c: (gst_query_new_segment): + Add include for gstinfo.h so that compilation with + -DGST_DISABLE_GST_DEBUG works again. Fixes #358436. + 2006-10-02 Wim Taymans Patch by: Alessandro Decina diff --git a/gst/gstghostpad.c b/gst/gstghostpad.c index 50c1474e13..90af4c9886 100644 --- a/gst/gstghostpad.c +++ b/gst/gstghostpad.c @@ -45,6 +45,7 @@ */ #include "gst_private.h" +#include "gstinfo.h" #include "gstghostpad.h" @@ -218,16 +219,30 @@ gst_proxy_pad_do_getcaps (GstPad * pad) { GstPad *target = gst_proxy_pad_get_target (pad); GstCaps *res; + GstPadTemplate *templ = GST_PAD_PAD_TEMPLATE (pad); if (target) { /* if we have a real target, proxy the call */ - GST_DEBUG_OBJECT (pad, "get caps of target"); res = gst_pad_get_caps (target); gst_object_unref (target); - } else { - GstPadTemplate *templ = GST_PAD_PAD_TEMPLATE (pad); - /* else, if we have a template, use that */ + GST_DEBUG_OBJECT (pad, "get caps of target: %" GST_PTR_FORMAT, res); + + /* filter against the template */ + if (templ && res) { + GstCaps *filt, *tmp; + + filt = GST_PAD_TEMPLATE_CAPS (templ); + if (filt) { + tmp = gst_caps_intersect (filt, res); + gst_caps_unref (res); + res = tmp; + GST_DEBUG_OBJECT (pad, + "filtered against template gives %" GST_PTR_FORMAT, res); + } + } + } else { + /* else, if we have a template, use its caps. */ if (templ) { res = GST_PAD_TEMPLATE_CAPS (templ); GST_DEBUG_OBJECT (pad, diff --git a/gst/gstquery.c b/gst/gstquery.c index 4b7ca57711..f03a9e5724 100644 --- a/gst/gstquery.c +++ b/gst/gstquery.c @@ -59,8 +59,10 @@ * Last reviewed on 2006-02-14 (0.10.4) */ -#include "gst_private.h" #include + +#include "gst_private.h" +#include "gstinfo.h" #include "gstquery.h" #include "gstvalue.h" #include "gstenumtypes.h"