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.
This commit is contained in:
Mark Nauwelaerts 2007-08-22 08:22:50 +00:00 committed by Stefan Kost
parent 7d92376d3b
commit 09a5687705
3 changed files with 26 additions and 26 deletions

View file

@ -1,3 +1,10 @@
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:

2
common

@ -1 +1 @@
Subproject commit 9c7f1a63dfed1b2770b5fdaa16e0ae114b2177cf
Subproject commit cd25ca736bc2446800de2180ad71fc1da858d324

View file

@ -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,