v4l2: handle EINVAL without posting a warning

EINVAL means that a call is not supported, we only want to post a WARNING when
something is really wrong.
This commit is contained in:
Wim Taymans 2011-07-13 11:36:54 +02:00
parent 50ce1807f0
commit 6d97bfc41f

View file

@ -2072,8 +2072,8 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps)
struct v4l2_streamparm *streamparm; struct v4l2_streamparm *streamparm;
enum v4l2_field field; enum v4l2_field field;
guint32 pixelformat; guint32 pixelformat;
gint width; gint ret;
gint height; gint width, height;
gboolean interlaced; gboolean interlaced;
struct v4l2_fmtdesc *fmtdesc; struct v4l2_fmtdesc *fmtdesc;
guint fps_n, fps_d; guint fps_n, fps_d;
@ -2161,7 +2161,7 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps)
memset (streamparm, 0x00, sizeof (struct v4l2_streamparm)); memset (streamparm, 0x00, sizeof (struct v4l2_streamparm));
streamparm->type = v4l2object->type; streamparm->type = v4l2object->type;
if (v4l2_ioctl (fd, VIDIOC_G_PARM, streamparm) < 0) if ((ret = v4l2_ioctl (fd, VIDIOC_G_PARM, streamparm)) < 0)
goto get_parm_failed; goto get_parm_failed;
if (v4l2object->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { if (v4l2object->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
@ -2255,9 +2255,12 @@ invalid_pixelformat:
} }
get_parm_failed: get_parm_failed:
{ {
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS, /* it's possible that this call is not supported */
(_("Could not get parameters on device '%s'"), if (ret != EINVAL) {
v4l2object->videodev), GST_ERROR_SYSTEM); GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
(_("Could not get parameters on device '%s'"),
v4l2object->videodev), GST_ERROR_SYSTEM);
}
goto done; goto done;
} }
set_parm_failed: set_parm_failed: