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.
This commit is contained in:
Youness Alaoui 2013-01-16 14:41:08 -05:00 committed by Olivier Crête
parent e358ec6ddd
commit 410d0c0194

View file

@ -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;