V4L/DVB (8105): cx2341x: add TS capability
authorHans Verkuil <hverkuil@xs4all.nl>
Sun, 22 Jun 2008 15:03:28 +0000 (12:03 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 20 Jul 2008 10:11:55 +0000 (07:11 -0300)
The cx18 can support transport streams with newer firmwares. Add a TS
capability to the generic cx2341x module.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/cx18/cx18-controls.c
drivers/media/video/cx2341x.c
drivers/media/video/cx23885/cx23885-417.c
drivers/media/video/cx88/cx88-blackbird.c
drivers/media/video/ivtv/ivtv-controls.c
drivers/media/video/pvrusb2/pvrusb2-hdw.c
include/media/cx2341x.h

index 01ba9ca..8553133 100644 (file)
@@ -92,11 +92,13 @@ int cx18_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
 
 int cx18_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu)
 {
+       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
        struct v4l2_queryctrl qctrl;
 
        qctrl.id = qmenu->id;
        cx18_queryctrl(file, fh, &qctrl);
-       return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id));
+       return v4l2_ctrl_query_menu(qmenu, &qctrl,
+                       cx2341x_ctrl_get_menu(&cx->params, qmenu->id));
 }
 
 int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
index c592899..5e40c6b 100644 (file)
@@ -80,7 +80,7 @@ EXPORT_SYMBOL(cx2341x_mpeg_ctrls);
 
 /* Map the control ID to the correct field in the cx2341x_mpeg_params
    struct. Return -EINVAL if the ID is unknown, else return 0. */
-static int cx2341x_get_ctrl(struct cx2341x_mpeg_params *params,
+static int cx2341x_get_ctrl(const struct cx2341x_mpeg_params *params,
                struct v4l2_ext_control *ctrl)
 {
        switch (ctrl->id) {
@@ -420,7 +420,7 @@ static int cx2341x_ctrl_query_fill(struct v4l2_queryctrl *qctrl,
        return 0;
 }
 
-int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params,
+int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
                       struct v4l2_queryctrl *qctrl)
 {
        int err;
@@ -580,9 +580,9 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params,
 }
 EXPORT_SYMBOL(cx2341x_ctrl_query);
 
-const char **cx2341x_ctrl_get_menu(u32 id)
+const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id)
 {
-       static const char *mpeg_stream_type[] = {
+       static const char *mpeg_stream_type_without_ts[] = {
                "MPEG-2 Program Stream",
                "",
                "MPEG-1 System Stream",
@@ -592,6 +592,16 @@ const char **cx2341x_ctrl_get_menu(u32 id)
                NULL
        };
 
+       static const char *mpeg_stream_type_with_ts[] = {
+               "MPEG-2 Program Stream",
+               "MPEG-2 Transport Stream",
+               "MPEG-1 System Stream",
+               "MPEG-2 DVD-compatible Stream",
+               "MPEG-1 VCD-compatible Stream",
+               "MPEG-2 SVCD-compatible Stream",
+               NULL
+       };
+
        static const char *cx2341x_video_spatial_filter_mode_menu[] = {
                "Manual",
                "Auto",
@@ -630,7 +640,8 @@ const char **cx2341x_ctrl_get_menu(u32 id)
 
        switch (id) {
        case V4L2_CID_MPEG_STREAM_TYPE:
-               return mpeg_stream_type;
+               return (p->capabilities & CX2341X_CAP_HAS_TS) ?
+                       mpeg_stream_type_with_ts : mpeg_stream_type_without_ts;
        case V4L2_CID_MPEG_AUDIO_L1_BITRATE:
        case V4L2_CID_MPEG_AUDIO_L3_BITRATE:
                return NULL;
@@ -690,7 +701,7 @@ int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy,
                if (err)
                        break;
                if (qctrl.type == V4L2_CTRL_TYPE_MENU)
-                       menu_items = cx2341x_ctrl_get_menu(qctrl.id);
+                       menu_items = cx2341x_ctrl_get_menu(params, qctrl.id);
                err = v4l2_ctrl_check(ctrl, &qctrl, menu_items);
                if (err)
                        break;
@@ -933,9 +944,9 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
 }
 EXPORT_SYMBOL(cx2341x_update);
 
-static const char *cx2341x_menu_item(struct cx2341x_mpeg_params *p, u32 id)
+static const char *cx2341x_menu_item(const struct cx2341x_mpeg_params *p, u32 id)
 {
-       const char **menu = cx2341x_ctrl_get_menu(id);
+       const char **menu = cx2341x_ctrl_get_menu(p, id);
        struct v4l2_ext_control ctrl;
 
        if (menu == NULL)
@@ -952,7 +963,7 @@ invalid:
        return "<invalid>";
 }
 
-void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix)
+void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix)
 {
        int is_mpeg1 = p->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1;
        int temporal = p->video_temporal_filter;
index acdd3b6..0f50c37 100644 (file)
@@ -1173,7 +1173,7 @@ static int cx23885_querymenu(struct cx23885_dev *dev,
        qctrl.id = qmenu->id;
        cx23885_queryctrl(dev, &qctrl);
        return v4l2_ctrl_query_menu(qmenu, &qctrl,
-               cx2341x_ctrl_get_menu(qmenu->id));
+               cx2341x_ctrl_get_menu(&dev->mpeg_params, qmenu->id));
 }
 
 int cx23885_do_ioctl(struct inode *inode, struct file *file, int radio,
index fb67e41..bfdca58 100644 (file)
@@ -715,7 +715,8 @@ static int vidioc_querymenu (struct file *file, void *priv,
 
        qctrl.id = qmenu->id;
        blackbird_queryctrl(dev, &qctrl);
-       return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id));
+       return v4l2_ctrl_query_menu(qmenu, &qctrl,
+                       cx2341x_ctrl_get_menu(&dev->params, qmenu->id));
 }
 
 static int vidioc_querycap (struct file *file, void  *priv,
index 2df9b06..6a5b709 100644 (file)
@@ -89,11 +89,13 @@ int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
 
 int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu)
 {
+       struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
        struct v4l2_queryctrl qctrl;
 
        qctrl.id = qmenu->id;
        ivtv_queryctrl(file, fh, &qctrl);
-       return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id));
+       return v4l2_ctrl_query_menu(qmenu, &qctrl,
+                       cx2341x_ctrl_get_menu(&itv->params, qmenu->id));
 }
 
 int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
