aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorMichael H. Schimek <mschimek@gmx.at>2005-12-01 03:51:33 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-12-01 18:48:57 -0500
commitc87c948ebd75525df4d67dd5b40e6ea81859cc17 (patch)
treec84d2b6b707407e3468a94068047c105f3e347bd /drivers/media/video
parent50ab5edc973c979e8f620e09d20b96761d271894 (diff)
[PATCH] V4L: Bttv bytes per line fix
bttv bytes per line fix. Signed-off-by: Michael H. Schimek <mschimek@gmx.at> Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/bttv-driver.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index f9d581cd31db..fdaff5bd6331 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -2029,19 +2029,33 @@ static int bttv_switch_type(struct bttv_fh *fh, enum v4l2_buf_type type)
2029 return 0; 2029 return 0;
2030} 2030}
2031 2031
2032static void
2033pix_format_set_size (struct v4l2_pix_format * f,
2034 const struct bttv_format * fmt,
2035 unsigned int width,
2036 unsigned int height)
2037{
2038 f->width = width;
2039 f->height = height;
2040
2041 if (fmt->flags & FORMAT_FLAGS_PLANAR) {
2042 f->bytesperline = width; /* Y plane */
2043 f->sizeimage = (width * height * fmt->depth) >> 3;
2044 } else {
2045 f->bytesperline = (width * fmt->depth) >> 3;
2046 f->sizeimage = height * f->bytesperline;
2047 }
2048}
2049
2032static int bttv_g_fmt(struct bttv_fh *fh, struct v4l2_format *f) 2050static int bttv_g_fmt(struct bttv_fh *fh, struct v4l2_format *f)
2033{ 2051{
2034 switch (f->type) { 2052 switch (f->type) {
2035 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 2053 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
2036 memset(&f->fmt.pix,0,sizeof(struct v4l2_pix_format)); 2054 memset(&f->fmt.pix,0,sizeof(struct v4l2_pix_format));
2037 f->fmt.pix.width = fh->width; 2055 pix_format_set_size (&f->fmt.pix, fh->fmt,
2038 f->fmt.pix.height = fh->height; 2056 fh->width, fh->height);
2039 f->fmt.pix.field = fh->cap.field; 2057 f->fmt.pix.field = fh->cap.field;
2040 f->fmt.pix.pixelformat = fh->fmt->fourcc; 2058 f->fmt.pix.pixelformat = fh->fmt->fourcc;
2041 f->fmt.pix.bytesperline =
2042 (f->fmt.pix.width * fh->fmt->depth) >> 3;
2043 f->fmt.pix.sizeimage =
2044 f->fmt.pix.height * f->fmt.pix.bytesperline;
2045 return 0; 2059 return 0;
2046 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 2060 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
2047 memset(&f->fmt.win,0,sizeof(struct v4l2_window)); 2061 memset(&f->fmt.win,0,sizeof(struct v4l2_window));
@@ -2106,11 +2120,9 @@ static int bttv_try_fmt(struct bttv_fh *fh, struct bttv *btv,
2106 f->fmt.pix.width = maxw; 2120 f->fmt.pix.width = maxw;
2107 if (f->fmt.pix.height > maxh) 2121 if (f->fmt.pix.height > maxh)
2108 f->fmt.pix.height = maxh; 2122 f->fmt.pix.height = maxh;
2109 f->fmt.pix.width &= ~0x03; 2123 pix_format_set_size (&f->fmt.pix, fmt,
2110 f->fmt.pix.bytesperline = 2124 f->fmt.pix.width & ~3,
2111 (f->fmt.pix.width * fmt->depth) >> 3; 2125 f->fmt.pix.height);
2112 f->fmt.pix.sizeimage =
2113 f->fmt.pix.height * f->fmt.pix.bytesperline;
2114 2126
2115 return 0; 2127 return 0;
2116 } 2128 }