]> err.no Git - linux-2.6/commitdiff
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 01ba9ca37d09d7b3e3e82824865fcb457011015c..855313359370b1da889ae0c4d20e06d21b961f22 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 c592899a23175f8a75febad62b3e39b8e930f9cb..5e40c6bd69b6f4b6b58c531b277122849249ed9f 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 acdd3b6b3e7c254c8dfa28f2b102112eaf2c70a0..0f50c377aa7c93d5ce9af0c8555d19038b49eb98 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 fb67e4188b2f31b3b0a9ce661f28aeee644949c7..bfdca5847764fde66852c48a5ab85712d8340a63 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 2df9b0668f1fed739ab19584d6f8eb3453b71f37..6a5b709129596f3210da5fd7841603b9d9fe51f7 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 f30e13f6ee746ae57aa8671d1cae712464b4504c..6517ba81bd4b868158641a9589a4279e7821d60e 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 5f4608e8847647723f8028bc4b488a2b62e060ca..9ec4d5889ef5a9e1981c5a903d1db8a61e30da35 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"