summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2015-10-19 17:50:28 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2015-10-25 11:01:45 -0300
commit82d62b9edd04bb7f5a1fece9d803e02629ddefd1 (patch)
treeadc5511adcfa0c6f46ea9494936314c6abf29a63
parentcf830a55b17cd374a5e9641514248e17261ce727 (diff)
deinterlace: implement accept-caps
Implement accept-caps handler to avoid doing a full caps query downstream to handle it. This commit implements accept-caps as a simplification of the _getcaps function, so it exposes the same limitations that getcaps would. For example, not accepting renegotiation to caps with capsfeatures when it was last configured to a caps that it has to deinterlace.
-rw-r--r--gst/deinterlace/gstdeinterlace.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c
index 0c46a4229..e4aeafa05 100644
--- a/gst/deinterlace/gstdeinterlace.c
+++ b/gst/deinterlace/gstdeinterlace.c
@@ -2123,6 +2123,32 @@ gst_fraction_double (gint * n_out, gint * d_out, gboolean half)
return TRUE;
}
+static gboolean
+gst_deinterlace_acceptcaps (GstDeinterlace * self, GstPad * pad, GstCaps * caps)
+{
+ gboolean ret;
+ GstCaps *ourcaps;
+ GstVideoInterlaceMode interlacing_mode;
+
+ interlacing_mode = GST_VIDEO_INFO_INTERLACE_MODE (&self->vinfo);
+
+ if (self->mode == GST_DEINTERLACE_MODE_INTERLACED ||
+ (self->mode == GST_DEINTERLACE_MODE_AUTO &&
+ interlacing_mode != GST_VIDEO_INTERLACE_MODE_PROGRESSIVE)) {
+ ourcaps = gst_caps_from_string (DEINTERLACE_CAPS);
+ } else {
+ ourcaps = gst_pad_get_pad_template_caps (pad);
+ }
+
+ ret = gst_caps_can_intersect (caps, ourcaps);
+ gst_caps_unref (ourcaps);
+
+ GST_DEBUG_OBJECT (pad, "accept-caps result:%d for caps %" GST_PTR_FORMAT,
+ ret, caps);
+
+ return ret;
+}
+
static GstCaps *
gst_deinterlace_getcaps (GstDeinterlace * self, GstPad * pad, GstCaps * filter)
{
@@ -2675,6 +2701,17 @@ gst_deinterlace_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
res = TRUE;
break;
}
+ case GST_QUERY_ACCEPT_CAPS:
+ {
+ GstCaps *caps;
+ gboolean ret;
+
+ gst_query_parse_accept_caps (query, &caps);
+ ret = gst_deinterlace_acceptcaps (self, pad, caps);
+ gst_query_set_accept_caps_result (query, ret);
+ res = TRUE;
+ break;
+ }
case GST_QUERY_ALLOCATION:
if (self->passthrough)
res = gst_pad_peer_query (self->srcpad, query);