From 0bbdb9bb1d9408dbbe753b47c3b919ddc285511c Mon Sep 17 00:00:00 2001 From: Matthieu Bouron Date: Fri, 6 Dec 2013 17:08:54 +0000 Subject: [PATCH] deinterlace: support any video formats and any caps features if deinterlace mode allows it https://bugzilla.gnome.org/show_bug.cgi?id=719636 --- gst/deinterlace/gstdeinterlace.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c index 5111c00..800bb08 100644 --- a/gst/deinterlace/gstdeinterlace.c +++ b/gst/deinterlace/gstdeinterlace.c @@ -277,16 +277,19 @@ gst_deinterlace_locking_get_type (void) #define DEINTERLACE_CAPS GST_VIDEO_CAPS_MAKE(DEINTERLACE_VIDEO_FORMATS) +#define DEINTERLACE_ALL_CAPS DEINTERLACE_CAPS ";" \ + GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("ANY", GST_VIDEO_FORMATS_ALL) + static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS (DEINTERLACE_CAPS) + GST_STATIC_CAPS (DEINTERLACE_ALL_CAPS) ); static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS (DEINTERLACE_CAPS) + GST_STATIC_CAPS (DEINTERLACE_ALL_CAPS) ); static void gst_deinterlace_finalize (GObject * self); @@ -2126,6 +2129,7 @@ gst_deinterlace_getcaps (GstDeinterlace * self, GstPad * pad, GstCaps * filter) GstCaps *ourcaps; GstCaps *peercaps; gboolean half; + GstVideoInterlaceMode interlacing_mode; otherpad = (pad == self->srcpad) ? self->sinkpad : self->srcpad; half = pad != self->srcpad; @@ -2133,6 +2137,14 @@ gst_deinterlace_getcaps (GstDeinterlace * self, GstPad * pad, GstCaps * filter) ourcaps = gst_pad_get_pad_template_caps (pad); peercaps = gst_pad_peer_query_caps (otherpad, NULL); + 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)) { + gst_caps_unref (ourcaps); + ourcaps = gst_caps_from_string (DEINTERLACE_CAPS); + } + if (peercaps) { GST_DEBUG_OBJECT (pad, "Peer has caps %" GST_PTR_FORMAT, peercaps); ret = gst_caps_make_writable (gst_caps_intersect (ourcaps, peercaps)); -- 2.7.4