aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-02-18 12:05:02 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-03-01 10:09:46 -0500
commitdb6eb5b334a0f095290b99096f68ff24ab6df1aa (patch)
tree234de6644e71d70f3544d32532d6aa026eb8ad75
parent1d1370a48ca285ebe197ecd3197a8d5f161bc291 (diff)
V4L/DVB (5270): Add VIDIOC_G_ENC_INDEX ioctl
The VIDIOC_G_ENC_INDEX ioctl can obtain the MPEG index from an MPEG 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.c9
-rw-r--r--drivers/media/video/videodev.c12
-rw-r--r--include/linux/videodev2.h30
-rw-r--r--include/media/v4l2-dev.h2
4 files changed, 50 insertions, 3 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 3506cb667111..2fe97c4cb35c 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -366,13 +366,16 @@ static const char *v4l2_ioctls[] = {
366 [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT", 366 [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT",
367 [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY", 367 [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY",
368 [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY", 368 [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY",
369#if 1
370 [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP", 369 [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP",
371#endif
372 [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS", 370 [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS",
373 [_IOC_NR(VIDIOC_G_EXT_CTRLS)] = "VIDIOC_G_EXT_CTRLS", 371 [_IOC_NR(VIDIOC_G_EXT_CTRLS)] = "VIDIOC_G_EXT_CTRLS",
374 [_IOC_NR(VIDIOC_S_EXT_CTRLS)] = "VIDIOC_S_EXT_CTRLS", 372 [_IOC_NR(VIDIOC_S_EXT_CTRLS)] = "VIDIOC_S_EXT_CTRLS",
375 [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)] = "VIDIOC_TRY_EXT_CTRLS" 373 [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)] = "VIDIOC_TRY_EXT_CTRLS",
374#if 1
375 [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)] = "VIDIOC_ENUM_FRAMESIZES",
376 [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS",
377 [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX"
378#endif
376}; 379};
377#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) 380#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
378 381
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index dc9b1ef678aa..cd13e6108e5e 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -1342,6 +1342,18 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1342 ret=vfd->vidioc_s_jpegcomp(file, fh, p); 1342 ret=vfd->vidioc_s_jpegcomp(file, fh, p);
1343 break; 1343 break;
1344 } 1344 }
1345 case VIDIOC_G_ENC_INDEX:
1346 {
1347 struct v4l2_enc_idx *p=arg;
1348
1349 if (!vfd->vidioc_g_enc_index)
1350 break;
1351 ret=vfd->vidioc_g_enc_index(file, fh, p);
1352 if (!ret)
1353 dbgarg (cmd, "entries=%d, entries_cap=%d\n",
1354 p->entries,p->entries_cap);
1355 break;
1356 }
1345 case VIDIOC_G_PARM: 1357 case VIDIOC_G_PARM:
1346 { 1358 {
1347 struct v4l2_streamparm *p=arg; 1359 struct v4l2_streamparm *p=arg;
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index e3ab047f90ef..42cfdd2d50db 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1193,6 +1193,35 @@ struct v4l2_audioout
1193}; 1193};
1194 1194
1195/* 1195/*
1196 * M P E G I N D E X
1197 *
1198 * NOTE: EXPERIMENTAL API
1199 */
1200#if 1
1201#define V4L2_ENC_IDX_FRAME_I (0)
1202#define V4L2_ENC_IDX_FRAME_P (1)
1203#define V4L2_ENC_IDX_FRAME_B (2)
1204#define V4L2_ENC_IDX_FRAME_MASK (0xf)
1205
1206struct v4l2_enc_idx_entry {
1207 __u64 offset;
1208 __u64 pts;
1209 __u32 length;
1210 __u32 flags;
1211 __u32 reserved[2];
1212};
1213
1214#define V4L2_ENC_IDX_ENTRIES (64)
1215struct v4l2_enc_idx {
1216 __u32 entries;
1217 __u32 entries_cap;
1218 __u32 reserved[4];
1219 struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES];
1220};
1221#endif
1222
1223
1224/*
1196 * D A T A S E R V I C E S ( V B I ) 1225 * D A T A S E R V I C E S ( V B I )
1197 * 1226 *
1198 * Data services API by Michael Schimek 1227 * Data services API by Michael Schimek
@@ -1385,6 +1414,7 @@ struct v4l2_register {
1385#if 1 1414#if 1
1386#define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum) 1415#define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum)
1387#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum) 1416#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum)
1417#define VIDIOC_G_ENC_INDEX _IOR ('V', 76, struct v4l2_enc_idx)
1388#endif 1418#endif
1389/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ 1419/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
1390#define VIDIOC_DBG_S_REGISTER _IOW ('d', 100, struct v4l2_register) 1420#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 aeec56992ef5..e5e87e44c585 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -271,6 +271,8 @@ struct video_device
271 struct v4l2_jpegcompression *a); 271 struct v4l2_jpegcompression *a);
272 int (*vidioc_s_jpegcomp) (struct file *file, void *fh, 272 int (*vidioc_s_jpegcomp) (struct file *file, void *fh,
273 struct v4l2_jpegcompression *a); 273 struct v4l2_jpegcompression *a);
274 int (*vidioc_g_enc_index) (struct file *file, void *fh,
275 struct v4l2_enc_idx *a);
274 276
275 /* Stream type-dependent parameter ioctls */ 277 /* Stream type-dependent parameter ioctls */
276 int (*vidioc_g_parm) (struct file *file, void *fh, 278 int (*vidioc_g_parm) (struct file *file, void *fh,