gst/median/gstmedian.c: Fix capsnego.

Original commit message from CVS:
2004-01-08  Ronald Bultje  <rbultje@ronald.bitfreak.net>

* gst/median/gstmedian.c: (gst_median_link), (gst_median_init):
Fix capsnego.
This commit is contained in:
Ronald S. Bultje 2004-01-08 12:42:40 +00:00
parent 365079c2a4
commit c247ad4c07
2 changed files with 23 additions and 11 deletions

View file

@ -1,3 +1,8 @@
2004-01-08 Ronald Bultje <rbultje@ronald.bitfreak.net>
* gst/median/gstmedian.c: (gst_median_link), (gst_median_init):
Fix capsnego.
2004-01-08 Julien MOUTTE <julien@moutte.net>
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_create): Using XOverlay

View file

@ -137,32 +137,39 @@ gst_median_class_init (GstMedianClass *klass)
}
static gboolean
gst_median_sinkconnect (GstPad *pad, const GstCaps *caps)
gst_median_link (GstPad *pad, const GstCaps *caps)
{
GstMedian *filter;
GstStructure *structure;
GstMedian *filter = GST_MEDIAN (gst_pad_get_parent (pad));
GstPad *otherpad = (pad == filter->srcpad) ? filter->sinkpad : filter->srcpad;
GstStructure *structure = gst_caps_get_structure (caps, 0);
gint w, h;
GstPadLinkReturn ret;
filter = GST_MEDIAN (gst_pad_get_parent (pad));
gst_structure_get_int (structure, "width", &w);
gst_structure_get_int (structure, "height", &h);
structure = gst_caps_get_structure (caps, 0);
ret = gst_pad_try_set_caps (otherpad, caps);
if (GST_PAD_LINK_SUCCESSFUL (ret)) {
filter->width = w;
filter->height = h;
}
gst_structure_get_int (structure, "width", &filter->width);
gst_structure_get_int (structure, "height", &filter->height);
/* forward to the next plugin */
return gst_pad_try_set_caps(filter->srcpad, caps);
return ret;
}
void gst_median_init (GstMedian *median)
{
median->sinkpad = gst_pad_new_from_template (
gst_static_pad_template_get (&median_sink_factory), "sink");
gst_pad_set_link_function (median->sinkpad, gst_median_sinkconnect);
gst_pad_set_getcaps_function (median->sinkpad, gst_pad_proxy_getcaps);
gst_pad_set_link_function (median->sinkpad, gst_median_link);
gst_pad_set_chain_function (median->sinkpad, gst_median_chain);
gst_element_add_pad (GST_ELEMENT (median), median->sinkpad);
median->srcpad = gst_pad_new_from_template (
gst_static_pad_template_get (&median_src_factory), "src");
gst_pad_set_getcaps_function (median->srcpad, gst_pad_proxy_getcaps);
gst_pad_set_link_function (median->sinkpad, gst_median_link);
gst_element_add_pad (GST_ELEMENT (median), median->srcpad);
median->filtersize = 5;