aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-04-27 11:31:02 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-04-27 14:43:21 -0400
commitb2787845fb91da18ebb079dc9297f92d990e9fe1 (patch)
treec6e9ad31158f2679c8ea384dd068ff4051db1358
parent3bfb7398e2554fb54acb2900b81de144eb41c3ac (diff)
V4L/DVB (5289): Add support for video output overlays.
Add V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY support. Also add support for local and global alpha overlays. Add new field enums V4L2_FIELD_INTERLACED_TB and V4L2_FIELD_INTERLACED_BT. These changes are needed to support the ivtv On Screen Display features. 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.c5
-rw-r--r--drivers/media/video/videodev.c23
-rw-r--r--include/linux/videodev2.h66
-rw-r--r--include/media/v4l2-dev.h8
4 files changed, 79 insertions, 23 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 43a8467f0209..740ea5a9202f 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -260,6 +260,8 @@ char *v4l2_field_names[] = {
260 [V4L2_FIELD_SEQ_TB] = "seq-tb", 260 [V4L2_FIELD_SEQ_TB] = "seq-tb",
261 [V4L2_FIELD_SEQ_BT] = "seq-bt", 261 [V4L2_FIELD_SEQ_BT] = "seq-bt",
262 [V4L2_FIELD_ALTERNATE] = "alternate", 262 [V4L2_FIELD_ALTERNATE] = "alternate",
263 [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb",
264 [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt",
263}; 265};
264 266
265char *v4l2_type_names[] = { 267char *v4l2_type_names[] = {
@@ -269,7 +271,8 @@ char *v4l2_type_names[] = {
269 [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap", 271 [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap",
270 [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", 272 [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out",
271 [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap", 273 [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap",
272 [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "slicec-vbi-out", 274 [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out",
275 [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over",
273}; 276};
274 277
275 278
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index 011938fb7e0e..5c9f2116d7bf 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -318,6 +318,7 @@ static char *v4l2_type_names_FIXME[] = {
318 [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", 318 [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out",
319 [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out", 319 [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out",
320 [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-capture", 320 [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-capture",
321 [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over",
321 [V4L2_BUF_TYPE_PRIVATE] = "private", 322 [V4L2_BUF_TYPE_PRIVATE] = "private",
322}; 323};
323 324
@@ -330,6 +331,8 @@ static char *v4l2_field_names_FIXME[] = {
330 [V4L2_FIELD_SEQ_TB] = "seq-tb", 331 [V4L2_FIELD_SEQ_TB] = "seq-tb",
331 [V4L2_FIELD_SEQ_BT] = "seq-bt", 332 [V4L2_FIELD_SEQ_BT] = "seq-bt",
332 [V4L2_FIELD_ALTERNATE] = "alternate", 333 [V4L2_FIELD_ALTERNATE] = "alternate",
334 [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb",
335 [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt",
333}; 336};
334 337
335#define prt_names(a,arr) (((a)>=0)&&((a)<ARRAY_SIZE(arr)))?arr[a]:"unknown" 338#define prt_names(a,arr) (((a)>=0)&&((a)<ARRAY_SIZE(arr)))?arr[a]:"unknown"
@@ -411,6 +414,10 @@ static int check_fmt (struct video_device *vfd, enum v4l2_buf_type type)
411 if (vfd->vidioc_try_fmt_vbi_output) 414 if (vfd->vidioc_try_fmt_vbi_output)
412 return (0); 415 return (0);
413 break; 416 break;
417 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
418 if (vfd->vidioc_try_fmt_output_overlay)
419 return (0);
420 break;
414 case V4L2_BUF_TYPE_PRIVATE: 421 case V4L2_BUF_TYPE_PRIVATE:
415 if (vfd->vidioc_try_fmt_type_private) 422 if (vfd->vidioc_try_fmt_type_private)
416 return (0); 423 return (0);
@@ -525,6 +532,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
525 ret=vfd->vidioc_enum_fmt_vbi_output(file, 532 ret=vfd->vidioc_enum_fmt_vbi_output(file,
526 fh, f); 533 fh, f);
527 break; 534 break;
535 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
536 if (vfd->vidioc_enum_fmt_output_overlay)
537 ret=vfd->vidioc_enum_fmt_output_overlay(file, fh, f);
538 break;
528 case V4L2_BUF_TYPE_PRIVATE: 539 case V4L2_BUF_TYPE_PRIVATE:
529 if (vfd->vidioc_enum_fmt_type_private) 540 if (vfd->vidioc_enum_fmt_type_private)
530 ret=vfd->vidioc_enum_fmt_type_private(file, 541 ret=vfd->vidioc_enum_fmt_type_private(file,
@@ -582,6 +593,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
582 ret=vfd->vidioc_g_fmt_video_output(file, 593 ret=vfd->vidioc_g_fmt_video_output(file,
583 fh, f); 594 fh, f);
584 break; 595 break;
596 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
597 if (vfd->vidioc_g_fmt_output_overlay)
598 ret=vfd->vidioc_g_fmt_output_overlay(file, fh, f);
599 break;
585 case V4L2_BUF_TYPE_VBI_OUTPUT: 600 case V4L2_BUF_TYPE_VBI_OUTPUT:
586 if (vfd->vidioc_g_fmt_vbi_output) 601 if (vfd->vidioc_g_fmt_vbi_output)
587 ret=vfd->vidioc_g_fmt_vbi_output(file, fh, f); 602 ret=vfd->vidioc_g_fmt_vbi_output(file, fh, f);
@@ -630,6 +645,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
630 ret=vfd->vidioc_s_fmt_video_output(file, 645 ret=vfd->vidioc_s_fmt_video_output(file,
631 fh, f); 646 fh, f);
632 break; 647 break;
648 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
649 if (vfd->vidioc_s_fmt_output_overlay)
650 ret=vfd->vidioc_s_fmt_output_overlay(file, fh, f);
651 break;
633 case V4L2_BUF_TYPE_VBI_OUTPUT: 652 case V4L2_BUF_TYPE_VBI_OUTPUT:
634 if (vfd->vidioc_s_fmt_vbi_output) 653 if (vfd->vidioc_s_fmt_vbi_output)
635 ret=vfd->vidioc_s_fmt_vbi_output(file, 654 ret=vfd->vidioc_s_fmt_vbi_output(file,
@@ -680,6 +699,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
680 ret=vfd->vidioc_try_fmt_video_output(file, 699 ret=vfd->vidioc_try_fmt_video_output(file,
681 fh, f); 700 fh, f);
682 break; 701 break;
702 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
703 if (vfd->vidioc_try_fmt_output_overlay)
704 ret=vfd->vidioc_try_fmt_output_overlay(file, fh, f);
705 break;
683 case V4L2_BUF_TYPE_VBI_OUTPUT: 706 case V4L2_BUF_TYPE_VBI_OUTPUT:
684 if (vfd->vidioc_try_fmt_vbi_output) 707 if (vfd->vidioc_try_fmt_vbi_output)
685 ret=vfd->vidioc_try_fmt_vbi_output(file, 708 ret=vfd->vidioc_try_fmt_vbi_output(file,
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index e4ed5667a55d..a08ef2c16300 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -96,44 +96,60 @@
96 * E N U M S 96 * E N U M S
97 */ 97 */
98enum v4l2_field { 98enum v4l2_field {
99 V4L2_FIELD_ANY = 0, /* driver can choose from none, 99 V4L2_FIELD_ANY = 0, /* driver can choose from none,
100 top, bottom, interlaced 100 top, bottom, interlaced
101 depending on whatever it thinks 101 depending on whatever it thinks
102 is approximate ... */ 102 is approximate ... */
103 V4L2_FIELD_NONE = 1, /* this device has no fields ... */ 103 V4L2_FIELD_NONE = 1, /* this device has no fields ... */
104 V4L2_FIELD_TOP = 2, /* top field only */ 104 V4L2_FIELD_TOP = 2, /* top field only */
105 V4L2_FIELD_BOTTOM = 3, /* bottom field only */ 105 V4L2_FIELD_BOTTOM = 3, /* bottom field only */
106 V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ 106 V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */
107 V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one 107 V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one
108 buffer, top-bottom order */ 108 buffer, top-bottom order */
109 V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ 109 V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */
110 V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into 110 V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into
111 separate buffers */ 111 separate buffers */
112 V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field
113 first and the top field is
114 transmitted first */
115 V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field
116 first and the bottom field is
117 transmitted first */
112}; 118};
113#define V4L2_FIELD_HAS_TOP(field) \ 119#define V4L2_FIELD_HAS_TOP(field) \
114 ((field) == V4L2_FIELD_TOP ||\ 120 ((field) == V4L2_FIELD_TOP ||\
115 (field) == V4L2_FIELD_INTERLACED ||\ 121 (field) == V4L2_FIELD_INTERLACED ||\
122 (field) == V4L2_FIELD_INTERLACED_TB ||\
123 (field) == V4L2_FIELD_INTERLACED_BT ||\
116 (field) == V4L2_FIELD_SEQ_TB ||\ 124 (field) == V4L2_FIELD_SEQ_TB ||\
117 (field) == V4L2_FIELD_SEQ_BT) 125 (field) == V4L2_FIELD_SEQ_BT)
118#define V4L2_FIELD_HAS_BOTTOM(field) \ 126#define V4L2_FIELD_HAS_BOTTOM(field) \
119 ((field) == V4L2_FIELD_BOTTOM ||\ 127 ((field) == V4L2_FIELD_BOTTOM ||\
120 (field) == V4L2_FIELD_INTERLACED ||\ 128 (field) == V4L2_FIELD_INTERLACED ||\
129 (field) == V4L2_FIELD_INTERLACED_TB ||\
130 (field) == V4L2_FIELD_INTERLACED_BT ||\
121 (field) == V4L2_FIELD_SEQ_TB ||\ 131 (field) == V4L2_FIELD_SEQ_TB ||\
122 (field) == V4L2_FIELD_SEQ_BT) 132 (field) == V4L2_FIELD_SEQ_BT)
123#define V4L2_FIELD_HAS_BOTH(field) \ 133#define V4L2_FIELD_HAS_BOTH(field) \
124 ((field) == V4L2_FIELD_INTERLACED ||\ 134 ((field) == V4L2_FIELD_INTERLACED ||\
125 (field) == V4L2_FIELD_SEQ_TB ||\ 135 (field) == V4L2_FIELD_INTERLACED_TB ||\
136 (field) == V4L2_FIELD_INTERLACED_BT ||\
137 (field) == V4L2_FIELD_SEQ_TB ||\
126 (field) == V4L2_FIELD_SEQ_BT) 138 (field) == V4L2_FIELD_SEQ_BT)
127 139
128enum v4l2_buf_type { 140enum v4l2_buf_type {
129 V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, 141 V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
130 V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, 142 V4L2_BUF_TYPE_VIDEO_OUTPUT = 2,
131 V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, 143 V4L2_BUF_TYPE_VIDEO_OVERLAY = 3,
132 V4L2_BUF_TYPE_VBI_CAPTURE = 4, 144 V4L2_BUF_TYPE_VBI_CAPTURE = 4,
133 V4L2_BUF_TYPE_VBI_OUTPUT = 5, 145 V4L2_BUF_TYPE_VBI_OUTPUT = 5,
134 V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, 146 V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
135 V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, 147 V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7,
136 V4L2_BUF_TYPE_PRIVATE = 0x80, 148#if 1
149 /* Experimental */
150 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
151#endif
152 V4L2_BUF_TYPE_PRIVATE = 0x80,
137}; 153};
138 154
139enum v4l2_ctrl_type { 155enum v4l2_ctrl_type {
@@ -228,6 +244,7 @@ struct v4l2_capability
228#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ 244#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */
229#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ 245#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */
230#define V4L2_CAP_VIDEO_OUTPUT_POS 0x00000200 /* Video output can have x,y coords */ 246#define V4L2_CAP_VIDEO_OUTPUT_POS 0x00000200 /* Video output can have x,y coords */
247#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000400 /* Can do video output overlay */
231 248
232#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ 249#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
233#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ 250#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
@@ -599,10 +616,14 @@ struct v4l2_framebuffer
599#define V4L2_FBUF_CAP_CHROMAKEY 0x0002 616#define V4L2_FBUF_CAP_CHROMAKEY 0x0002
600#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 617#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004
601#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 618#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008
619#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010
620#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020
602/* Flags for the 'flags' field. */ 621/* Flags for the 'flags' field. */
603#define V4L2_FBUF_FLAG_PRIMARY 0x0001 622#define V4L2_FBUF_FLAG_PRIMARY 0x0001
604#define V4L2_FBUF_FLAG_OVERLAY 0x0002 623#define V4L2_FBUF_FLAG_OVERLAY 0x0002
605#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 624#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004
625#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008
626#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
606 627
607struct v4l2_clip 628struct v4l2_clip
608{ 629{
@@ -618,6 +639,7 @@ struct v4l2_window
618 struct v4l2_clip __user *clips; 639 struct v4l2_clip __user *clips;
619 __u32 clipcount; 640 __u32 clipcount;
620 void __user *bitmap; 641 void __user *bitmap;
642 __u8 global_alpha;
621}; 643};
622 644
623/* 645/*
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 1dd3d3239ecf..2693f3ae6ffb 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -127,6 +127,8 @@ struct video_device
127 struct v4l2_fmtdesc *f); 127 struct v4l2_fmtdesc *f);
128 int (*vidioc_enum_fmt_video_output)(struct file *file, void *fh, 128 int (*vidioc_enum_fmt_video_output)(struct file *file, void *fh,
129 struct v4l2_fmtdesc *f); 129 struct v4l2_fmtdesc *f);
130 int (*vidioc_enum_fmt_output_overlay) (struct file *file, void *fh,
131 struct v4l2_fmtdesc *f);
130 int (*vidioc_enum_fmt_vbi_output) (struct file *file, void *fh, 132 int (*vidioc_enum_fmt_vbi_output) (struct file *file, void *fh,
131 struct v4l2_fmtdesc *f); 133 struct v4l2_fmtdesc *f);
132 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh, 134 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
@@ -145,6 +147,8 @@ struct video_device
145 struct v4l2_format *f); 147 struct v4l2_format *f);
146 int (*vidioc_g_fmt_video_output)(struct file *file, void *fh, 148 int (*vidioc_g_fmt_video_output)(struct file *file, void *fh,
147 struct v4l2_format *f); 149 struct v4l2_format *f);
150 int (*vidioc_g_fmt_output_overlay) (struct file *file, void *fh,
151 struct v4l2_format *f);
148 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh, 152 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
149 struct v4l2_format *f); 153 struct v4l2_format *f);
150 154
@@ -162,6 +166,8 @@ struct video_device
162 struct v4l2_format *f); 166 struct v4l2_format *f);
163 int (*vidioc_s_fmt_video_output)(struct file *file, void *fh, 167 int (*vidioc_s_fmt_video_output)(struct file *file, void *fh,
164 struct v4l2_format *f); 168 struct v4l2_format *f);
169 int (*vidioc_s_fmt_output_overlay) (struct file *file, void *fh,
170 struct v4l2_format *f);
165 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh, 171 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
166 struct v4l2_format *f); 172 struct v4l2_format *f);
167 173
@@ -178,6 +184,8 @@ struct video_device
178 struct v4l2_format *f); 184 struct v4l2_format *f);
179 int (*vidioc_try_fmt_video_output)(struct file *file, void *fh, 185 int (*vidioc_try_fmt_video_output)(struct file *file, void *fh,
180 struct v4l2_format *f); 186 struct v4l2_format *f);
187 int (*vidioc_try_fmt_output_overlay)(struct file *file, void *fh,
188 struct v4l2_format *f);
181 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh, 189 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
182 struct v4l2_format *f); 190 struct v4l2_format *f);
183 191