aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/video/zoran/zoran_driver.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-02-18 17:11:17 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 12:42:56 -0300
commit0ba514d5d39d017e320ffba6d2a98563b829d37c (patch)
tree20ea0f4a59e71f1864620f676057019acd2d16fe /drivers/media/video/zoran/zoran_driver.c
parent7f37cc9bae7aa29d567460c3ac8178d587f710bc (diff)
V4L/DVB (10711): zoran: fix TRY_FMT support
Actually try to turn the format into something usable rather than just rejecting it if it isn't perfect. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/zoran/zoran_driver.c')
-rw-r--r--drivers/media/video/zoran/zoran_driver.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c
index 0cce652011f..cdfd3cc0515 100644
--- a/drivers/media/video/zoran/zoran_driver.c
+++ b/drivers/media/video/zoran/zoran_driver.c
@@ -1797,7 +1797,7 @@ static long zoran_default(struct file *file, void *__fh, int cmd, void *arg)
/* Check the params first before overwriting our
* nternal values */
- if (zoran_check_jpg_settings(zr, &settings)) {
+ if (zoran_check_jpg_settings(zr, &settings, 0)) {
res = -EINVAL;
goto sparams_unlock_and_return;
}
@@ -2205,7 +2205,7 @@ static int zoran_try_fmt_vid_out(struct file *file, void *__fh,
settings.field_per_buff = 1;
/* check */
- res = zoran_check_jpg_settings(zr, &settings);
+ res = zoran_check_jpg_settings(zr, &settings, 1);
if (res)
goto tryfmt_unlock_and_return;
@@ -2231,6 +2231,7 @@ static int zoran_try_fmt_vid_cap(struct file *file, void *__fh,
{
struct zoran_fh *fh = __fh;
struct zoran *zr = fh->zr;
+ int bpp;
int i;
if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG)
@@ -2247,6 +2248,8 @@ static int zoran_try_fmt_vid_cap(struct file *file, void *__fh,
return -EINVAL;
}
+ bpp = (zoran_formats[i].depth + 7) / 8;
+ fmt->fmt.pix.width &= ~((bpp == 2) ? 1 : 3);
if (fmt->fmt.pix.width > BUZ_MAX_WIDTH)
fmt->fmt.pix.width = BUZ_MAX_WIDTH;
if (fmt->fmt.pix.width < BUZ_MIN_WIDTH)
@@ -2334,8 +2337,16 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh,
else
settings.field_per_buff = 1;
+ if (settings.HorDcm > 1) {
+ settings.img_x = (BUZ_MAX_WIDTH == 720) ? 8 : 0;
+ settings.img_width = (BUZ_MAX_WIDTH == 720) ? 704 : BUZ_MAX_WIDTH;
+ } else {
+ settings.img_x = 0;
+ settings.img_width = BUZ_MAX_WIDTH;
+ }
+
/* check */
- res = zoran_check_jpg_settings(zr, &settings);
+ res = zoran_check_jpg_settings(zr, &settings, 0);
if (res)
goto sfmtjpg_unlock_and_return;
@@ -3216,7 +3227,7 @@ static int zoran_s_crop(struct file *file, void *__fh, struct v4l2_crop *crop)
settings.img_height = crop->c.height;
/* check validity */
- res = zoran_check_jpg_settings(zr, &settings);
+ res = zoran_check_jpg_settings(zr, &settings, 0);
if (res)
goto scrop_unlock_and_return;
@@ -3278,7 +3289,7 @@ static int zoran_s_jpegcomp(struct file *file, void *__fh,
goto sjpegc_unlock_and_return;
}
- res = zoran_check_jpg_settings(zr, &settings);
+ res = zoran_check_jpg_settings(zr, &settings, 0);
if (res)
goto sjpegc_unlock_and_return;
if (!fh->jpg_buffers.allocated)