Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9db45506 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Linus Torvalds
Browse files

[PATCH] v4l: experimental Sliced VBI API support



Adds all defines, ioctls and structs needed for the sliced VBI API

VBI = Vertical Blank Interval.

It is related with the way TV signals work.  It sends a line, then, it has a
retrace time to allow the tube to move electrons to the beginning of the next
line.  This was the main reason at the beginning of analog B&W TV.

There is a lot of bandwidth lost on VBI.  So, lots of TV systems use it to
send other information such as Closed Captions and Teletext.  Also,
broadcasters uses this as a channel to exchange information from the content
producer to their subsidiaries at each city.

There's already a raw VBI interface on V4L2 api, used for Closed Captions and
Teletext.  The decoding is doing at userlevel space and it is mostly for
analog TV signals, non encoded.

Encoded signals (MPEG, for example), may need also to transmit other
information (like, for example, display aspect, i.e.  4x3, widescreen...).
Sliced VBI interface is a method to allow the video stream to transmit this
kind of information.

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 939bb7ef
Loading
Loading
Loading
Loading
+87 −22
Original line number Diff line number Diff line
@@ -65,6 +65,11 @@ enum v4l2_buf_type {
	V4L2_BUF_TYPE_VIDEO_OVERLAY      = 3,
	V4L2_BUF_TYPE_VBI_CAPTURE        = 4,
	V4L2_BUF_TYPE_VBI_OUTPUT         = 5,
#if 1
	/* Experimental Sliced VBI */
	V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
	V4L2_BUF_TYPE_SLICED_VBI_OUTPUT  = 7,
#endif
	V4L2_BUF_TYPE_PRIVATE            = 0x80,
};

@@ -152,8 +157,12 @@ struct v4l2_capability
#define V4L2_CAP_VIDEO_CAPTURE	        0x00000001  /* Is a video capture device */
#define V4L2_CAP_VIDEO_OUTPUT	        0x00000002  /* Is a video output device */
#define V4L2_CAP_VIDEO_OVERLAY	        0x00000004  /* Can do video overlay */
#define V4L2_CAP_VBI_CAPTURE	0x00000010  /* Is a VBI capture device */
#define V4L2_CAP_VBI_OUTPUT	0x00000020  /* Is a VBI output device */
#define V4L2_CAP_VBI_CAPTURE	        0x00000010  /* Is a raw VBI capture device */
#define V4L2_CAP_VBI_OUTPUT	        0x00000020  /* Is a raw VBI output device */
#if 1
#define V4L2_CAP_SLICED_VBI_CAPTURE	0x00000040  /* Is a sliced VBI capture device */
#define V4L2_CAP_SLICED_VBI_OUTPUT	0x00000080  /* Is a sliced VBI output device */
#endif
#define V4L2_CAP_RDS_CAPTURE	        0x00000100  /* RDS data capture */

#define V4L2_CAP_TUNER		        0x00010000  /* has a tuner */
@@ -809,6 +818,8 @@ struct v4l2_audioout
 *	Data services API by Michael Schimek
 */

/* Raw VBI */

struct v4l2_vbi_format
{
	__u32	sampling_rate;		/* in 1 Hz */
@@ -825,6 +836,54 @@ struct v4l2_vbi_format
#define V4L2_VBI_UNSYNC		(1<< 0)
#define V4L2_VBI_INTERLACED	(1<< 1)

#if 1
/* Sliced VBI
 *
 *    This implements is a proposal V4L2 API to allow SLICED VBI
 * required for some hardware encoders. It should change without
 * notice in the definitive implementation.
 */

struct v4l2_sliced_vbi_format
{
        __u16   service_set;
        /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
           service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
                                 (equals frame lines 313-336 for 625 line video
                                  standards, 263-286 for 525 line standards) */
        __u16   service_lines[2][24];
        __u32   io_size;
        __u32   reserved[2];            /* must be zero */
};

#define V4L2_SLICED_TELETEXT_B          (0x0001)
#define V4L2_SLICED_VPS                 (0x0400)
#define V4L2_SLICED_CAPTION_525         (0x1000)
#define V4L2_SLICED_WSS_625             (0x4000)

#define V4L2_SLICED_VBI_525             (V4L2_SLICED_CAPTION_525)
#define V4L2_SLICED_VBI_625             (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)

struct v4l2_sliced_vbi_cap
{
        __u16   service_set;
        /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
           service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
                                 (equals frame lines 313-336 for 625 line video
                                  standards, 263-286 for 525 line standards) */
        __u16   service_lines[2][24];
        __u32   reserved[4];    /* must be 0 */
};

struct v4l2_sliced_vbi_data
{
        __u32   id;
        __u32   field;          /* 0: first field, 1: second field */
        __u32   line;           /* 1-23 */
        __u32   reserved;       /* must be 0 */
        __u8    data[48];
};
#endif

/*
 *	A G G R E G A T E   S T R U C T U R E S
@@ -840,6 +899,9 @@ struct v4l2_format
		struct v4l2_pix_format	        pix;     // V4L2_BUF_TYPE_VIDEO_CAPTURE
		struct v4l2_window	        win;     // V4L2_BUF_TYPE_VIDEO_OVERLAY
		struct v4l2_vbi_format	        vbi;     // V4L2_BUF_TYPE_VBI_CAPTURE
#if 1
		struct v4l2_sliced_vbi_format	sliced;  // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
#endif
		__u8	raw_data[200];                   // user-defined
	} fmt;
};
@@ -916,6 +978,9 @@ struct v4l2_streamparm
#define VIDIOC_ENUMAUDOUT	_IOWR ('V', 66, struct v4l2_audioout)
#define VIDIOC_G_PRIORITY       _IOR  ('V', 67, enum v4l2_priority)
#define VIDIOC_S_PRIORITY       _IOW  ('V', 68, enum v4l2_priority)
#if 1
#define VIDIOC_G_SLICED_VBI_CAP _IOR  ('V', 69, struct v4l2_sliced_vbi_cap)
#endif

/* for compatibility, will go away some day */
#define VIDIOC_OVERLAY_OLD     	_IOWR ('V', 14, int)