v4l2: better handle quirks activation
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Wed, 5 Jun 2013 03:42:24 +0000 (23:42 -0400)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Fri, 10 Jan 2014 22:13:22 +0000 (17:13 -0500)
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
sys/v4l2/gstv4l2object.h
sys/v4l2/v4l2_calls.c

index e3e43ed..a6773ba 100644 (file)
@@ -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 */
index c9561c9..a2b4872 100644 (file)
@@ -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 {
index cad9fc7..ae44a1e 100644 (file)
@@ -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 */