diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-02-18 12:56:22 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-03-01 10:09:46 -0500 |
commit | ada6ecd2bf1d97e1f3bac6d5af4c7c4390a0a5af (patch) | |
tree | dcc213321ea37b25abc4d1f835ed3898655aed69 | |
parent | db6eb5b334a0f095290b99096f68ff24ab6df1aa (diff) |
V4L/DVB (5271): Add VIDIOC_TRY_ENCODER_CMD and VIDIOC_ENCODER_CMD ioctls.
Add support for starting, stopping, pausing and resuming an MPEG (or similar
compressed stream) encoder.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/video/v4l2-common.c | 4 | ||||
-rw-r--r-- | drivers/media/video/videodev.c | 24 | ||||
-rw-r--r-- | include/linux/videodev2.h | 24 | ||||
-rw-r--r-- | include/media/v4l2-dev.h | 4 |
4 files changed, 54 insertions, 2 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 2fe97c4cb35c..57aaed3239d6 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -374,7 +374,9 @@ static const char *v4l2_ioctls[] = { | |||
374 | #if 1 | 374 | #if 1 |
375 | [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)] = "VIDIOC_ENUM_FRAMESIZES", | 375 | [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)] = "VIDIOC_ENUM_FRAMESIZES", |
376 | [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS", | 376 | [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS", |
377 | [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX" | 377 | [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX", |
378 | [_IOC_NR(VIDIOC_ENCODER_CMD)] = "VIDIOC_ENCODER_CMD", | ||
379 | [_IOC_NR(VIDIOC_TRY_ENCODER_CMD)] = "VIDIOC_TRY_ENCODER_CMD" | ||
378 | #endif | 380 | #endif |
379 | }; | 381 | }; |
380 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) | 382 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) |
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index cd13e6108e5e..011938fb7e0e 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c | |||
@@ -1354,6 +1354,30 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
1354 | p->entries,p->entries_cap); | 1354 | p->entries,p->entries_cap); |
1355 | break; | 1355 | break; |
1356 | } | 1356 | } |
1357 | case VIDIOC_ENCODER_CMD: | ||
1358 | { | ||
1359 | struct v4l2_encoder_cmd *p=arg; | ||
1360 | |||
1361 | if (!vfd->vidioc_encoder_cmd) | ||
1362 | break; | ||
1363 | ret=vfd->vidioc_encoder_cmd(file, fh, p); | ||
1364 | if (!ret) | ||
1365 | dbgarg (cmd, "cmd=%d, flags=%d\n", | ||
1366 | p->cmd,p->flags); | ||
1367 | break; | ||
1368 | } | ||
1369 | case VIDIOC_TRY_ENCODER_CMD: | ||
1370 | { | ||
1371 | struct v4l2_encoder_cmd *p=arg; | ||
1372 | |||
1373 | if (!vfd->vidioc_try_encoder_cmd) | ||
1374 | break; | ||
1375 | ret=vfd->vidioc_try_encoder_cmd(file, fh, p); | ||
1376 | if (!ret) | ||
1377 | dbgarg (cmd, "cmd=%d, flags=%d\n", | ||
1378 | p->cmd,p->flags); | ||
1379 | break; | ||
1380 | } | ||
1357 | case VIDIOC_G_PARM: | 1381 | case VIDIOC_G_PARM: |
1358 | { | 1382 | { |
1359 | struct v4l2_streamparm *p=arg; | 1383 | struct v4l2_streamparm *p=arg; |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 42cfdd2d50db..854875869dbd 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -1193,7 +1193,7 @@ struct v4l2_audioout | |||
1193 | }; | 1193 | }; |
1194 | 1194 | ||
1195 | /* | 1195 | /* |
1196 | * M P E G I N D E X | 1196 | * M P E G S E R V I C E S |
1197 | * | 1197 | * |
1198 | * NOTE: EXPERIMENTAL API | 1198 | * NOTE: EXPERIMENTAL API |
1199 | */ | 1199 | */ |
@@ -1218,6 +1218,26 @@ struct v4l2_enc_idx { | |||
1218 | __u32 reserved[4]; | 1218 | __u32 reserved[4]; |
1219 | struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES]; | 1219 | struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES]; |
1220 | }; | 1220 | }; |
1221 | |||
1222 | |||
1223 | #define V4L2_ENC_CMD_START (0) | ||
1224 | #define V4L2_ENC_CMD_STOP (1) | ||
1225 | #define V4L2_ENC_CMD_PAUSE (2) | ||
1226 | #define V4L2_ENC_CMD_RESUME (3) | ||
1227 | |||
1228 | /* Flags for V4L2_ENC_CMD_STOP */ | ||
1229 | #define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0) | ||
1230 | |||
1231 | struct v4l2_encoder_cmd { | ||
1232 | __u32 cmd; | ||
1233 | __u32 flags; | ||
1234 | union { | ||
1235 | struct { | ||
1236 | __u32 data[8]; | ||
1237 | } raw; | ||
1238 | }; | ||
1239 | }; | ||
1240 | |||
1221 | #endif | 1241 | #endif |
1222 | 1242 | ||
1223 | 1243 | ||
@@ -1415,6 +1435,8 @@ struct v4l2_register { | |||
1415 | #define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum) | 1435 | #define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum) |
1416 | #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum) | 1436 | #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum) |
1417 | #define VIDIOC_G_ENC_INDEX _IOR ('V', 76, struct v4l2_enc_idx) | 1437 | #define VIDIOC_G_ENC_INDEX _IOR ('V', 76, struct v4l2_enc_idx) |
1438 | #define VIDIOC_ENCODER_CMD _IOWR ('V', 77, struct v4l2_encoder_cmd) | ||
1439 | #define VIDIOC_TRY_ENCODER_CMD _IOWR ('V', 78, struct v4l2_encoder_cmd) | ||
1418 | #endif | 1440 | #endif |
1419 | /* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ | 1441 | /* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ |
1420 | #define VIDIOC_DBG_S_REGISTER _IOW ('d', 100, struct v4l2_register) | 1442 | #define VIDIOC_DBG_S_REGISTER _IOW ('d', 100, struct v4l2_register) |
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index e5e87e44c585..1dd3d3239ecf 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -273,6 +273,10 @@ struct video_device | |||
273 | struct v4l2_jpegcompression *a); | 273 | struct v4l2_jpegcompression *a); |
274 | int (*vidioc_g_enc_index) (struct file *file, void *fh, | 274 | int (*vidioc_g_enc_index) (struct file *file, void *fh, |
275 | struct v4l2_enc_idx *a); | 275 | struct v4l2_enc_idx *a); |
276 | int (*vidioc_encoder_cmd) (struct file *file, void *fh, | ||
277 | struct v4l2_encoder_cmd *a); | ||
278 | int (*vidioc_try_encoder_cmd) (struct file *file, void *fh, | ||
279 | struct v4l2_encoder_cmd *a); | ||
276 | 280 | ||
277 | /* Stream type-dependent parameter ioctls */ | 281 | /* Stream type-dependent parameter ioctls */ |
278 | int (*vidioc_g_parm) (struct file *file, void *fh, | 282 | int (*vidioc_g_parm) (struct file *file, void *fh, |