diff options
Diffstat (limited to 'src/v4l2')
-rw-r--r-- | src/v4l2/v4l2_camera_proxy.cpp | 26 | ||||
-rw-r--r-- | src/v4l2/v4l2_camera_proxy.h | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 198d4af8..0099266e 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -241,6 +241,28 @@ int V4L2CameraProxy::vidioc_querycap(struct v4l2_capability *arg) return 0; } +int V4L2CameraProxy::vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_frmsizeenum *arg) +{ + LOG(V4L2Compat, Debug) << "Servicing vidioc_enum_framesizes fd = " << file->efd(); + + PixelFormat argFormat = v4l2ToDrm(arg->pixel_format); + /* + * \todo This might need to be expanded as few pipeline handlers + * report StreamFormats. + */ + const std::vector<Size> &frameSizes = streamConfig_.formats().sizes(argFormat); + + if (arg->index >= frameSizes.size()) + return -EINVAL; + + arg->type = V4L2_FRMSIZE_TYPE_DISCRETE; + arg->discrete.width = frameSizes[arg->index].width; + arg->discrete.height = frameSizes[arg->index].height; + memset(arg->reserved, 0, sizeof(arg->reserved)); + + return 0; +} + int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *arg) { LOG(V4L2Compat, Debug) << "Servicing vidioc_enum_fmt fd = " << file->efd(); @@ -626,6 +648,7 @@ int V4L2CameraProxy::vidioc_streamoff(V4L2CameraFile *file, int *arg) const std::set<unsigned long> V4L2CameraProxy::supportedIoctls_ = { VIDIOC_QUERYCAP, + VIDIOC_ENUM_FRAMESIZES, VIDIOC_ENUM_FMT, VIDIOC_G_FMT, VIDIOC_S_FMT, @@ -665,6 +688,9 @@ int V4L2CameraProxy::ioctl(V4L2CameraFile *file, unsigned long request, void *ar case VIDIOC_QUERYCAP: ret = vidioc_querycap(static_cast<struct v4l2_capability *>(arg)); break; + case VIDIOC_ENUM_FRAMESIZES: + ret = vidioc_enum_framesizes(file, static_cast<struct v4l2_frmsizeenum *>(arg)); + break; case VIDIOC_ENUM_FMT: ret = vidioc_enum_fmt(file, static_cast<struct v4l2_fmtdesc *>(arg)); break; diff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h index 707a0de6..5de2c5ae 100644 --- a/src/v4l2/v4l2_camera_proxy.h +++ b/src/v4l2/v4l2_camera_proxy.h @@ -48,6 +48,7 @@ private: void freeBuffers(); int vidioc_querycap(struct v4l2_capability *arg); + int vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_frmsizeenum *arg); int vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *arg); int vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg); int vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg); |