diff options
| -rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 882796e84dbc..8fe1beecfffa 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
| @@ -687,8 +687,8 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |||
| 687 | { | 687 | { |
| 688 | struct em28xx_fh *fh = priv; | 688 | struct em28xx_fh *fh = priv; |
| 689 | struct em28xx *dev = fh->dev; | 689 | struct em28xx *dev = fh->dev; |
| 690 | int width = f->fmt.pix.width; | 690 | unsigned int width = f->fmt.pix.width; |
| 691 | int height = f->fmt.pix.height; | 691 | unsigned int height = f->fmt.pix.height; |
| 692 | unsigned int maxw = norm_maxw(dev); | 692 | unsigned int maxw = norm_maxw(dev); |
| 693 | unsigned int maxh = norm_maxh(dev); | 693 | unsigned int maxh = norm_maxh(dev); |
| 694 | unsigned int hscale, vscale; | 694 | unsigned int hscale, vscale; |
| @@ -701,34 +701,20 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |||
| 701 | return -EINVAL; | 701 | return -EINVAL; |
| 702 | } | 702 | } |
| 703 | 703 | ||
| 704 | /* width must even because of the YUYV format | ||
| 705 | height must be even because of interlacing */ | ||
| 706 | height &= 0xfffe; | ||
| 707 | width &= 0xfffe; | ||
| 708 | |||
| 709 | if (unlikely(height < 32)) | ||
| 710 | height = 32; | ||
| 711 | if (unlikely(height > maxh)) | ||
| 712 | height = maxh; | ||
| 713 | if (unlikely(width < 48)) | ||
| 714 | width = 48; | ||
| 715 | if (unlikely(width > maxw)) | ||
| 716 | width = maxw; | ||
| 717 | |||
| 718 | if (dev->board.is_em2800) { | 704 | if (dev->board.is_em2800) { |
| 719 | /* the em2800 can only scale down to 50% */ | 705 | /* the em2800 can only scale down to 50% */ |
| 720 | if (height % (maxh / 2)) | 706 | height = height > (3 * maxh / 4) ? maxh : maxh / 2; |
| 721 | height = maxh; | 707 | width = width > (3 * maxw / 4) ? maxw : maxw / 2; |
| 722 | if (width % (maxw / 2)) | 708 | /* According to empiatech support the MaxPacketSize is too small |
| 723 | width = maxw; | 709 | * to support framesizes larger than 640x480 @ 30 fps or 640x576 |
| 724 | /* according to empiatech support */ | 710 | * @ 25 fps. As this would cut of a part of the image we prefer |
| 725 | /* the MaxPacketSize is to small to support */ | 711 | * 360x576 or 360x480 for now */ |
| 726 | /* framesizes larger than 640x480 @ 30 fps */ | ||
| 727 | /* or 640x576 @ 25 fps. As this would cut */ | ||
| 728 | /* of a part of the image we prefer */ | ||
| 729 | /* 360x576 or 360x480 for now */ | ||
| 730 | if (width == maxw && height == maxh) | 712 | if (width == maxw && height == maxh) |
| 731 | width /= 2; | 713 | width /= 2; |
| 714 | } else { | ||
| 715 | /* width must even because of the YUYV format | ||
| 716 | height must be even because of interlacing */ | ||
| 717 | v4l_bound_align_image(&width, 48, maxw, 1, &height, 32, maxh, 1, 0); | ||
| 732 | } | 718 | } |
| 733 | 719 | ||
| 734 | get_scale(dev, width, height, &hscale, &vscale); | 720 | get_scale(dev, width, height, &hscale, &vscale); |
