Move dev->subdev_fd
to dev->v4l2.subdev_fd
This commit is contained in:
parent
645f4a6f33
commit
ce439fc1ee
@ -10,14 +10,12 @@ device_t *device_open(const char *name, const char *path, device_hw_t *hw) {
|
||||
dev->path = strdup(path);
|
||||
dev->hw = hw;
|
||||
dev->fd = -1;
|
||||
dev->subdev_fd = -1;
|
||||
dev->allow_dma = true;
|
||||
|
||||
if (dev->hw->device_open(dev) < 0) {
|
||||
E_LOG_ERROR(dev, "Can't open device: %s", path);
|
||||
}
|
||||
|
||||
E_LOG_INFO(dev, "Device path=%s fd=%d opened", dev->path, dev->fd);
|
||||
return dev;
|
||||
|
||||
error:
|
||||
|
@ -33,13 +33,16 @@ typedef struct device_s {
|
||||
char *path;
|
||||
char bus_info[64];
|
||||
int fd;
|
||||
int subdev_fd;
|
||||
bool allow_dma;
|
||||
|
||||
device_hw_t *hw;
|
||||
buffer_list_t *capture_list;
|
||||
buffer_list_t *output_list;
|
||||
|
||||
struct {
|
||||
int subdev_fd;
|
||||
} v4l2;
|
||||
|
||||
device_t *output_device;
|
||||
bool paused;
|
||||
bool decoder_started;
|
||||
|
@ -5,7 +5,7 @@
|
||||
int v4l2_device_open(device_t *dev)
|
||||
{
|
||||
dev->fd = -1;
|
||||
dev->subdev_fd = -1;
|
||||
dev->v4l2.subdev_fd = -1;
|
||||
|
||||
dev->fd = open(dev->path, O_RDWR|O_NONBLOCK);
|
||||
if (dev->fd < 0) {
|
||||
@ -22,7 +22,8 @@ int v4l2_device_open(device_t *dev)
|
||||
}
|
||||
|
||||
strcpy(dev->bus_info, v4l2_cap.bus_info);
|
||||
dev->subdev_fd = v4l2_device_open_v4l2_subdev(dev, 0);
|
||||
dev->v4l2.subdev_fd = v4l2_device_open_v4l2_subdev(dev, 0);
|
||||
E_LOG_INFO(dev, "Device path=%s fd=%d opened", dev->path, dev->fd);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -32,8 +33,8 @@ error:
|
||||
|
||||
void v4l2_device_close(device_t *dev)
|
||||
{
|
||||
if (dev->subdev_fd >= 0) {
|
||||
close(dev->subdev_fd);
|
||||
if (dev->v4l2.subdev_fd >= 0) {
|
||||
close(dev->v4l2.subdev_fd);
|
||||
}
|
||||
|
||||
if(dev->fd >= 0) {
|
||||
|
@ -111,7 +111,7 @@ int v4l2_device_set_pad_format(device_t *dev, unsigned width, unsigned height, u
|
||||
{
|
||||
struct v4l2_subdev_format fmt = {0};
|
||||
|
||||
if (dev->subdev_fd < 0) {
|
||||
if (dev->v4l2.subdev_fd < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -123,8 +123,8 @@ int v4l2_device_set_pad_format(device_t *dev, unsigned width, unsigned height, u
|
||||
fmt.format.colorspace = V4L2_COLORSPACE_RAW;
|
||||
fmt.format.field = V4L2_FIELD_ANY;
|
||||
|
||||
E_LOG_DEBUG(dev, "Configuring mpad %d (subdev_fd=%d)...", fmt.pad, dev->subdev_fd);
|
||||
E_XIOCTL(dev, dev->subdev_fd, VIDIOC_SUBDEV_S_FMT, &fmt, "Can't configure mpad %d (subdev_fd=%d)", fmt.pad, dev->subdev_fd);
|
||||
E_LOG_DEBUG(dev, "Configuring mpad %d (subdev_fd=%d)...", fmt.pad, dev->v4l2.subdev_fd);
|
||||
E_XIOCTL(dev, dev->v4l2.subdev_fd, VIDIOC_SUBDEV_S_FMT, &fmt, "Can't configure mpad %d (subdev_fd=%d)", fmt.pad, dev->v4l2.subdev_fd);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
|
@ -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->subdev_fd >= 0 ? dev->subdev_fd : 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->fd, VIDIOC_S_CTRL, &ctl, "Can't set option %s", name);
|
||||
return 0;
|
||||
error:
|
||||
return -1;
|
||||
@ -152,8 +152,8 @@ int v4l2_device_set_option(device_t *dev, const char *key, const char *value)
|
||||
|
||||
v4l2_device_option_normalize_name(keyp);
|
||||
|
||||
if (dev->subdev_fd >= 0)
|
||||
ret = v4l2_device_set_option_string_fd(dev, dev->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->fd, keyp, valuep);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user