Add ioctl interface used in v4l2m2m

Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
This commit is contained in:
shizhenghui 2024-01-22 19:20:13 +08:00 committed by Xiang Xiao
parent 0f0c370520
commit 3afd26bcd1
3 changed files with 57 additions and 3 deletions

View File

@ -427,7 +427,6 @@ static int v4l2_ioctl(FAR struct file *filep,
return v4l2->vops->enum_fmt(v4l2,
(FAR struct v4l2_fmtdesc *)arg);
break;
case VIDIOC_ENUM_FRAMEINTERVALS:
if (v4l2->vops->enum_frminterval == NULL)
@ -437,7 +436,6 @@ static int v4l2_ioctl(FAR struct file *filep,
return v4l2->vops->enum_frminterval(v4l2,
(FAR struct v4l2_frmivalenum *)arg);
break;
case VIDIOC_ENUM_FRAMESIZES:
if (v4l2->vops->enum_frmsize == NULL)
@ -447,7 +445,51 @@ static int v4l2_ioctl(FAR struct file *filep,
return v4l2->vops->enum_frmsize(v4l2,
(FAR struct v4l2_frmsizeenum *)arg);
break;
case VIDIOC_CROPCAP:
if (v4l2->vops->cropcap == NULL)
{
break;
}
return v4l2->vops->cropcap(v4l2,
(FAR struct v4l2_cropcap *)arg);
case VIDIOC_DQEVENT:
if (v4l2->vops->dqevent == NULL)
{
break;
}
return v4l2->vops->dqevent(v4l2,
(FAR struct v4l2_event *)arg);
case VIDIOC_SUBSCRIBE_EVENT:
if (v4l2->vops->subscribe_event == NULL)
{
break;
}
return v4l2->vops->subscribe_event(v4l2,
(FAR struct v4l2_event_subscription *)arg);
case VIDIOC_DECODER_CMD:
if (v4l2->vops->decoder_cmd == NULL)
{
break;
}
return v4l2->vops->decoder_cmd(v4l2,
(FAR struct v4l2_decoder_cmd *)arg);
case VIDIOC_ENCODER_CMD:
if (v4l2->vops->encoder_cmd == NULL)
{
break;
}
return v4l2->vops->encoder_cmd(v4l2,
(FAR struct v4l2_encoder_cmd *)arg);
default:
verr("Unrecognized cmd: %d\n", cmd);

View File

@ -144,6 +144,16 @@ struct v4l2_ops_s
FAR struct v4l2_frmivalenum *f);
CODE int (*enum_frmsize)(FAR struct v4l2_s *ctx,
FAR struct v4l2_frmsizeenum *f);
CODE int (*cropcap)(FAR struct v4l2_s *ctx,
FAR struct v4l2_cropcap *cropcap);
CODE int (*dqevent)(FAR struct v4l2_s *ctx,
FAR struct v4l2_event *event);
CODE int (*subscribe_event)(FAR struct v4l2_s *ctx,
FAR struct v4l2_event_subscription *sub);
CODE int (*decoder_cmd)(FAR struct v4l2_s *ctx,
FAR struct v4l2_decoder_cmd *cmd);
CODE int (*encoder_cmd)(FAR struct v4l2_s *ctx,
FAR struct v4l2_encoder_cmd *cmd);
};
/****************************************************************************

View File

@ -518,6 +518,8 @@ enum v4l2_buf_type
|| (type) == V4L2_BUF_TYPE_SDR_OUTPUT \
|| (type) == V4L2_BUF_TYPE_META_OUTPUT)
#define V4L2_TYPE_IS_CAPTURE(type) (!V4L2_TYPE_IS_OUTPUT(type))
/* Memory I/O method. Currently, support only V4L2_MEMORY_USERPTR. */
enum v4l2_memory