]> err.no Git - linux-2.6/commitdiff
V4L/DVB (4223): Add V4L2_CID_MPEG_STREAM_VBI_FMT control
authorHans Verkuil <hverkuil@xs4all.nl>
Sat, 24 Jun 2006 17:36:02 +0000 (14:36 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Mon, 26 Jun 2006 12:21:45 +0000 (09:21 -0300)
V4L2_CID_MPEG_STREAM_VBI_FMT controls if and how VBI data is embedded in
an MPEG stream. Currently only one format is supported: the format designed
for the ivtv driver. This should be extended with new standard formats
(such as defined for DVB) in the future.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/cx2341x.c
drivers/media/video/v4l2-common.c
include/linux/videodev2.h
include/media/cx2341x.h

index 554813e6f65d351975367bbbf9f1367c4488b1dd..01b22eab572574827fc0de12c6e580f8a0c84061 100644 (file)
@@ -43,6 +43,7 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)");
 const u32 cx2341x_mpeg_ctrls[] = {
        V4L2_CID_MPEG_CLASS,
        V4L2_CID_MPEG_STREAM_TYPE,
+       V4L2_CID_MPEG_STREAM_VBI_FMT,
        V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ,
        V4L2_CID_MPEG_AUDIO_ENCODING,
        V4L2_CID_MPEG_AUDIO_L2_BITRATE,
@@ -135,6 +136,9 @@ static int cx2341x_get_ctrl(struct cx2341x_mpeg_params *params,
        case V4L2_CID_MPEG_STREAM_TYPE:
                ctrl->value = params->stream_type;
                break;
+       case V4L2_CID_MPEG_STREAM_VBI_FMT:
+               ctrl->value = params->stream_vbi_fmt;
+               break;
        case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
                ctrl->value = params->video_spatial_filter_mode;
                break;
@@ -257,6 +261,9 @@ static int cx2341x_set_ctrl(struct cx2341x_mpeg_params *params,
                        params->video_bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_CBR;
                }
                break;
+       case V4L2_CID_MPEG_STREAM_VBI_FMT:
+               params->stream_vbi_fmt = ctrl->value;
+               break;
        case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
                params->video_spatial_filter_mode = ctrl->value;
                break;
@@ -418,6 +425,14 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, struct v4l2_queryctrl
                        qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
                return err;
 
+       case V4L2_CID_MPEG_STREAM_VBI_FMT:
+               if (params->capabilities & CX2341X_CAP_HAS_SLICED_VBI)
+                       return v4l2_ctrl_query_fill_std(qctrl);
+               return cx2341x_ctrl_query_fill(qctrl,
+                               V4L2_MPEG_STREAM_VBI_FMT_NONE,
+                               V4L2_MPEG_STREAM_VBI_FMT_NONE, 1,
+                               V4L2_MPEG_STREAM_VBI_FMT_NONE);
+
        /* CX23415/6 specific */
        case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
                return cx2341x_ctrl_query_fill(qctrl,
@@ -639,6 +654,7 @@ void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p)
 {
        static struct cx2341x_mpeg_params default_params = {
        /* misc */
+       .capabilities = 0,
        .port = CX2341X_PORT_MEMORY,
        .width = 720,
        .height = 480,
@@ -646,6 +662,7 @@ void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p)
 
        /* stream */
        .stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS,
+       .stream_vbi_fmt = V4L2_MPEG_STREAM_VBI_FMT_NONE,
 
        /* audio */
        .audio_sampling_freq = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000,
index 14e523471354b160c4d8a078d3c90791d118ca5f..f4b3d64ebf73ff7ff11958a8b2ac8cab6655d0b1 100644 (file)
@@ -1101,6 +1101,11 @@ const char **v4l2_ctrl_get_menu(u32 id)
                "MPEG-2 SVCD-compatible Stream",
                NULL
        };
+       static const char *mpeg_stream_vbi_fmt[] = {
+               "No VBI",
+               "VBI in private packets, IVTV format",
+               NULL
+       };
 
        switch (id) {
                case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -1129,6 +1134,8 @@ const char **v4l2_ctrl_get_menu(u32 id)
                        return mpeg_video_bitrate_mode;
                case V4L2_CID_MPEG_STREAM_TYPE:
                        return mpeg_stream_type;
+               case V4L2_CID_MPEG_STREAM_VBI_FMT:
+                       return mpeg_stream_vbi_fmt;
                default:
                        return NULL;
        }
@@ -1182,6 +1189,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste
        case V4L2_CID_MPEG_STREAM_PID_PCR:      name = "Stream PCR Program ID"; break;
        case V4L2_CID_MPEG_STREAM_PES_ID_AUDIO: name = "Stream PES Audio ID"; break;
        case V4L2_CID_MPEG_STREAM_PES_ID_VIDEO: name = "Stream PES Video ID"; break;
+       case V4L2_CID_MPEG_STREAM_VBI_FMT:      name = "Stream VBI Format"; break;
 
        default:
                return -EINVAL;
@@ -1208,6 +1216,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste
        case V4L2_CID_MPEG_VIDEO_ASPECT:
        case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
        case V4L2_CID_MPEG_STREAM_TYPE:
+       case V4L2_CID_MPEG_STREAM_VBI_FMT:
                qctrl->type = V4L2_CTRL_TYPE_MENU;
                step = 1;
                break;
@@ -1367,6 +1376,11 @@ int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl)
                return v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 0);
        case V4L2_CID_MPEG_STREAM_PES_ID_VIDEO:
                return v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 0);
