From e2c32ec99750ca6e2a0bce3e1153d772588ca8aa Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Wed, 4 Dec 2013 16:49:13 -0500 Subject: [PATCH] v4l2object: Move code block where it belongs https://bugzilla.gnome.org/show_bug.cgi?id=720568 --- sys/v4l2/gstv4l2object.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 1181b61ca9..08fca5d8a7 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -2558,12 +2558,6 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps) } if (V4L2_TYPE_IS_MULTIPLANAR (v4l2object->type)) { - /* even in v4l2 multiplanar mode we can work in contiguous mode - * if the device supports it */ - gint n_v4l_planes = - v4l2object->prefered_non_contiguous ? GST_VIDEO_INFO_N_PLANES (&info) : - 1; - GST_DEBUG_OBJECT (v4l2object->element, "Got format to %dx%d, format " "%" GST_FOURCC_FORMAT " colorspace %d, nb planes %d", format.fmt.pix_mp.width, format.fmt.pix_mp.height, @@ -2575,6 +2569,15 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps) format.fmt.pix_mp.height != height || format.fmt.pix_mp.pixelformat != pixelformat || format.fmt.pix_mp.field != field) { + /* even in v4l2 multiplanar mode we can work in contiguous mode + * if the device supports it */ + gint n_v4l_planes; + + if (v4l2object->prefered_non_contiguous) + n_v4l_planes = GST_VIDEO_INFO_N_PLANES (&info); + else + n_v4l_planes = 1; + /* something different, set the format */ GST_DEBUG_OBJECT (v4l2object->element, "Setting format to %dx%d, format " "%" GST_FOURCC_FORMAT, width, height, GST_FOURCC_ARGS (pixelformat));