aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-10-12 11:39:36 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-22 10:01:46 -0400
commit34ca7d3791c6a467ff6810a149bdf78be086c23a (patch)
tree60021022df00a9e1639659ac81a01ff0e2dbe943 /drivers/media
parent6659e3ed559db2e730947268f9d57869b7a9016c (diff)
V4L/DVB (6341): ivtv: fix resizing MPEG1 streams
Resizing an MPEG 1 stream would cut off the right half of the image due to a missing divide by 2 in VIDIOC_S_FMT. Also did some minor cleanup in this part of the code. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index 206eee7542db..fd6826f472e3 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -555,6 +555,7 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype,
555 555
556 /* set window size */ 556 /* set window size */
557 if (fmt->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { 557 if (fmt->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
558 struct cx2341x_mpeg_params *p = &itv->params;
558 int w = fmt->fmt.pix.width; 559 int w = fmt->fmt.pix.width;
559 int h = fmt->fmt.pix.height; 560 int h = fmt->fmt.pix.height;
560 561
@@ -566,17 +567,19 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype,
566 fmt->fmt.pix.width = w; 567 fmt->fmt.pix.width = w;
567 fmt->fmt.pix.height = h; 568 fmt->fmt.pix.height = h;
568 569
569 if (!set_fmt || (itv->params.width == w && itv->params.height == h)) 570 if (!set_fmt || (p->width == w && p->height == h))
570 return 0; 571 return 0;
571 if (atomic_read(&itv->capturing) > 0) 572 if (atomic_read(&itv->capturing) > 0)
572 return -EBUSY; 573 return -EBUSY;
573 574
574 itv->params.width = w; 575 p->width = w;
575 itv->params.height = h; 576 p->height = h;
576 if (w != 720 || h != (itv->is_50hz ? 576 : 480)) 577 if (w != 720 || h != (itv->is_50hz ? 576 : 480))
577 itv->params.video_temporal_filter = 0; 578 p->video_temporal_filter = 0;
578 else 579 else
579 itv->params.video_temporal_filter = 8; 580 p->video_temporal_filter = 8;
581 if (p->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1)
582 fmt->fmt.pix.width /= 2;
580 itv->video_dec_func(itv, VIDIOC_S_FMT, fmt); 583 itv->video_dec_func(itv, VIDIOC_S_FMT, fmt);
581 return ivtv_get_fmt(itv, streamtype, fmt); 584 return ivtv_get_fmt(itv, streamtype, fmt);
582 } 585 }