diff options
author | Pantelis Koukousoulas <pakt223@freemail.gr> | 2007-01-19 23:59:54 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-02-21 10:34:42 -0500 |
commit | fd69496461050296fb0fdd9acf6d789d27a0ef44 (patch) | |
tree | dad1c689e886bc030b95342e140c5e198cf92d36 /drivers/media/video/pvrusb2/pvrusb2-v4l2.c | |
parent | 848ed3ca2a4eb85d6c6bde2a1b254b1f4c658e02 (diff) |
V4L/DVB (5095): Pvrusb2: Allow VIDIOC_S_FMT with -1 for resolution values
With the previous patch, mplayer started but was polling the video
device forever without any video actually coming out. Further analysis
showed that it does a VIDIOC_S_FMT with width and height set to -1 (!!!).
The code handling this only cares that both are lower than the minimum
range allowed so it ends up setting the size to 19x17 (!!) This pretty
much breaks the encoder here. Even if this breakage is yet another (TM)
result of my setup, setting the size to 19x17 by default would surprise
most users IMHO.
So, special case for -1 and interpret this to be a request for the
default size, please. Users can then set their favorite size both
through mplayer and through sysfs.
With this patch, mplayer finally works in pvr:// mode (not that we
really gain anything over operating it through sysfs with lirc,
sometime I might actually get off my lazy a** and contribute this
setup too)
Signed-off-by: Pantelis Koukousoulas <pakt223@freemail.gr>
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-v4l2.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index a728ca2a37d..53323c338a6 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c | |||
@@ -498,7 +498,7 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, | |||
498 | ret = 0; | 498 | ret = 0; |
499 | switch(vf->type) { | 499 | switch(vf->type) { |
500 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: { | 500 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: { |
501 | int lmin,lmax; | 501 | int lmin,lmax,ldef; |
502 | struct pvr2_ctrl *hcp,*vcp; | 502 | struct pvr2_ctrl *hcp,*vcp; |
503 | int h = vf->fmt.pix.height; | 503 | int h = vf->fmt.pix.height; |
504 | int w = vf->fmt.pix.width; | 504 | int w = vf->fmt.pix.width; |
@@ -507,14 +507,20 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, | |||
507 | 507 | ||
508 | lmin = pvr2_ctrl_get_min(hcp); | 508 | lmin = pvr2_ctrl_get_min(hcp); |
509 | lmax = pvr2_ctrl_get_max(hcp); | 509 | lmax = pvr2_ctrl_get_max(hcp); |
510 | if (w < lmin) { | 510 | ldef = pvr2_ctrl_get_def(hcp); |
511 | if (w == -1) { | ||
512 | w = ldef; | ||
513 | } else if (w < lmin) { | ||
511 | w = lmin; | 514 | w = lmin; |
512 | } else if (w > lmax) { | 515 | } else if (w > lmax) { |
513 | w = lmax; | 516 | w = lmax; |
514 | } | 517 | } |
515 | lmin = pvr2_ctrl_get_min(vcp); | 518 | lmin = pvr2_ctrl_get_min(vcp); |
516 | lmax = pvr2_ctrl_get_max(vcp); | 519 | lmax = pvr2_ctrl_get_max(vcp); |
517 | if (h < lmin) { | 520 | ldef = pvr2_ctrl_get_def(vcp); |
521 | if (h == -1) { | ||
522 | h = ldef; | ||
523 | } else if (h < lmin) { | ||
518 | h = lmin; | 524 | h = lmin; |
519 | } else if (h > lmax) { | 525 | } else if (h > lmax) { |
520 | h = lmax; | 526 | h = lmax; |