v4l2: log error when format doesn't match

This commit is contained in:
Wim Taymans 2020-05-08 17:35:57 +02:00
parent d22cb01c6e
commit 12b8e095c7

View file

@ -902,16 +902,22 @@ static int spa_v4l2_set_format(struct impl *this, struct spa_video_info *format,
if (xioctl(dev->fd, VIDIOC_S_PARM, &streamparm) < 0)
spa_log_warn(this->log, "VIDIOC_S_PARM: %m");
if (reqfmt.fmt.pix.pixelformat != fmt.fmt.pix.pixelformat ||
reqfmt.fmt.pix.width != fmt.fmt.pix.width ||
reqfmt.fmt.pix.height != fmt.fmt.pix.height) {
spa_log_error(this->log, "v4l2: wanted %.4s %dx%d, got %.4s %dx%d",
(char *)&reqfmt.fmt.pix.pixelformat,
reqfmt.fmt.pix.width, reqfmt.fmt.pix.height,
(char *)&fmt.fmt.pix.pixelformat,
fmt.fmt.pix.width, fmt.fmt.pix.height);
return -EINVAL;
}
spa_log_info(this->log, "v4l2: got %.4s %dx%d %d/%d", (char *)&fmt.fmt.pix.pixelformat,
fmt.fmt.pix.width, fmt.fmt.pix.height,
streamparm.parm.capture.timeperframe.denominator,
streamparm.parm.capture.timeperframe.numerator);
if (reqfmt.fmt.pix.pixelformat != fmt.fmt.pix.pixelformat ||
reqfmt.fmt.pix.width != fmt.fmt.pix.width ||
reqfmt.fmt.pix.height != fmt.fmt.pix.height)
return -EINVAL;
if (try_only)
return 0;