Commit b2787845 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

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: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 3bfb7398
...@@ -260,6 +260,8 @@ char *v4l2_field_names[] = { ...@@ -260,6 +260,8 @@ char *v4l2_field_names[] = {
[V4L2_FIELD_SEQ_TB] = "seq-tb", [V4L2_FIELD_SEQ_TB] = "seq-tb",
[V4L2_FIELD_SEQ_BT] = "seq-bt", [V4L2_FIELD_SEQ_BT] = "seq-bt",
[V4L2_FIELD_ALTERNATE] = "alternate", [V4L2_FIELD_ALTERNATE] = "alternate",
[V4L2_FIELD_INTERLACED_TB] = "interlaced-tb",
[V4L2_FIELD_INTERLACED_BT] = "interlaced-bt",
}; };
char *v4l2_type_names[] = { char *v4l2_type_names[] = {
...@@ -269,7 +271,8 @@ char *v4l2_type_names[] = { ...@@ -269,7 +271,8 @@ char *v4l2_type_names[] = {
[V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap", [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap",
[V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out",
[V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap", [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap",
[V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "slicec-vbi-out", [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out",
[V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over",
}; };
......
...@@ -318,6 +318,7 @@ static char *v4l2_type_names_FIXME[] = { ...@@ -318,6 +318,7 @@ static char *v4l2_type_names_FIXME[] = {
[V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out",
[V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out", [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out",
[V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-capture", [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-capture",
[V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over",
[V4L2_BUF_TYPE_PRIVATE] = "private", [V4L2_BUF_TYPE_PRIVATE] = "private",
}; };
...@@ -330,6 +331,8 @@ static char *v4l2_field_names_FIXME[] = { ...@@ -330,6 +331,8 @@ static char *v4l2_field_names_FIXME[] = {
[V4L2_FIELD_SEQ_TB] = "seq-tb", [V4L2_FIELD_SEQ_TB] = "seq-tb",
[V4L2_FIELD_SEQ_BT] = "seq-bt", [V4L2_FIELD_SEQ_BT] = "seq-bt",
[V4L2_FIELD_ALTERNATE] = "alternate", [V4L2_FIELD_ALTERNATE] = "alternate",
[V4L2_FIELD_INTERLACED_TB] = "interlaced-tb",
[V4L2_FIELD_INTERLACED_BT] = "interlaced-bt",
}; };
#define prt_names(a,arr) (((a)>=0)&&((a)<ARRAY_SIZE(arr)))?arr[a]:"unknown" #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,6 +414,10 @@ static int check_fmt (struct video_device *vfd, enum v4l2_buf_type type)
if (vfd->vidioc_try_fmt_vbi_output) if (vfd->vidioc_try_fmt_vbi_output)
return (0); return (0);
break; break;
case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
if (vfd->vidioc_try_fmt_output_overlay)
return (0);
break;
case V4L2_BUF_TYPE_PRIVATE: case V4L2_BUF_TYPE_PRIVATE:
if (vfd->vidioc_try_fmt_type_private) if (vfd->vidioc_try_fmt_type_private)
return (0); return (0);
...@@ -525,6 +532,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -525,6 +532,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
ret=vfd->vidioc_enum_fmt_vbi_output(file, ret=vfd->vidioc_enum_fmt_vbi_output(file,
fh, f); fh, f);
break; break;
case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
if (vfd->vidioc_enum_fmt_output_overlay)
ret=vfd->vidioc_enum_fmt_output_overlay(file, fh, f);
break;
case V4L2_BUF_TYPE_PRIVATE: case V4L2_BUF_TYPE_PRIVATE:
if (vfd->vidioc_enum_fmt_type_private) if (vfd->vidioc_enum_fmt_type_private)
ret=vfd->vidioc_enum_fmt_type_private(file, ret=vfd->vidioc_enum_fmt_type_private(file,
...@@ -582,6 +593,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -582,6 +593,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
ret=vfd->vidioc_g_fmt_video_output(file, ret=vfd->vidioc_g_fmt_video_output(file,
fh, f); fh, f);
break; break;
case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
if (vfd->vidioc_g_fmt_output_overlay)
ret=vfd->vidioc_g_fmt_output_overlay(file, fh, f);
break;
case V4L2_BUF_TYPE_VBI_OUTPUT: case V4L2_BUF_TYPE_VBI_OUTPUT:
if (vfd->vidioc_g_fmt_vbi_output) if (vfd->vidioc_g_fmt_vbi_output)
ret=vfd->vidioc_g_fmt_vbi_output(file, fh, f); 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,6 +645,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
ret=vfd->vidioc_s_fmt_video_output(file, ret=vfd->vidioc_s_fmt_video_output(file,
fh, f); fh, f);
break; break;
case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
if (vfd->vidioc_s_fmt_output_overlay)
ret=vfd->vidioc_s_fmt_output_overlay(file, fh, f);
break;
case V4L2_BUF_TYPE_VBI_OUTPUT: case V4L2_BUF_TYPE_VBI_OUTPUT:
if (vfd->vidioc_s_fmt_vbi_output) if (vfd->vidioc_s_fmt_vbi_output)
ret=vfd->vidioc_s_fmt_vbi_output(file, ret=vfd->vidioc_s_fmt_vbi_output(file,
...@@ -680,6 +699,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -680,6 +699,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
ret=vfd->vidioc_try_fmt_video_output(file, ret=vfd->vidioc_try_fmt_video_output(file,
fh, f); fh, f);
break; break;
case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
if (vfd->vidioc_try_fmt_output_overlay)
ret=vfd->vidioc_try_fmt_output_overlay(file, fh, f);
break;
case V4L2_BUF_TYPE_VBI_OUTPUT: case V4L2_BUF_TYPE_VBI_OUTPUT:
if (vfd->vidioc_try_fmt_vbi_output) if (vfd->vidioc_try_fmt_vbi_output)
ret=vfd->vidioc_try_fmt_vbi_output(file, ret=vfd->vidioc_try_fmt_vbi_output(file,
......
...@@ -109,19 +109,31 @@ enum v4l2_field { ...@@ -109,19 +109,31 @@ enum v4l2_field {
V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */
V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into
separate buffers */ separate buffers */
V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field
first and the top field is
transmitted first */
V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field
first and the bottom field is
transmitted first */
}; };
#define V4L2_FIELD_HAS_TOP(field) \ #define V4L2_FIELD_HAS_TOP(field) \
((field) == V4L2_FIELD_TOP ||\ ((field) == V4L2_FIELD_TOP ||\
(field) == V4L2_FIELD_INTERLACED ||\ (field) == V4L2_FIELD_INTERLACED ||\
(field) == V4L2_FIELD_INTERLACED_TB ||\
(field) == V4L2_FIELD_INTERLACED_BT ||\
(field) == V4L2_FIELD_SEQ_TB ||\ (field) == V4L2_FIELD_SEQ_TB ||\
(field) == V4L2_FIELD_SEQ_BT) (field) == V4L2_FIELD_SEQ_BT)
#define V4L2_FIELD_HAS_BOTTOM(field) \ #define V4L2_FIELD_HAS_BOTTOM(field) \
((field) == V4L2_FIELD_BOTTOM ||\ ((field) == V4L2_FIELD_BOTTOM ||\
(field) == V4L2_FIELD_INTERLACED ||\ (field) == V4L2_FIELD_INTERLACED ||\
(field) == V4L2_FIELD_INTERLACED_TB ||\
(field) == V4L2_FIELD_INTERLACED_BT ||\
(field) == V4L2_FIELD_SEQ_TB ||\ (field) == V4L2_FIELD_SEQ_TB ||\
(field) == V4L2_FIELD_SEQ_BT) (field) == V4L2_FIELD_SEQ_BT)
#define V4L2_FIELD_HAS_BOTH(field) \ #define V4L2_FIELD_HAS_BOTH(field) \
((field) == V4L2_FIELD_INTERLACED ||\ ((field) == V4L2_FIELD_INTERLACED ||\
(field) == V4L2_FIELD_INTERLACED_TB ||\
(field) == V4L2_FIELD_INTERLACED_BT ||\
(field) == V4L2_FIELD_SEQ_TB ||\ (field) == V4L2_FIELD_SEQ_TB ||\
(field) == V4L2_FIELD_SEQ_BT) (field) == V4L2_FIELD_SEQ_BT)
...@@ -133,6 +145,10 @@ enum v4l2_buf_type { ...@@ -133,6 +145,10 @@ enum v4l2_buf_type {
V4L2_BUF_TYPE_VBI_OUTPUT = 5, V4L2_BUF_TYPE_VBI_OUTPUT = 5,
V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7,
#if 1
/* Experimental */
V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
#endif
V4L2_BUF_TYPE_PRIVATE = 0x80, V4L2_BUF_TYPE_PRIVATE = 0x80,
}; };
...@@ -228,6 +244,7 @@ struct v4l2_capability ...@@ -228,6 +244,7 @@ struct v4l2_capability
#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */
#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */
#define V4L2_CAP_VIDEO_OUTPUT_POS 0x00000200 /* Video output can have x,y coords */ #define V4L2_CAP_VIDEO_OUTPUT_POS 0x00000200 /* Video output can have x,y coords */
#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000400 /* Can do video output overlay */
#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
...@@ -599,10 +616,14 @@ struct v4l2_framebuffer ...@@ -599,10 +616,14 @@ struct v4l2_framebuffer
#define V4L2_FBUF_CAP_CHROMAKEY 0x0002 #define V4L2_FBUF_CAP_CHROMAKEY 0x0002
#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 #define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004
#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008
#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010
#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020
/* Flags for the 'flags' field. */ /* Flags for the 'flags' field. */
#define V4L2_FBUF_FLAG_PRIMARY 0x0001 #define V4L2_FBUF_FLAG_PRIMARY 0x0001
#define V4L2_FBUF_FLAG_OVERLAY 0x0002 #define V4L2_FBUF_FLAG_OVERLAY 0x0002
#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004
#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008
#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
struct v4l2_clip struct v4l2_clip
{ {
...@@ -618,6 +639,7 @@ struct v4l2_window ...@@ -618,6 +639,7 @@ struct v4l2_window
struct v4l2_clip __user *clips; struct v4l2_clip __user *clips;
__u32 clipcount; __u32 clipcount;
void __user *bitmap; void __user *bitmap;
__u8 global_alpha;
}; };
/* /*
......
...@@ -127,6 +127,8 @@ struct video_device ...@@ -127,6 +127,8 @@ struct video_device
struct v4l2_fmtdesc *f); struct v4l2_fmtdesc *f);
int (*vidioc_enum_fmt_video_output)(struct file *file, void *fh, int (*vidioc_enum_fmt_video_output)(struct file *file, void *fh,
struct v4l2_fmtdesc *f); struct v4l2_fmtdesc *f);
int (*vidioc_enum_fmt_output_overlay) (struct file *file, void *fh,
struct v4l2_fmtdesc *f);
int (*vidioc_enum_fmt_vbi_output) (struct file *file, void *fh, int (*vidioc_enum_fmt_vbi_output) (struct file *file, void *fh,
struct v4l2_fmtdesc *f); struct v4l2_fmtdesc *f);
int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh, int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
...@@ -145,6 +147,8 @@ struct video_device ...@@ -145,6 +147,8 @@ struct video_device
struct v4l2_format *f); struct v4l2_format *f);
int (*vidioc_g_fmt_video_output)(struct file *file, void *fh, int (*vidioc_g_fmt_video_output)(struct file *file, void *fh,
struct v4l2_format *f); struct v4l2_format *f);
int (*vidioc_g_fmt_output_overlay) (struct file *file, void *fh,
struct v4l2_format *f);
int (*vidioc_g_fmt_type_private)(struct file *file, void *fh, int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
struct v4l2_format *f); struct v4l2_format *f);
...@@ -162,6 +166,8 @@ struct video_device ...@@ -162,6 +166,8 @@ struct video_device
struct v4l2_format *f); struct v4l2_format *f);
int (*vidioc_s_fmt_video_output)(struct file *file, void *fh, int (*vidioc_s_fmt_video_output)(struct file *file, void *fh,
struct v4l2_format *f); struct v4l2_format *f);
int (*vidioc_s_fmt_output_overlay) (struct file *file, void *fh,
struct v4l2_format *f);
int (*vidioc_s_fmt_type_private)(struct file *file, void *fh, int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
struct v4l2_format *f); struct v4l2_format *f);
...@@ -178,6 +184,8 @@ struct video_device ...@@ -178,6 +184,8 @@ struct video_device
struct v4l2_format *f); struct v4l2_format *f);
int (*vidioc_try_fmt_video_output)(struct file *file, void *fh, int (*vidioc_try_fmt_video_output)(struct file *file, void *fh,
struct v4l2_format *f); struct v4l2_format *f);
int (*vidioc_try_fmt_output_overlay)(struct file *file, void *fh,
struct v4l2_format *f);
int (*vidioc_try_fmt_type_private)(struct file *file, void *fh, int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
struct v4l2_format *f); struct v4l2_format *f);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment