diff options
-rw-r--r-- | v4l2-apps/libv4l/ChangeLog | 1 | ||||
-rw-r--r-- | v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c | 28 |
2 files changed, 17 insertions, 12 deletions
diff --git a/v4l2-apps/libv4l/ChangeLog b/v4l2-apps/libv4l/ChangeLog index ebe34fb7f..b57ceca57 100644 --- a/v4l2-apps/libv4l/ChangeLog +++ b/v4l2-apps/libv4l/ChangeLog @@ -3,6 +3,7 @@ libv4l-0.5.98 * Genius E-M 112 needs both upside down and whitebalance flags * Some makefile improvements by Gregor Jasny * If the card name contains a / replace it with a - in the shm name +* Only created shared memory segment when we have fake v4l2 controls libv4l-0.5.97 ------------- diff --git a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c index 4834c786a..2aa2d8b38 100644 --- a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c +++ b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c @@ -181,6 +181,20 @@ struct v4lcontrol_data *v4lcontrol_create(int fd) if (!data) return NULL; + data->fd = fd; + + v4lcontrol_init_flags(data); + + /* Allow overriding through environment */ + if ((s = getenv("LIBV4LCONTROL_FLAGS"))) + data->flags = strtol(s, NULL, 0); + + if ((s = getenv("LIBV4LCONTROL_CONTROLS"))) + data->controls = strtol(s, NULL, 0); + + if (data->controls == 0) + return data; /* No need to create a shared memory segment */ + syscall(SYS_ioctl, fd, VIDIOC_QUERYCAP, &cap); snprintf(shm_name, 256, "/%s:%s", cap.bus_info, cap.card); @@ -214,17 +228,6 @@ struct v4lcontrol_data *v4lcontrol_create(int fd) data->shm_values[V4LCONTROL_NORM_HIGH_BOUND] = 255; } - data->fd = fd; - - v4lcontrol_init_flags(data); - - /* Allow overriding through environment */ - if ((s = getenv("LIBV4LCONTROL_FLAGS"))) - data->flags = strtol(s, NULL, 0); - - if ((s = getenv("LIBV4LCONTROL_CONTROLS"))) - data->controls = strtol(s, NULL, 0); - return data; error: @@ -234,7 +237,8 @@ error: void v4lcontrol_destroy(struct v4lcontrol_data *data) { - munmap(data->shm_values, V4LCONTROL_SHM_SIZE); + if (data->controls) + munmap(data->shm_values, V4LCONTROL_SHM_SIZE); free(data); } |