From 84dc9631015e8d688ecb2cff4979f4382f397065 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Fri, 2 Jan 2004 07:25:10 +0000 Subject: [PATCH] Negotiation fixes Original commit message from CVS: Negotiation fixes --- ChangeLog | 10 ++++++++++ gst-libs/gst/audio/gstaudiofilter.c | 30 +++++------------------------ gst/volume/gstvolume.c | 17 ++++++++++------ 3 files changed, 26 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa195725e2..b796638fb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-01-01 David Schleef + + Negotiation fixes: + * gst-libs/gst/audio/gstaudiofilter.c: (gst_audiofilter_link), + (gst_audiofilter_init): + * gst/debug/efence.c: (gst_efence_init): + * gst/deinterlace/gstdeinterlace.c: (gst_deinterlace_link), + (gst_deinterlace_init): + * gst/volume/gstvolume.c: (volume_connect): + 2004-01-01 David Schleef Convert elements to use gst_pad_use_explicit_caps() where diff --git a/gst-libs/gst/audio/gstaudiofilter.c b/gst-libs/gst/audio/gstaudiofilter.c index 46e7c7de60..cda21da072 100644 --- a/gst-libs/gst/audio/gstaudiofilter.c +++ b/gst-libs/gst/audio/gstaudiofilter.c @@ -105,28 +105,6 @@ static void gst_audiofilter_class_init (gpointer g_class, gpointer class_data) gobject_class->get_property = gst_audiofilter_get_property; } -static GstCaps * -gst_audiofilter_getcaps (GstPad *pad) -{ - GstAudiofilter *audiofilter; - GstCaps *othercaps; - GstAudiofilterClass *audiofilter_class; - - GST_DEBUG("gst_audiofilter_sink_getcaps"); - audiofilter = GST_AUDIOFILTER (gst_pad_get_parent (pad)); - - audiofilter_class = GST_AUDIOFILTER_CLASS ( - G_OBJECT_GET_CLASS (audiofilter)); - - if (pad == audiofilter->srcpad) { - othercaps = gst_pad_get_allowed_caps (audiofilter->sinkpad); - } else { - othercaps = gst_pad_get_allowed_caps (audiofilter->srcpad); - } - - return gst_caps_intersect (othercaps, audiofilter_class->caps); -} - static GstPadLinkReturn gst_audiofilter_link (GstPad *pad, const GstCaps *caps) { @@ -148,7 +126,9 @@ gst_audiofilter_link (GstPad *pad, const GstCaps *caps) link_ret = gst_pad_try_set_caps (audiofilter->srcpad, caps); } - if (link_ret != GST_PAD_LINK_OK) return link_ret; + if (GST_PAD_LINK_FAILED (link_ret)) { + return link_ret; + } structure = gst_caps_get_structure (caps, 0); @@ -184,7 +164,7 @@ gst_audiofilter_init (GTypeInstance *instance, gpointer g_class) gst_element_add_pad(GST_ELEMENT(audiofilter),audiofilter->sinkpad); gst_pad_set_chain_function(audiofilter->sinkpad,gst_audiofilter_chain); gst_pad_set_link_function(audiofilter->sinkpad,gst_audiofilter_link); - gst_pad_set_getcaps_function(audiofilter->sinkpad,gst_audiofilter_getcaps); + gst_pad_set_getcaps_function(audiofilter->sinkpad,gst_pad_proxy_getcaps); pad_template = gst_element_class_get_pad_template(GST_ELEMENT_CLASS(g_class), "src"); @@ -192,7 +172,7 @@ gst_audiofilter_init (GTypeInstance *instance, gpointer g_class) audiofilter->srcpad = gst_pad_new_from_template(pad_template, "src"); gst_element_add_pad(GST_ELEMENT(audiofilter),audiofilter->srcpad); gst_pad_set_link_function(audiofilter->srcpad,gst_audiofilter_link); - gst_pad_set_getcaps_function(audiofilter->srcpad,gst_audiofilter_getcaps); + gst_pad_set_getcaps_function(audiofilter->srcpad,gst_pad_proxy_getcaps); audiofilter->inited = FALSE; } diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c index de7ebf14e1..4dbbaab4d3 100644 --- a/gst/volume/gstvolume.c +++ b/gst/volume/gstvolume.c @@ -117,22 +117,27 @@ volume_connect (GstPad *pad, const GstCaps *caps) GstVolume *filter; GstPad *otherpad; gint rate; - GstPadLinkReturn set_retval; + GstPadLinkReturn link_ret; GstStructure *structure; filter = GST_VOLUME (gst_pad_get_parent (pad)); g_return_val_if_fail (GST_IS_VOLUME (filter), GST_PAD_LINK_REFUSED); otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad); + structure = gst_caps_get_structure (caps, 0); + gst_structure_get_int (structure, "rate", &rate); + link_ret = gst_pad_try_set_caps (otherpad, caps); + if (GST_PAD_LINK_FAILED (link_ret)){ + return link_ret; + } + if (!volume_parse_caps (filter, structure)) return GST_PAD_LINK_REFUSED; - if ((set_retval = gst_pad_try_set_caps(otherpad, caps)) > 0) - if (gst_structure_get_int (structure, "rate", &rate)){ - gst_dpman_set_rate(filter->dpman, rate); - } - return set_retval; + gst_dpman_set_rate(filter->dpman, rate); + + return GST_PAD_LINK_OK; } static gboolean