Commit 09a56877 authored by Mark Nauwelaerts's avatar Mark Nauwelaerts Committed by Stefan Kost
Browse files

sys/v4l2/v4l2src_calls.c: Handle optional v4l2 ioctls gracefully.

Original commit message from CVS:
patch by: Mark Nauwelaerts <manauw@skynet.be>
* sys/v4l2/v4l2src_calls.c:
Handle optional v4l2 ioctls gracefully.
parent 7d92376d
2007-08-22 Stefan Kost <ensonic@users.sf.net>
patch by: Mark Nauwelaerts <manauw@skynet.be>
* sys/v4l2/v4l2src_calls.c:
Handle optional v4l2 ioctls gracefully.
2007-08-20 Wim Taymans <wim.taymans@gmail.com>
* gst/rtp/Makefile.am:
......
common @ cd25ca73
Subproject commit 9c7f1a63dfed1b2770b5fdaa16e0ae114b2177cf
Subproject commit cd25ca736bc2446800de2180ad71fc1da858d324
......@@ -892,21 +892,28 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src, guint32 pixelformat,
memset (&stream, 0x00, sizeof (struct v4l2_streamparm));
stream.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl (fd, VIDIOC_G_PARM, &stream) < 0)
goto get_parm_failed;
if (ioctl (fd, VIDIOC_G_PARM, &stream) < 0) {
GST_ELEMENT_WARNING (v4l2src, RESOURCE, SETTINGS,
(_("Could not get parameters on device '%s'"),
v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM);
} else { /* seems no point in SET, if can't get GET */
/* Note: V4L2 gives us the frame interval, we need the frame rate */
stream.parm.capture.timeperframe.numerator = fps_d;
stream.parm.capture.timeperframe.denominator = fps_n;
/* Note: V4L2 gives us the frame interval, we need the frame rate */
stream.parm.capture.timeperframe.numerator = fps_d;
stream.parm.capture.timeperframe.denominator = fps_n;
if (ioctl (fd, VIDIOC_S_PARM, &stream) < 0) {
GST_ELEMENT_WARNING (v4l2src, RESOURCE, SETTINGS,
(_("Could not set parameters on device '%s'"),
v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM);
if (ioctl (fd, VIDIOC_S_PARM, &stream) < 0)
goto set_parm_failed;
/* FIXME: better test for fraction equality */
if (stream.parm.capture.timeperframe.numerator != fps_d
|| stream.parm.capture.timeperframe.denominator != fps_n)
goto invalid_framerate;
}
}
/* FIXME: better test for fraction equality */
if (stream.parm.capture.timeperframe.numerator != fps_d
|| stream.parm.capture.timeperframe.denominator != fps_n)
goto invalid_framerate;
return TRUE;
......@@ -948,20 +955,6 @@ invalid_pixelformat:
GST_FOURCC_ARGS (format.fmt.pix.pixelformat)));
return FALSE;
}
get_parm_failed:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS,
(_("Could not get parameters on device '%s'"),
v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
set_parm_failed:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS,
(_("Could not set parameters on device '%s'"),
v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM);
return FALSE;
}
invalid_framerate:
{
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment