diff --git a/include/exynos_v4l2.h b/include/exynos_v4l2.h index ed26397..134ea93 100644 --- a/include/exynos_v4l2.h +++ b/include/exynos_v4l2.h @@ -94,6 +94,8 @@ int exynos_v4l2_s_parm(int fd, struct v4l2_streamparm *streamparm); int exynos_v4l2_g_ext_ctrl(int fd, struct v4l2_ext_controls *ctrl); /*! \ingroup exynos_v4l2 */ int exynos_v4l2_s_ext_ctrl(int fd, struct v4l2_ext_controls *ctrl); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_prepare(int fd, struct v4l2_buffer *buf); /* V4L2_SUBDEV */ #include diff --git a/libv4l2/exynos_v4l2.c b/libv4l2/exynos_v4l2.c index 1937c0f..d7bb33d 100644 --- a/libv4l2/exynos_v4l2.c +++ b/libv4l2/exynos_v4l2.c @@ -866,3 +866,28 @@ int exynos_v4l2_s_ext_ctrl(int fd, struct v4l2_ext_controls *ctrl) return ret; } + +int exynos_v4l2_prepare(int fd, struct v4l2_buffer *buf) +{ + int ret = -1; + + Exynos_v4l2_In(); + + if (fd < 0) { + ALOGE("%s: invalid fd: %d", __func__, fd); + return ret; + } + + if (!buf) { + ALOGE("%s: buf is NULL", __func__); + return ret; + } + + ret = ioctl(fd, VIDIOC_PREPARE_BUF, buf); + if (ret) + ALOGE("failed to ioctl: VIDIOC_PREPARE_BUF (%d - %s)", errno, strerror(errno)); + + Exynos_v4l2_Out(); + + return ret; +}