]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (6392): bttv: Update initial image size when set via V4L1 VIDIOCMCAPTURE
authorTrent Piepho <xyzzy@speakeasy.org>
Mon, 22 Oct 2007 20:44:55 +0000 (17:44 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 4 Nov 2007 23:41:16 +0000 (21:41 -0200)
The V4L1 spec says that the image size should be with with VIDIOCSWIN before
requesting buffers with VIDIOCGMBUF and capturing into them with
VIDIOCMCAPTURE.

But it seems that many apps don't do this.  They set the size using the fields
in the VIDIOCMCAPTURE ioctl.  The driver doesn't know what size to capture
until it actually starts to capture.  In particular, it doesn't know what size
to capture until it has already mmap the captured buffers.  Which is quite
stupid.  Why V4L1 has size and format fields for VIDIOCMCAPTURE I have no idea.

Many drivers don't support this, including those using v4l1-compat.

The bttv does, which is probably the only reason such broken software is so
prevalent.

But, the driver doesn't adjust its idea of what size is being captured when it
is set this way.  If you try to query the driver's current setting with
v4l2-ctl, it won't be correct.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/bt8xx/bttv-driver.c

index 56e43506fe1fd4c7d2d51107abc28a8f994d6e13..a88b56e6ca05c3c2d990e2313c2bd79b857124f6 100644 (file)
@@ -3113,6 +3113,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
                                             vm->width,vm->height,field);
                if (0 != retval)
                        goto fh_unlock_and_return;
+               btv->init.width = vm->width;
+               btv->init.height = vm->height;
                spin_lock_irqsave(&btv->s_lock,flags);
                buffer_queue(&fh->cap,&buf->vb);
                spin_unlock_irqrestore(&btv->s_lock,flags);