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
This commit is contained in:
Nicolas Dufresne 2013-06-04 23:42:24 -04:00 committed by Nicolas Dufresne
parent 092e7605d3
commit 203e245134
3 changed files with 12 additions and 5 deletions

View file

@ -1830,11 +1830,7 @@ gst_v4l2_object_probe_caps_for_format_and_size (GstV4l2Object * v4l2object,
gint int_width = width; gint int_width = width;
gint int_height = height; gint int_height = height;
if (!strcmp ((char *) v4l2object->vcap.driver, "uvcvideo")) { if (v4l2object->never_interlaced) {
/*
* 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
*/
interlaced = FALSE; interlaced = FALSE;
} else { } else {
/* Interlaced detection using VIDIOC_TRY/S_FMT */ /* Interlaced detection using VIDIOC_TRY/S_FMT */

View file

@ -174,6 +174,10 @@ struct _GstV4l2Object {
GstV4l2GetInOutFunction get_in_out_func; GstV4l2GetInOutFunction get_in_out_func;
GstV4l2SetInOutFunction set_in_out_func; GstV4l2SetInOutFunction set_in_out_func;
GstV4l2UpdateFpsFunction update_fps_func; GstV4l2UpdateFpsFunction update_fps_func;
/* Quirks */
/* Skips interlacing probes */
gboolean never_interlaced;
}; };
struct _GstV4l2ObjectClassHelper { struct _GstV4l2ObjectClassHelper {

View file

@ -581,6 +581,13 @@ gst_v4l2_open (GstV4l2Object * v4l2object)
if (v4l2object->extra_controls) if (v4l2object->extra_controls)
gst_v4l2_set_controls (v4l2object, 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; return TRUE;
/* ERRORS */ /* ERRORS */