summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-02-18 18:56:22 +0100
committerHans Verkuil <hverkuil@xs4all.nl>2007-02-18 18:56:22 +0100
commitd4626bcafa116dabbff5b8aef4a4043f4e25b2d2 (patch)
treecab86d321b1bad292069f7e13f15dab55bf8a93b
parenta01a4f3aa02b20388725dc2e7abd1365295672f0 (diff)
downloadmediapointer-dvb-s2-d4626bcafa116dabbff5b8aef4a4043f4e25b2d2.tar.gz
mediapointer-dvb-s2-d4626bcafa116dabbff5b8aef4a4043f4e25b2d2.tar.bz2
Add VIDIOC_TRY_ENCODER_CMD and VIDIOC_ENCODER_CMD ioctls.
From: Hans Verkuil <hverkuil@xs4all.nl> Add support for starting, stopping, pausing and resuming an MPEG (or similar compressed stream) encoder. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
-rw-r--r--linux/drivers/media/video/v4l2-common.c4
-rw-r--r--linux/drivers/media/video/videodev.c24
-rw-r--r--linux/include/linux/videodev2.h24
-rw-r--r--linux/include/media/v4l2-dev.h4
4 files changed, 54 insertions, 2 deletions
diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c
index 758ab7ad0..ff555d4ea 100644
--- a/linux/drivers/media/video/v4l2-common.c
+++ b/linux/drivers/media/video/v4l2-common.c
@@ -401,7 +401,9 @@ static const char *v4l2_ioctls[] = {
#if 1 /*KEEP*/
[_IOC_NR(VIDIOC_ENUM_FRAMESIZES)] = "VIDIOC_ENUM_FRAMESIZES",
[_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS",
- [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX"
+ [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX",
+ [_IOC_NR(VIDIOC_ENCODER_CMD)] = "VIDIOC_ENCODER_CMD",
+ [_IOC_NR(VIDIOC_TRY_ENCODER_CMD)] = "VIDIOC_TRY_ENCODER_CMD"
#endif
};
#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
diff --git a/linux/drivers/media/video/videodev.c b/linux/drivers/media/video/videodev.c
index 5ce381c9c..3a09a0808 100644
--- a/linux/drivers/media/video/videodev.c
+++ b/linux/drivers/media/video/videodev.c
@@ -1378,6 +1378,30 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
p->entries,p->entries_cap);
break;
}
+ case VIDIOC_ENCODER_CMD:
+ {
+ struct v4l2_encoder_cmd *p=arg;
+
+ if (!vfd->vidioc_encoder_cmd)
+ break;
+ ret=vfd->vidioc_encoder_cmd(file, fh, p);
+ if (!ret)
+ dbgarg (cmd, "cmd=%d, flags=%d\n",
+ p->cmd,p->flags);
+ break;
+ }
+ case VIDIOC_TRY_ENCODER_CMD:
+ {
+ struct v4l2_encoder_cmd *p=arg;
+
+ if (!vfd->vidioc_try_encoder_cmd)
+ break;
+ ret=vfd->vidioc_try_encoder_cmd(file, fh, p);
+ if (!ret)
+ dbgarg (cmd, "cmd=%d, flags=%d\n",
+ p->cmd,p->flags);
+ break;
+ }
case VIDIOC_G_PARM:
{
struct v4l2_streamparm *p=arg;
diff --git a/linux/include/linux/videodev2.h b/linux/include/linux/videodev2.h
index 876f575a1..51b1967e4 100644
--- a/linux/include/linux/videodev2.h
+++ b/linux/include/linux/videodev2.h
@@ -1196,7 +1196,7 @@ struct v4l2_audioout
};
/*
- * M P E G I N D E X
+ * M P E G S E R V I C E S
*
* NOTE: EXPERIMENTAL API
*/
@@ -1221,6 +1221,26 @@ struct v4l2_enc_idx {
u32 reserved[4];
struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES];
};
+
+
+#define V4L2_ENC_CMD_START (0)
+#define V4L2_ENC_CMD_STOP (1)
+#define V4L2_ENC_CMD_PAUSE (2)
+#define V4L2_ENC_CMD_RESUME (3)
+
+/* Flags for V4L2_ENC_CMD_STOP */
+#define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0)
+
+struct v4l2_encoder_cmd {
+ __u32 cmd;
+ __u32 flags;
+ union {
+ struct {
+ __u32 data[8];
+ } raw;
+ };
+};
+
#endif
@@ -1411,6 +1431,8 @@ struct v4l2_register {
#define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum)
#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum)
#define VIDIOC_G_ENC_INDEX _IOR ('V', 76, struct v4l2_enc_idx)
+#define VIDIOC_ENCODER_CMD _IOWR ('V', 77, struct v4l2_encoder_cmd)
+#define VIDIOC_TRY_ENCODER_CMD _IOWR ('V', 78, struct v4l2_encoder_cmd)
#endif
/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
#define VIDIOC_DBG_S_REGISTER _IOW ('d', 100, struct v4l2_register)
diff --git a/linux/include/media/v4l2-dev.h b/linux/include/media/v4l2-dev.h
index 68fbaffc2..0a8c42ac9 100644
--- a/linux/include/media/v4l2-dev.h
+++ b/linux/include/media/v4l2-dev.h
@@ -283,6 +283,10 @@ struct video_device
struct v4l2_jpegcompression *a);
int (*vidioc_g_enc_index) (struct file *file, void *fh,
struct v4l2_enc_idx *a);
+ int (*vidioc_encoder_cmd) (struct file *file, void *fh,
+ struct v4l2_encoder_cmd *a);
+ int (*vidioc_try_encoder_cmd) (struct file *file, void *fh,
+ struct v4l2_encoder_cmd *a);
/* Stream type-dependent parameter ioctls */
int (*vidioc_g_parm) (struct file *file, void *fh,