v4l2: v4l2_camera_proxy: Implement VIDIOC_ENUM_FRAMESIZES
Implement VIDIOC_ENUM_FRAMESIZES in the V4L2 compatibility layer. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
e0e10d2b53
commit
c857ae3c89
2 changed files with 27 additions and 0 deletions
|
@ -241,6 +241,28 @@ int V4L2CameraProxy::vidioc_querycap(struct v4l2_capability *arg)
|
||||||
return 0;
|
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)
|
int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *arg)
|
||||||
{
|
{
|
||||||
LOG(V4L2Compat, Debug) << "Servicing vidioc_enum_fmt fd = " << file->efd();
|
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_ = {
|
const std::set<unsigned long> V4L2CameraProxy::supportedIoctls_ = {
|
||||||
VIDIOC_QUERYCAP,
|
VIDIOC_QUERYCAP,
|
||||||
|
VIDIOC_ENUM_FRAMESIZES,
|
||||||
VIDIOC_ENUM_FMT,
|
VIDIOC_ENUM_FMT,
|
||||||
VIDIOC_G_FMT,
|
VIDIOC_G_FMT,
|
||||||
VIDIOC_S_FMT,
|
VIDIOC_S_FMT,
|
||||||
|
@ -665,6 +688,9 @@ int V4L2CameraProxy::ioctl(V4L2CameraFile *file, unsigned long request, void *ar
|
||||||
case VIDIOC_QUERYCAP:
|
case VIDIOC_QUERYCAP:
|
||||||
ret = vidioc_querycap(static_cast<struct v4l2_capability *>(arg));
|
ret = vidioc_querycap(static_cast<struct v4l2_capability *>(arg));
|
||||||
break;
|
break;
|
||||||
|
case VIDIOC_ENUM_FRAMESIZES:
|
||||||
|
ret = vidioc_enum_framesizes(file, static_cast<struct v4l2_frmsizeenum *>(arg));
|
||||||
|
break;
|
||||||
case VIDIOC_ENUM_FMT:
|
case VIDIOC_ENUM_FMT:
|
||||||
ret = vidioc_enum_fmt(file, static_cast<struct v4l2_fmtdesc *>(arg));
|
ret = vidioc_enum_fmt(file, static_cast<struct v4l2_fmtdesc *>(arg));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -48,6 +48,7 @@ private:
|
||||||
void freeBuffers();
|
void freeBuffers();
|
||||||
|
|
||||||
int vidioc_querycap(struct v4l2_capability *arg);
|
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_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *arg);
|
||||||
int vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg);
|
int vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg);
|
||||||
int vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg);
|
int vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue