Add device_v4l2_t (private data)

This commit is contained in:
Kamil Trzcinski
2022-04-10 15:49:41 +02:00
parent 41a42e27a3
commit 5760f5fbac
9 changed files with 47 additions and 40 deletions

View File

@ -15,7 +15,7 @@ int v4l2_device_set_option_by_id(device_t *dev, const char *name, uint32_t id, i
ctl.id = id;
ctl.value = value;
E_LOG_DEBUG(dev, "Configuring option %s (%08x) = %d", name, id, value);
E_XIOCTL(dev, dev->v4l2.subdev_fd >= 0 ? dev->v4l2.subdev_fd : dev->v4l2.dev_fd, VIDIOC_S_CTRL, &ctl, "Can't set option %s", name);
E_XIOCTL(dev, dev->v4l2->subdev_fd >= 0 ? dev->v4l2->subdev_fd : dev->v4l2->dev_fd, VIDIOC_S_CTRL, &ctl, "Can't set option %s", name);
return 0;
error:
return -1;
@ -152,10 +152,10 @@ int v4l2_device_set_option(device_t *dev, const char *key, const char *value)
v4l2_device_option_normalize_name(keyp);
if (dev->v4l2.subdev_fd >= 0)
ret = v4l2_device_set_option_string_fd(dev, dev->v4l2.subdev_fd, keyp, valuep);
if (dev->v4l2->subdev_fd >= 0)
ret = v4l2_device_set_option_string_fd(dev, dev->v4l2->subdev_fd, keyp, valuep);
if (ret <= 0)
ret = v4l2_device_set_option_string_fd(dev, dev->v4l2.dev_fd, keyp, valuep);
ret = v4l2_device_set_option_string_fd(dev, dev->v4l2->dev_fd, keyp, valuep);
free(keyp);
free(valuep);