index f30e13f..6517ba8 100644 (file)
@@ -2013,7 +2013,8 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
                case V4L2_CTRL_TYPE_MENU:
                        ciptr->type = pvr2_ctl_enum;
                        ciptr->def.type_enum.value_names =
-                               cx2341x_ctrl_get_menu(ciptr->v4l_id);
+                               cx2341x_ctrl_get_menu(&hdw->enc_ctl_state,
+                                                               ciptr->v4l_id);
                        for (cnt1 = 0;
                             ciptr->def.type_enum.value_names[cnt1] != NULL;
                             cnt1++) { }
index 5f4608e..9ec4d58 100644 (file)
@@ -27,6 +27,7 @@ enum cx2341x_port {
 
 enum cx2341x_cap {
        CX2341X_CAP_HAS_SLICED_VBI = 1 << 0,
+       CX2341X_CAP_HAS_TS         = 1 << 1,
 };
 
 struct cx2341x_mpeg_params {
@@ -88,13 +89,13 @@ typedef int (*cx2341x_mbox_func)(void *priv, u32 cmd, int in, int out,
 int cx2341x_update(void *priv, cx2341x_mbox_func func,
                const struct cx2341x_mpeg_params *old,
                const struct cx2341x_mpeg_params *new);
-int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params,
+int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
                struct v4l2_queryctrl *qctrl);
-const char **cx2341x_ctrl_get_menu(u32 id);
+const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id);
 int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy,
                struct v4l2_ext_controls *ctrls, unsigned int cmd);
 void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p);
-void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix);
+void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix);
 
 /* Firmware names */
 #define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw"