[media] bttv: fix field handling inside TRY_FMT
- don't return -EINVAL for invalid field types, handle those as if it was FIELD_ANY. - the handling of FIELD_SEQ_BT/TB was wrong as well: if such field formats aren't supported, then fall back to FIELD_ANY instead of returning an error. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
a12fd70e3b
commit
ee70e3d803
1 changed files with 12 additions and 16 deletions
|
@ -2530,6 +2530,7 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv,
|
||||||
struct bttv *btv = fh->btv;
|
struct bttv *btv = fh->btv;
|
||||||
enum v4l2_field field;
|
enum v4l2_field field;
|
||||||
__s32 width, height;
|
__s32 width, height;
|
||||||
|
__s32 height2;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
fmt = format_by_fourcc(f->fmt.pix.pixelformat);
|
fmt = format_by_fourcc(f->fmt.pix.pixelformat);
|
||||||
|
@ -2538,30 +2539,25 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv,
|
||||||
|
|
||||||
field = f->fmt.pix.field;
|
field = f->fmt.pix.field;
|
||||||
|
|
||||||
if (V4L2_FIELD_ANY == field) {
|
|
||||||
__s32 height2;
|
|
||||||
|
|
||||||
height2 = btv->crop[!!fh->do_crop].rect.height >> 1;
|
|
||||||
field = (f->fmt.pix.height > height2)
|
|
||||||
? V4L2_FIELD_INTERLACED
|
|
||||||
: V4L2_FIELD_BOTTOM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (V4L2_FIELD_SEQ_BT == field)
|
|
||||||
field = V4L2_FIELD_SEQ_TB;
|
|
||||||
|
|
||||||
switch (field) {
|
switch (field) {
|
||||||
case V4L2_FIELD_TOP:
|
case V4L2_FIELD_TOP:
|
||||||
case V4L2_FIELD_BOTTOM:
|
case V4L2_FIELD_BOTTOM:
|
||||||
case V4L2_FIELD_ALTERNATE:
|
case V4L2_FIELD_ALTERNATE:
|
||||||
case V4L2_FIELD_INTERLACED:
|
case V4L2_FIELD_INTERLACED:
|
||||||
break;
|
break;
|
||||||
|
case V4L2_FIELD_SEQ_BT:
|
||||||
case V4L2_FIELD_SEQ_TB:
|
case V4L2_FIELD_SEQ_TB:
|
||||||
if (fmt->flags & FORMAT_FLAGS_PLANAR)
|
if (!(fmt->flags & FORMAT_FLAGS_PLANAR)) {
|
||||||
return -EINVAL;
|
field = V4L2_FIELD_SEQ_TB;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* fall through */
|
||||||
|
default: /* FIELD_ANY case */
|
||||||
|
height2 = btv->crop[!!fh->do_crop].rect.height >> 1;
|
||||||
|
field = (f->fmt.pix.height > height2)
|
||||||
|
? V4L2_FIELD_INTERLACED
|
||||||
|
: V4L2_FIELD_BOTTOM;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
width = f->fmt.pix.width;
|
width = f->fmt.pix.width;
|
||||||
|
|
Loading…
Add table
Reference in a new issue