From f94bfc65a56032a5c57ad1c6c3aa913b684f7735 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Tue, 16 Feb 2010 10:11:40 +0200 Subject: [PATCH] v4l2: init datastructures after pre-conditions checks --- sys/v4l2/gstv4l2object.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 1a15947..04d2ad0 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -1860,12 +1860,12 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, guint32 pixelformat, GST_V4L2_CHECK_OPEN (v4l2object); GST_V4L2_CHECK_NOT_ACTIVE (v4l2object); - memset (&format, 0x00, sizeof (struct v4l2_format)); - format.type = v4l2object->type; - if (pixelformat == GST_MAKE_FOURCC ('M', 'P', 'E', 'G')) return TRUE; + memset (&format, 0x00, sizeof (struct v4l2_format)); + format.type = v4l2object->type; + if (v4l2_ioctl (fd, VIDIOC_G_FMT, &format) < 0) goto get_fmt_failed; @@ -1873,12 +1873,13 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, guint32 pixelformat, format.fmt.pix.width = width; format.fmt.pix.height = height; format.fmt.pix.pixelformat = pixelformat; - /* request whole frames; change when gstreamer supports interlaced video + /* FIXME: request whole frames; need to use gstreamer interlace support * (INTERLACED mode returns frames where the fields have already been * combined, there are other modes for requesting fields individually) */ format.fmt.pix.field = V4L2_FIELD_INTERLACED; if (v4l2_ioctl (fd, VIDIOC_S_FMT, &format) < 0) { + /* we might also get EBUSY here */ if (errno != EINVAL) goto set_fmt_failed; -- 2.7.4