+       case V4L2_CID_MPEG_STREAM_VBI_FMT:
+               return v4l2_ctrl_query_fill(qctrl,
+                               V4L2_MPEG_STREAM_VBI_FMT_NONE,
+                               V4L2_MPEG_STREAM_VBI_FMT_IVTV, 1,
+                               V4L2_MPEG_STREAM_VBI_FMT_NONE);
        default:
                return -EINVAL;
        }
index 8b4745c5e9751b82516150c252cfc1de30e2d7fb..a62673dad76e41809ff88df2c4e34773347268ed 100644 (file)
@@ -822,6 +822,11 @@ enum v4l2_mpeg_stream_type {
 #define V4L2_CID_MPEG_STREAM_PID_PCR           (V4L2_CID_MPEG_BASE+4)
 #define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO      (V4L2_CID_MPEG_BASE+5)
 #define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO      (V4L2_CID_MPEG_BASE+6)
+#define V4L2_CID_MPEG_STREAM_VBI_FMT           (V4L2_CID_MPEG_BASE+7)
+enum v4l2_mpeg_stream_vbi_fmt {
+       V4L2_MPEG_STREAM_VBI_FMT_NONE = 0,  /* No VBI in the MPEG stream */
+       V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1,  /* VBI in private packets, IVTV format */
+};
 
 /*  MPEG audio */
 #define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ      (V4L2_CID_MPEG_BASE+100)
index 51fb06b4c3948cafb2c712a6fbd2a6fcfcf0b033..074c4008ad5296fa5f73c5c21e67dd3d42fd69d2 100644 (file)
@@ -25,8 +25,13 @@ enum cx2341x_port {
        CX2341X_PORT_SERIAL    = 2
 };
 
+enum cx2341x_cap {
+       CX2341X_CAP_HAS_SLICED_VBI = 1 << 0,
+};
+
 struct cx2341x_mpeg_params {
        /* misc */
+       u32 capabilities;
        enum cx2341x_port port;
        u16 width;
        u16 height;
@@ -34,6 +39,7 @@ struct cx2341x_mpeg_params {
 
        /* stream */
        enum v4l2_mpeg_stream_type stream_type;
+       enum v4l2_mpeg_stream_vbi_fmt stream_vbi_fmt;
 
        /* audio */
        enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq;