v4l2transform: Check if caps have changes before asserting

In set_caps, now checks if caps actually changed and succeed if they didn't
change.
This commit is contained in:
Nicolas Dufresne 2014-04-15 16:43:15 -04:00
parent a89986ebd5
commit 026f79b5bd
2 changed files with 18 additions and 1 deletions

View file

@ -188,7 +188,9 @@ gst_v4l2_transform_stop (GstBaseTransform * trans)
gst_v4l2_object_close (self->v4l2output);
gst_v4l2_object_close (self->v4l2capture);
gst_caps_replace (&self->probed_srccaps, NULL);
gst_caps_replace (&self->probed_sinkcaps, NULL);
gst_caps_replace (&self->probed_srccaps, NULL);
gst_caps_replace (&self->incaps, NULL);
gst_caps_replace (&self->outcaps, NULL);
return TRUE;
}
@ -199,10 +201,21 @@ gst_v4l2_transform_set_caps (GstBaseTransform * trans, GstCaps * incaps,
{
GstV4l2Transform *self = GST_V4L2_TRANSFORM (trans);
if (self->incaps && self->outcaps) {
if (gst_caps_is_equal (incaps, self->incaps) &&
gst_caps_is_equal (outcaps, self->outcaps)) {
GST_DEBUG_OBJECT (trans, "Caps did not changed");
return TRUE;
}
}
/* TODO Add renegotiation support */
g_return_val_if_fail (!GST_V4L2_IS_ACTIVE (self->v4l2output), FALSE);
g_return_val_if_fail (!GST_V4L2_IS_ACTIVE (self->v4l2capture), FALSE);
gst_caps_replace (&self->incaps, incaps);
gst_caps_replace (&self->outcaps, outcaps);
if (!gst_v4l2_object_set_format (self->v4l2output, incaps))
goto incaps_failed;

View file

@ -59,6 +59,10 @@ struct _GstV4l2Transform
/* pads */
GstCaps *probed_srccaps;
GstCaps *probed_sinkcaps;
/* Selected caps */
GstCaps *incaps;
GstCaps *outcaps;
};
struct _GstV4l2TransformClass