From 76944350c0cf515c622bb875300cd1f030fc4d71 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 21 Nov 2014 11:54:18 +0100 Subject: [PATCH] Deinterlace: in query_caps return only supported formats if filter is interlaced In some cases the currently set GstVideoInfo is not interlaced, but upstream caps are interlaced and the info is passed in the filter, we should take that info into account and make sure that we do not consider that case as a "pass through" case. https://bugzilla.gnome.org/show_bug.cgi?id=741407 --- gst/deinterlace/gstdeinterlace.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c index 943549d..9a89f5c 100644 --- a/gst/deinterlace/gstdeinterlace.c +++ b/gst/deinterlace/gstdeinterlace.c @@ -2137,6 +2137,8 @@ gst_deinterlace_getcaps (GstDeinterlace * self, GstPad * pad, GstCaps * filter) gboolean half; GstVideoInterlaceMode interlacing_mode; + gboolean filter_interlaced = FALSE; + otherpad = (pad == self->srcpad) ? self->sinkpad : self->srcpad; half = pad != self->srcpad; @@ -2144,9 +2146,27 @@ gst_deinterlace_getcaps (GstDeinterlace * self, GstPad * pad, GstCaps * filter) peercaps = gst_pad_peer_query_caps (otherpad, NULL); interlacing_mode = GST_VIDEO_INFO_INTERLACE_MODE (&self->vinfo); + if (interlacing_mode == GST_VIDEO_INTERLACE_MODE_PROGRESSIVE && filter) { + guint i, caps_size; + + filter_interlaced = TRUE; + caps_size = gst_caps_get_size (filter); + for (i = 0; i < caps_size; i++) { + const gchar *interlace_mode; + GstStructure *structure = gst_caps_get_structure (filter, i); + + interlace_mode = gst_structure_get_string (structure, "interlace-mode"); + + if (!interlace_mode || g_strcmp0 (interlace_mode, "progressive") == 0) { + filter_interlaced = FALSE; + } + } + } + if (self->mode == GST_DEINTERLACE_MODE_INTERLACED || (self->mode == GST_DEINTERLACE_MODE_AUTO && - interlacing_mode != GST_VIDEO_INTERLACE_MODE_PROGRESSIVE)) { + (interlacing_mode != GST_VIDEO_INTERLACE_MODE_PROGRESSIVE || + filter_interlaced))) { gst_caps_unref (ourcaps); ourcaps = gst_caps_from_string (DEINTERLACE_CAPS); } -- 2.7.4