diff options
-rw-r--r-- | linux/drivers/media/video/bttv-driver.c | 36 | ||||
-rw-r--r-- | v4l/ChangeLog | 8 |
2 files changed, 32 insertions, 12 deletions
diff --git a/linux/drivers/media/video/bttv-driver.c b/linux/drivers/media/video/bttv-driver.c index 70a561602..68b8c339d 100644 --- a/linux/drivers/media/video/bttv-driver.c +++ b/linux/drivers/media/video/bttv-driver.c @@ -1,5 +1,5 @@ /* - $Id: bttv-driver.c,v 1.70 2005/11/18 15:31:11 nsh Exp $ + $Id: bttv-driver.c,v 1.71 2005/11/18 15:35:33 nsh Exp $ bttv - Bt848 frame grabber driver @@ -2056,19 +2056,33 @@ static int bttv_switch_type(struct bttv_fh *fh, enum v4l2_buf_type type) return 0; } +static void +pix_format_set_size (struct v4l2_pix_format * f, + const struct bttv_format * fmt, + unsigned int width, + unsigned int height) +{ + f->width = width; + f->height = height; + + if (fmt->flags & FORMAT_FLAGS_PLANAR) { + f->bytesperline = width; /* Y plane */ + f->sizeimage = (width * height * fmt->depth) >> 3; + } else { + f->bytesperline = (width * fmt->depth) >> 3; + f->sizeimage = height * f->bytesperline; + } +} + static int bttv_g_fmt(struct bttv_fh *fh, struct v4l2_format *f) { switch (f->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: memset(&f->fmt.pix,0,sizeof(struct v4l2_pix_format)); - f->fmt.pix.width = fh->width; - f->fmt.pix.height = fh->height; + pix_format_set_size (&f->fmt.pix, fh->fmt, + fh->width, fh->height); f->fmt.pix.field = fh->cap.field; f->fmt.pix.pixelformat = fh->fmt->fourcc; - f->fmt.pix.bytesperline = - (f->fmt.pix.width * fh->fmt->depth) >> 3; - f->fmt.pix.sizeimage = - f->fmt.pix.height * f->fmt.pix.bytesperline; return 0; case V4L2_BUF_TYPE_VIDEO_OVERLAY: memset(&f->fmt.win,0,sizeof(struct v4l2_window)); @@ -2133,11 +2147,9 @@ static int bttv_try_fmt(struct bttv_fh *fh, struct bttv *btv, f->fmt.pix.width = maxw; if (f->fmt.pix.height > maxh) f->fmt.pix.height = maxh; - f->fmt.pix.width &= ~0x03; - f->fmt.pix.bytesperline = - (f->fmt.pix.width * fmt->depth) >> 3; - f->fmt.pix.sizeimage = - f->fmt.pix.height * f->fmt.pix.bytesperline; + pix_format_set_size (&f->fmt.pix, fmt, + f->fmt.pix.width & ~3, + f->fmt.pix.height); return 0; } diff --git a/v4l/ChangeLog b/v4l/ChangeLog index 24ff44dac..765e9d806 100644 --- a/v4l/ChangeLog +++ b/v4l/ChangeLog @@ -1,3 +1,11 @@ +2005-11-18 14:33 nshmyrev + + * ../linux/drivers/media/video/bttv-driver.c: + - bttv bytes per line fix. + + Signed-off-by: Michael H. Schimek <mschimek@gmx.at> + Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru> + 2005-11-18 14:28 nshmyrev * ../linux/drivers/media/video/bttv-driver.c: |