V4L/DVB (9894): cx18: Use a known open task handle when setting stream CX2341x parameters
authorAndy Walls <awalls@radix.net>
Sun, 23 Nov 2008 22:16:44 +0000 (19:16 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 30 Dec 2008 11:39:08 +0000 (09:39 -0200)
cx18: Use a known open task handle when setting stream CX2341x parameters
Sometimes, we might only have VBI or YUV stream open instead of an MPEG stream.
Let's make sure we use a valid task handle to perform the CX2341x control
settings.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx18/cx18-controls.c
drivers/media/video/cx18/cx18-mailbox.c
drivers/media/video/cx18/cx18-mailbox.h
drivers/media/video/cx18/cx18-streams.c

index f46c7e5ed747c61c7f7b50ce58fb4aa09c01f58f..17edf305d6499e7abcfc53b88c21627315f05443 100644 (file)
@@ -259,6 +259,7 @@ int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
                return err;
        }
        if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
+               struct cx18_api_func_private priv;
                struct cx2341x_mpeg_params p = cx->params;
                int err = cx2341x_ext_ctrls(&p, atomic_read(&cx->ana_capturing),
                                                c, VIDIOC_S_EXT_CTRLS);
@@ -278,7 +279,9 @@ int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
                        fmt.fmt.pix.height = cx->params.height;
                        cx18_av_cmd(cx, VIDIOC_S_FMT, &fmt);
                }
-               err = cx2341x_update(cx, cx18_api_func, &cx->params, &p);
+               priv.cx = cx;
+               priv.s = &cx->streams[id->type];
+               err = cx2341x_update(&priv, cx18_api_func, &cx->params, &p);
                if (!err && cx->params.stream_vbi_fmt != p.stream_vbi_fmt)
                        err = cx18_setup_vbi_fmt(cx, p.stream_vbi_fmt);
                cx->params = p;
index ca8d5f4b731a26ed29391aba5d2a1185ec57d579..d62351466e26ae31be7204cfd75b4eb65facf156 100644 (file)
@@ -606,8 +606,9 @@ static int cx18_set_filter_param(struct cx18_stream *s)
 int cx18_api_func(void *priv, u32 cmd, int in, int out,
                u32 data[CX2341X_MBOX_MAX_DATA])
 {
-       struct cx18 *cx = priv;
-       struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_MPG];
+       struct cx18_api_func_private *api_priv = priv;
+       struct cx18 *cx = api_priv->cx;
+       struct cx18_stream *s = api_priv->s;
 
        switch (cmd) {
        case CX2341X_ENC_SET_OUTPUT_PORT:
index 33d5a0e7080b7e02ca25a9ca9212613c38fd811e..ce2b6686aa005268363be2335ea61ba0910a001f 100644 (file)
@@ -79,6 +79,13 @@ struct cx18_mailbox {
     u32       error;
 };
 
+struct cx18_stream;
+
+struct cx18_api_func_private {
+       struct cx18 *cx;
+       struct cx18_stream *s;
+};
+
 int cx18_api(struct cx18 *cx, u32 cmd, int args, u32 data[]);
 int cx18_vapi_result(struct cx18 *cx, u32 data[MAX_MB_ARGUMENTS], u32 cmd,
                int args, ...);
index 600a5fcac3d0dcc178bb18338bd114d1f10d2dc7..63c336c95ff5005e9220361b55c6347fdb7ec401 100644 (file)
@@ -494,6 +494,8 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
        cx18_vapi(cx, CX18_CPU_SET_CHANNEL_TYPE, 2, s->handle, captype);
 
        if (atomic_read(&cx->ana_capturing) == 0 && !ts) {
+               struct cx18_api_func_private priv;
+
                /* Stuff from Windows, we don't know what it is */
                cx18_vapi(cx, CX18_CPU_SET_VER_CROP_LINE, 2, s->handle, 0);
                cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 3, s->handle, 3, 1);
@@ -513,7 +515,9 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
                cx18_vapi_result(cx, data, CX18_CPU_SET_INDEXTABLE, 1, 0);
 
                /* Setup API for Stream */
-               cx2341x_update(cx, cx18_api_func, NULL, &cx->params);
+               priv.cx = cx;
+               priv.s = s;
+               cx2341x_update(&priv, cx18_api_func, NULL, &cx->params);
        }
 
        if (atomic_read(&cx->tot_capturing) == 0) {