From 203e2451346d1161d95ee318479fd8e1ea892ab1 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Tue, 4 Jun 2013 23:42:24 -0400 Subject: [PATCH] v4l2: better handle quirks activation This way we can activate deactivate those quirks all at once at one place. https://bugzilla.gnome.org/show_bug.cgi?id=720568 --- sys/v4l2/gstv4l2object.c | 6 +----- sys/v4l2/gstv4l2object.h | 4 ++++ sys/v4l2/v4l2_calls.c | 7 +++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index e3e43ed145..a6773ba2ff 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -1830,11 +1830,7 @@ gst_v4l2_object_probe_caps_for_format_and_size (GstV4l2Object * v4l2object, gint int_width = width; gint int_height = height; - if (!strcmp ((char *) v4l2object->vcap.driver, "uvcvideo")) { - /* - * UVC devices are never interlaced, and doing VIDIOC_TRY_FMT on them - * causes expensive and slow USB IO, so don't probe them for interlaced - */ + if (v4l2object->never_interlaced) { interlaced = FALSE; } else { /* Interlaced detection using VIDIOC_TRY/S_FMT */ diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h index c9561c9730..a2b4872c31 100644 --- a/sys/v4l2/gstv4l2object.h +++ b/sys/v4l2/gstv4l2object.h @@ -174,6 +174,10 @@ struct _GstV4l2Object { GstV4l2GetInOutFunction get_in_out_func; GstV4l2SetInOutFunction set_in_out_func; GstV4l2UpdateFpsFunction update_fps_func; + + /* Quirks */ + /* Skips interlacing probes */ + gboolean never_interlaced; }; struct _GstV4l2ObjectClassHelper { diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c index cad9fc7019..ae44a1eaab 100644 --- a/sys/v4l2/v4l2_calls.c +++ b/sys/v4l2/v4l2_calls.c @@ -581,6 +581,13 @@ gst_v4l2_open (GstV4l2Object * v4l2object) if (v4l2object->extra_controls) gst_v4l2_set_controls (v4l2object, v4l2object->extra_controls); + /* UVC devices are never interlaced, and doing VIDIOC_TRY_FMT on them + * causes expensive and slow USB IO, so don't probe them for interlaced + */ + if (!strcmp ((char *) v4l2object->vcap.driver, "uvcusb")) { + v4l2object->never_interlaced = TRUE; + } + return TRUE; /* ERRORS */