[media] cx231xx: improve std handling
Set the initial standard of subdevices instead of leaving it undefined. Also update the width and height when a new standard is chosen and return -EBUSY when attempting to change the standard while videobuf is busy. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
71590765b8
commit
d61072a497
|
@ -992,34 +992,34 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
|
||||||
struct cx231xx_fh *fh = priv;
|
struct cx231xx_fh *fh = priv;
|
||||||
struct cx231xx *dev = fh->dev;
|
struct cx231xx *dev = fh->dev;
|
||||||
struct v4l2_mbus_framefmt mbus_fmt;
|
struct v4l2_mbus_framefmt mbus_fmt;
|
||||||
struct v4l2_format f;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = check_dev(dev);
|
rc = check_dev(dev);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
cx231xx_info("vidioc_s_std : 0x%x\n", (unsigned int)*norm);
|
if (dev->norm == *norm)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (videobuf_queue_is_busy(&fh->vb_vidq))
|
||||||
|
return -EBUSY;
|
||||||
|
|
||||||
dev->norm = *norm;
|
dev->norm = *norm;
|
||||||
|
|
||||||
/* Adjusts width/height, if needed */
|
/* Adjusts width/height, if needed */
|
||||||
f.fmt.pix.width = dev->width;
|
dev->width = 720;
|
||||||
f.fmt.pix.height = dev->height;
|
dev->height = (dev->norm & V4L2_STD_625_50) ? 576 : 480;
|
||||||
vidioc_try_fmt_vid_cap(file, priv, &f);
|
|
||||||
|
|
||||||
call_all(dev, core, s_std, dev->norm);
|
call_all(dev, core, s_std, dev->norm);
|
||||||
|
|
||||||
/* We need to reset basic properties in the decoder related to
|
/* We need to reset basic properties in the decoder related to
|
||||||
resolution (since a standard change effects things like the number
|
resolution (since a standard change effects things like the number
|
||||||
of lines in VACT, etc) */
|
of lines in VACT, etc) */
|
||||||
v4l2_fill_mbus_format(&mbus_fmt, &f.fmt.pix, V4L2_MBUS_FMT_FIXED);
|
memset(&mbus_fmt, 0, sizeof(mbus_fmt));
|
||||||
|
mbus_fmt.code = V4L2_MBUS_FMT_FIXED;
|
||||||
|
mbus_fmt.width = dev->width;
|
||||||
|
mbus_fmt.height = dev->height;
|
||||||
call_all(dev, video, s_mbus_fmt, &mbus_fmt);
|
call_all(dev, video, s_mbus_fmt, &mbus_fmt);
|
||||||
v4l2_fill_pix_format(&f.fmt.pix, &mbus_fmt);
|
|
||||||
|
|
||||||
/* set new image size */
|
|
||||||
dev->width = f.fmt.pix.width;
|
|
||||||
dev->height = f.fmt.pix.height;
|
|
||||||
|
|
||||||
/* do mode control overrides */
|
/* do mode control overrides */
|
||||||
cx231xx_do_mode_ctrl_overrides(dev);
|
cx231xx_do_mode_ctrl_overrides(dev);
|
||||||
|
@ -2307,6 +2307,8 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
|
||||||
/* Set the initial input */
|
/* Set the initial input */
|
||||||
video_mux(dev, dev->video_input);
|
video_mux(dev, dev->video_input);
|
||||||
|
|
||||||
|
call_all(dev, core, s_std, dev->norm);
|
||||||
|
|
||||||
v4l2_ctrl_handler_init(&dev->ctrl_handler, 10);
|
v4l2_ctrl_handler_init(&dev->ctrl_handler, 10);
|
||||||
v4l2_ctrl_handler_init(&dev->radio_ctrl_handler, 5);
|
v4l2_ctrl_handler_init(&dev->radio_ctrl_handler, 5);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue