[media] v4l2: add VIDIOC_(TRY_)DECODER_CMD
As discussed during the 2011 V4L-DVB workshop, the API in dvb/video.h should be replaced by a proper V4L2 API. This patch turns the VIDEO_(TRY_)DECODER_CMD ioctls into proper V4L2 ioctls. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
32d7e63c1f
commit
a45c0ad51d
|
@ -1005,6 +1005,8 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
|
|||
case VIDIOC_G_ENC_INDEX:
|
||||
case VIDIOC_ENCODER_CMD:
|
||||
case VIDIOC_TRY_ENCODER_CMD:
|
||||
case VIDIOC_DECODER_CMD:
|
||||
case VIDIOC_TRY_DECODER_CMD:
|
||||
case VIDIOC_DBG_S_REGISTER:
|
||||
case VIDIOC_DBG_G_REGISTER:
|
||||
case VIDIOC_DBG_G_CHIP_IDENT:
|
||||
|
|
|
@ -260,6 +260,8 @@ static const char *v4l2_ioctls[] = {
|
|||
[_IOC_NR(VIDIOC_ENCODER_CMD)] = "VIDIOC_ENCODER_CMD",
|
||||
[_IOC_NR(VIDIOC_TRY_ENCODER_CMD)] = "VIDIOC_TRY_ENCODER_CMD",
|
||||
|
||||
[_IOC_NR(VIDIOC_DECODER_CMD)] = "VIDIOC_DECODER_CMD",
|
||||
[_IOC_NR(VIDIOC_TRY_DECODER_CMD)] = "VIDIOC_TRY_DECODER_CMD",
|
||||
[_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER",
|
||||
[_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER",
|
||||
|
||||
|
@ -1764,6 +1766,32 @@ static long __video_do_ioctl(struct file *file,
|
|||
dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
|
||||
break;
|
||||
}
|
||||
case VIDIOC_DECODER_CMD:
|
||||
{
|
||||
struct v4l2_decoder_cmd *p = arg;
|
||||
|
||||
if (!ops->vidioc_decoder_cmd)
|
||||
break;
|
||||
if (ret_prio) {
|
||||
ret = ret_prio;
|
||||
break;
|
||||
}
|
||||
ret = ops->vidioc_decoder_cmd(file, fh, p);
|
||||
if (!ret)
|
||||
dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
|
||||
break;
|
||||
}
|
||||
case VIDIOC_TRY_DECODER_CMD:
|
||||
{
|
||||
struct v4l2_decoder_cmd *p = arg;
|
||||
|
||||
if (!ops->vidioc_try_decoder_cmd)
|
||||
break;
|
||||
ret = ops->vidioc_try_decoder_cmd(file, fh, p);
|
||||
if (!ret)
|
||||
dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
|
||||
break;
|
||||
}
|
||||
case VIDIOC_G_PARM:
|
||||
{
|
||||
struct v4l2_streamparm *p = arg;
|
||||
|
|
|
@ -1908,6 +1908,54 @@ struct v4l2_encoder_cmd {
|
|||
};
|
||||
};
|
||||
|
||||
/* Decoder commands */
|
||||
#define V4L2_DEC_CMD_START (0)
|
||||
#define V4L2_DEC_CMD_STOP (1)
|
||||
#define V4L2_DEC_CMD_PAUSE (2)
|
||||
#define V4L2_DEC_CMD_RESUME (3)
|
||||
|
||||
/* Flags for V4L2_DEC_CMD_START */
|
||||
#define V4L2_DEC_CMD_START_MUTE_AUDIO (1 << 0)
|
||||
|
||||
/* Flags for V4L2_DEC_CMD_PAUSE */
|
||||
#define V4L2_DEC_CMD_PAUSE_TO_BLACK (1 << 0)
|
||||
|
||||
/* Flags for V4L2_DEC_CMD_STOP */
|
||||
#define V4L2_DEC_CMD_STOP_TO_BLACK (1 << 0)
|
||||
#define V4L2_DEC_CMD_STOP_IMMEDIATELY (1 << 1)
|
||||
|
||||
/* Play format requirements (returned by the driver): */
|
||||
|
||||
/* The decoder has no special format requirements */
|
||||
#define V4L2_DEC_START_FMT_NONE (0)
|
||||
/* The decoder requires full GOPs */
|
||||
#define V4L2_DEC_START_FMT_GOP (1)
|
||||
|
||||
/* The structure must be zeroed before use by the application
|
||||
This ensures it can be extended safely in the future. */
|
||||
struct v4l2_decoder_cmd {
|
||||
__u32 cmd;
|
||||
__u32 flags;
|
||||
union {
|
||||
struct {
|
||||
__u64 pts;
|
||||
} stop;
|
||||
|
||||
struct {
|
||||
/* 0 or 1000 specifies normal speed,
|
||||
1 specifies forward single stepping,
|
||||
-1 specifies backward single stepping,
|
||||
>1: playback at speed/1000 of the normal speed,
|
||||
<-1: reverse playback at (-speed/1000) of the normal speed. */
|
||||
__s32 speed;
|
||||
__u32 format;
|
||||
} start;
|
||||
|
||||
struct {
|
||||
__u32 data[16];
|
||||
} raw;
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -2318,6 +2366,11 @@ struct v4l2_create_buffers {
|
|||
#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
|
||||
#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection)
|
||||
|
||||
/* Experimental, these two ioctls may change over the next couple of kernel
|
||||
versions. */
|
||||
#define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd)
|
||||
#define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd)
|
||||
|
||||
/* Reminder: when adding new ioctls please add support for them to
|
||||
drivers/media/video/v4l2-compat-ioctl32.c as well! */
|
||||
|
||||
|
|
|
@ -211,6 +211,10 @@ struct v4l2_ioctl_ops {
|
|||
struct v4l2_encoder_cmd *a);
|
||||
int (*vidioc_try_encoder_cmd) (struct file *file, void *fh,
|
||||
struct v4l2_encoder_cmd *a);
|
||||
int (*vidioc_decoder_cmd) (struct file *file, void *fh,
|
||||
struct v4l2_decoder_cmd *a);
|
||||
int (*vidioc_try_decoder_cmd) (struct file *file, void *fh,
|
||||
struct v4l2_decoder_cmd *a);
|
||||
|
||||
/* Stream type-dependent parameter ioctls */
|
||||
int (*vidioc_g_parm) (struct file *file, void *fh,
|
||||
|
|
Loading…
Reference in New Issue