Negotiation fixes

Original commit message from CVS:
Negotiation fixes
This commit is contained in:
David Schleef 2004-01-02 07:25:10 +00:00
parent ab8b696754
commit 7b159d505f
3 changed files with 26 additions and 29 deletions

View file

@ -1,3 +1,13 @@
2004-01-01 David Schleef <ds@schleef.org>
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 <ds@schleef.org> 2004-01-01 David Schleef <ds@schleef.org>
Convert elements to use gst_pad_use_explicit_caps() where Convert elements to use gst_pad_use_explicit_caps() where

View file

@ -105,28 +105,6 @@ static void gst_audiofilter_class_init (gpointer g_class, gpointer class_data)
gobject_class->get_property = gst_audiofilter_get_property; 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 static GstPadLinkReturn
gst_audiofilter_link (GstPad *pad, const GstCaps *caps) 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); 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); 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_element_add_pad(GST_ELEMENT(audiofilter),audiofilter->sinkpad);
gst_pad_set_chain_function(audiofilter->sinkpad,gst_audiofilter_chain); gst_pad_set_chain_function(audiofilter->sinkpad,gst_audiofilter_chain);
gst_pad_set_link_function(audiofilter->sinkpad,gst_audiofilter_link); 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), pad_template = gst_element_class_get_pad_template(GST_ELEMENT_CLASS(g_class),
"src"); "src");
@ -192,7 +172,7 @@ gst_audiofilter_init (GTypeInstance *instance, gpointer g_class)
audiofilter->srcpad = gst_pad_new_from_template(pad_template, "src"); audiofilter->srcpad = gst_pad_new_from_template(pad_template, "src");
gst_element_add_pad(GST_ELEMENT(audiofilter),audiofilter->srcpad); gst_element_add_pad(GST_ELEMENT(audiofilter),audiofilter->srcpad);
gst_pad_set_link_function(audiofilter->srcpad,gst_audiofilter_link); 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; audiofilter->inited = FALSE;
} }

View file

@ -145,15 +145,20 @@ gst_deinterlace_class_init (GstDeInterlaceClass *klass)
} }
static GstPadLinkReturn static GstPadLinkReturn
gst_deinterlace_sinkconnect (GstPad *pad, const GstCaps *caps) gst_deinterlace_link (GstPad *pad, const GstCaps *caps)
{ {
GstDeInterlace *filter; GstDeInterlace *filter;
GstStructure *structure; GstStructure *structure;
GstPadLinkReturn ret;
filter = GST_DEINTERLACE(gst_pad_get_parent (pad)); filter = GST_DEINTERLACE(gst_pad_get_parent (pad));
structure = gst_caps_get_structure (caps, 0); ret = gst_pad_try_set_caps (filter->srcpad, caps);
if (GST_PAD_LINK_FAILED (ret)) {
return ret;
}
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "width", &filter->width); gst_structure_get_int (structure, "width", &filter->width);
gst_structure_get_int (structure, "height", &filter->height); gst_structure_get_int (structure, "height", &filter->height);
@ -163,7 +168,8 @@ gst_deinterlace_sinkconnect (GstPad *pad, const GstCaps *caps)
filter->picsize = filter->width*filter->height; filter->picsize = filter->width*filter->height;
filter->src = g_malloc(filter->picsize); filter->src = g_malloc(filter->picsize);
} }
return gst_pad_try_set_caps (filter->srcpad, caps);
return GST_PAD_LINK_OK;
} }
static void static void
@ -172,11 +178,12 @@ gst_deinterlace_init (GstDeInterlace *filter)
filter->sinkpad = gst_pad_new_from_template( filter->sinkpad = gst_pad_new_from_template(
gst_static_pad_template_get(&deinterlace_sink_factory),"sink"); gst_static_pad_template_get(&deinterlace_sink_factory),"sink");
gst_pad_set_chain_function(filter->sinkpad,gst_deinterlace_chain); gst_pad_set_chain_function(filter->sinkpad,gst_deinterlace_chain);
gst_pad_set_link_function(filter->sinkpad,gst_deinterlace_sinkconnect); gst_pad_set_link_function(filter->sinkpad,gst_deinterlace_link);
gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad); gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad);
filter->srcpad = gst_pad_new_from_template( filter->srcpad = gst_pad_new_from_template(
gst_static_pad_template_get(&deinterlace_src_factory),"src"); gst_static_pad_template_get(&deinterlace_src_factory),"src");
gst_pad_set_link_function(filter->srcpad,gst_deinterlace_link);
gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad); gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad);
filter->show_deinterlaced_area_only = FALSE; filter->show_deinterlaced_area_only = FALSE;