From 410d0c0194d2628f271da0a1c810ad77446cf733 Mon Sep 17 00:00:00 2001 From: Youness Alaoui Date: Wed, 16 Jan 2013 14:41:08 -0500 Subject: [PATCH] uvch264: Add a fakesink to the transform_caps Some version of basetransform will return the template caps if the src pad is not linked, so the capsfilter will return ANY. Linking it to fakesink allows us to return the right caps in the capsfilter and have them transformed by the colorspace converter. --- sys/uvch264/gstuvch264_src.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/uvch264/gstuvch264_src.c b/sys/uvch264/gstuvch264_src.c index 69351e7126..206ead8bbf 100644 --- a/sys/uvch264/gstuvch264_src.c +++ b/sys/uvch264/gstuvch264_src.c @@ -2185,20 +2185,33 @@ _transform_caps (GstUvcH264Src * self, GstCaps * caps, const gchar * name) { GstElement *el = gst_element_factory_make (name, NULL); GstElement *cf = gst_element_factory_make ("capsfilter", NULL); + GstElement *fs = gst_element_factory_make ("fakesink", NULL); GstPad *sink; - if (!el || !cf || !gst_bin_add (GST_BIN (self), el)) { + if (!el || !cf || !fs || !gst_bin_add (GST_BIN (self), el)) { if (el) gst_object_unref (el); if (cf) gst_object_unref (cf); + if (fs) + gst_object_unref (fs); goto done; } if (!gst_bin_add (GST_BIN (self), cf)) { gst_object_unref (cf); + gst_object_unref (fs); gst_bin_remove (GST_BIN (self), el); goto done; } + if (!gst_bin_add (GST_BIN (self), fs)) { + gst_object_unref (fs); + gst_bin_remove (GST_BIN (self), el); + gst_bin_remove (GST_BIN (self), cf); + goto done; + } + + if (!gst_element_link (cf, fs)) + goto error_remove; if (!gst_element_link (el, cf)) goto error_remove; @@ -2213,6 +2226,7 @@ _transform_caps (GstUvcH264Src * self, GstCaps * caps, const gchar * name) error_remove: gst_bin_remove (GST_BIN (self), cf); gst_bin_remove (GST_BIN (self), el); + gst_bin_remove (GST_BIN (self), fs); done: return caps;