diff options
author | Peter Seiderer <ps.report@gmx.net> | 2014-11-14 12:59:31 +0100 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2015-01-22 18:52:44 -0500 |
commit | c88e042458cf8f612ccb8680c9305eb287fdc2cd (patch) | |
tree | 8a29df0026cbc7357e57b7941f8a173276eb542f /sys/v4l2 | |
parent | 60e2d0c84fcb7ca4096eaf6398252bff87ba70b4 (diff) |
v4l2object: reuse caps framerate if not overwritten by v4l2 device
Enables duration setting in v4l2src.
https://bugzilla.gnome.org/show_bug.cgi?id=740403
Diffstat (limited to 'sys/v4l2')
-rw-r--r-- | sys/v4l2/gstv4l2object.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 8168b8047..64e881fa7 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -2801,12 +2801,20 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps) if (v4l2_ioctl (fd, VIDIOC_S_PARM, &streamparm) < 0) goto set_parm_failed; - /* get new values */ - fps_d = streamparm.parm.capture.timeperframe.numerator; - fps_n = streamparm.parm.capture.timeperframe.denominator; - - GST_INFO_OBJECT (v4l2object->element, "Set framerate to %u/%u", fps_n, - fps_d); + if (streamparm.parm.capture.timeperframe.numerator > 0 && + streamparm.parm.capture.timeperframe.denominator > 0) { + /* get new values */ + fps_d = streamparm.parm.capture.timeperframe.numerator; + fps_n = streamparm.parm.capture.timeperframe.denominator; + + GST_INFO_OBJECT (v4l2object->element, "Set framerate to %u/%u", fps_n, + fps_d); + } else { + /* fix v4l2 capture driver to provide framerate values */ + GST_WARNING_OBJECT (v4l2object->element, + "Reuse caps framerate %u/%u - fix v4l2 capture driver", + fps_n, fps_d); + } GST_VIDEO_INFO_FPS_N (&info) = fps_n; GST_VIDEO_INFO_FPS_D (&info) = fps_d; |