summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
Diffstat (limited to 'gst')
-rw-r--r--gst/deinterlace/gstdeinterlace.c19
-rw-r--r--gst/videodrop/gstvideodrop.c28
2 files changed, 40 insertions, 7 deletions
diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c
index 93a2bdb2..3c2941ba 100644
--- a/gst/deinterlace/gstdeinterlace.c
+++ b/gst/deinterlace/gstdeinterlace.c
@@ -139,6 +139,18 @@ gst_deinterlace_class_init (GstDeInterlaceClass * klass)
gobject_class->set_property = gst_deinterlace_set_property;
gobject_class->get_property = gst_deinterlace_get_property;
}
+static GstCaps *
+gst_deinterlace_getcaps (GstPad * pad)
+{
+ GstDeInterlace *filter;
+ GstPad *otherpad;
+
+ filter = GST_DEINTERLACE (gst_pad_get_parent (pad));
+
+ otherpad = (pad == filter->srcpad) ? filter->sinkpad : filter->srcpad;
+
+ return gst_pad_get_allowed_caps (otherpad);
+}
static GstPadLinkReturn
gst_deinterlace_link (GstPad * pad, const GstCaps * caps)
@@ -146,10 +158,13 @@ gst_deinterlace_link (GstPad * pad, const GstCaps * caps)
GstDeInterlace *filter;
GstStructure *structure;
GstPadLinkReturn ret;
+ GstPad *otherpad;
filter = GST_DEINTERLACE (gst_pad_get_parent (pad));
- ret = gst_pad_try_set_caps (filter->srcpad, caps);
+ otherpad = (pad == filter->srcpad) ? filter->sinkpad : filter->srcpad;
+
+ ret = gst_pad_try_set_caps (otherpad, caps);
if (GST_PAD_LINK_FAILED (ret)) {
return ret;
}
@@ -176,12 +191,14 @@ gst_deinterlace_init (GstDeInterlace * filter)
(&deinterlace_sink_factory), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_deinterlace_chain);
gst_pad_set_link_function (filter->sinkpad, gst_deinterlace_link);
+ gst_pad_set_getcaps_function (filter->sinkpad, gst_deinterlace_getcaps);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
filter->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&deinterlace_src_factory), "src");
gst_pad_set_link_function (filter->srcpad, gst_deinterlace_link);
+ gst_pad_set_getcaps_function (filter->srcpad, gst_deinterlace_getcaps);
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->show_deinterlaced_area_only = FALSE;
diff --git a/gst/videodrop/gstvideodrop.c b/gst/videodrop/gstvideodrop.c
index e4f2e4ec..447a1bc7 100644
--- a/gst/videodrop/gstvideodrop.c
+++ b/gst/videodrop/gstvideodrop.c
@@ -162,9 +162,9 @@ gst_videodrop_getcaps (GstPad * pad)
gst_structure_set (structure,
"framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL);
}
- if (negotiated) {
- for (i = 0; i < gst_caps_get_size (caps); i++) {
- structure = gst_caps_get_structure (caps, i);
+ if ((negotiated) && (videodrop->speed != 1.0)) {
+ for (i = 0; i < gst_caps_get_size (copy2); i++) {
+ structure = gst_caps_get_structure (copy2, i);
gst_structure_set (structure,
"framerate", G_TYPE_DOUBLE, otherfps * videodrop->speed, NULL);
@@ -195,14 +195,30 @@ gst_videodrop_link (GstPad * pad, const GstCaps * caps)
ret = gst_structure_get_double (structure, "framerate", &fps);
if (!ret)
return GST_PAD_LINK_REFUSED;
+
if (pad == videodrop->srcpad) {
- videodrop->from_fps = fps;
- } else {
videodrop->to_fps = fps;
+ } else {
+ videodrop->from_fps = fps;
}
if (gst_pad_is_negotiated (otherpad)) {
- gst_pad_renegotiate (otherpad);
+ /*
+ * Ensure that the other side talks the format we're trying to set
+ */
+ GstCaps *newcaps = gst_caps_copy (caps);
+
+ if (pad == videodrop->srcpad) {
+ gst_caps_set_simple (newcaps,
+ "framerate", G_TYPE_DOUBLE, videodrop->from_fps, NULL);
+ } else {
+ gst_caps_set_simple (newcaps,
+ "framerate", G_TYPE_DOUBLE, videodrop->to_fps, NULL);
+ }
+ ret = gst_pad_try_set_caps (otherpad, newcaps);
+ if (GST_PAD_LINK_FAILED (ret)) {
+ return GST_PAD_LINK_REFUSED;
+ }
}
return GST_PAD_LINK_OK;