[prev in list] [next in list] [prev in thread] [next in thread]
List: gstreamer-cvs
Subject: [1.4] gst-plugins-good: v4l2: get_nearest_size: Always reinit all struct fields on retry
From: nicolasd () kemper ! freedesktop ! org (Nicolas Dufresne)
Date: 2014-08-29 20:52:37
Message-ID: 20140829205237.C9776761EF () kemper ! freedesktop ! org
[Download RAW message or body]
Module: gst-plugins-good
Branch: 1.4
Commit: 69fe66f4e1e69d17a691dbd73bed3f6286bd962f
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=69fe66f4e1e69d17a691dbd73bed3f6286bd962f
Author: Hans de Goede <hdegoede@redhat.com>
Date: Fri Aug 29 10:57:20 2014 +0200
v4l2: get_nearest_size: Always reinit all struct fields on retry
They may have been modified by the ioctl even if it failed. This also makes
the S_FMT fallback path try progressive first, making it consistent with the
preferred TRY_FMT path.
https://bugzilla.gnome.org/show_bug.cgi?id=735660
---
sys/v4l2/gstv4l2object.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
index 3b22b1a..881a52d 100644
--- a/sys/v4l2/gstv4l2object.c
+++ b/sys/v4l2/gstv4l2object.c
@@ -2171,6 +2171,8 @@ gst_v4l2_object_get_nearest_size (GstV4l2Object * v4l2object,
r = v4l2_ioctl (fd, VIDIOC_TRY_FMT, &fmt);
if (r < 0 && errno == EINVAL) {
/* try again with interlaced video */
+ memset (&fmt, 0, sizeof (fmt));
+ fmt.type = v4l2object->type;
fmt.fmt.pix.width = *width;
fmt.fmt.pix.height = *height;
fmt.fmt.pix.pixelformat = pixelformat;
@@ -2192,16 +2194,22 @@ gst_v4l2_object_get_nearest_size (GstV4l2Object * v4l2object,
GST_LOG_OBJECT (v4l2object->element,
"Failed to probe size limit with VIDIOC_TRY_FMT, trying VIDIOC_S_FMT");
+ memset (&fmt, 0, sizeof (fmt));
+ fmt.type = v4l2object->type;
fmt.fmt.pix.width = *width;
fmt.fmt.pix.height = *height;
+ fmt.fmt.pix.pixelformat = pixelformat;
+ fmt.fmt.pix.field = V4L2_FIELD_NONE;
r = v4l2_ioctl (fd, VIDIOC_S_FMT, &fmt);
if (r < 0 && errno == EINVAL) {
- /* try again with progressive video */
+ /* try again with interlaced video */
+ memset (&fmt, 0, sizeof (fmt));
+ fmt.type = v4l2object->type;
fmt.fmt.pix.width = *width;
fmt.fmt.pix.height = *height;
fmt.fmt.pix.pixelformat = pixelformat;
- fmt.fmt.pix.field = V4L2_FIELD_NONE;
+ fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
r = v4l2_ioctl (fd, VIDIOC_S_FMT, &fmt);
}
_______________________________________________
gstreamer-commits mailing list
gstreamer-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic