aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-09-06 08:56:17 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:36:59 -0400
commit854ad9abcc7c1aa143d1a18409d4f366d4326a80 (patch)
treee1b09264f5c0a786d3330849f53ee0ed4ebde2c8 /drivers
parenteffc3466d32108bec7da19aa23c1fddee9cafbab (diff)
V4L/DVB (8921): ivtv: fix incorrect capability and assorted sliced vbi and video out fmt fixes
- V4L2_CAP_VBI_OUTPUT is not supported by ivtv, remove it. - ivtv_try_fmt_vid_out also needed to constrain the width/height of MPEG decoder window sizes. - allow empty sliced services. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/ivtv/ivtv-cards.h2
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c22
2 files changed, 10 insertions, 14 deletions
diff --git a/drivers/media/video/ivtv/ivtv-cards.h b/drivers/media/video/ivtv/ivtv-cards.h
index 381af1bceef8..0b8fe85fb697 100644
--- a/drivers/media/video/ivtv/ivtv-cards.h
+++ b/drivers/media/video/ivtv/ivtv-cards.h
@@ -154,7 +154,7 @@
154#define IVTV_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \ 154#define IVTV_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \
155 V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \ 155 V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \
156 V4L2_CAP_SLICED_VBI_CAPTURE) 156 V4L2_CAP_SLICED_VBI_CAPTURE)
157#define IVTV_CAP_DECODER (V4L2_CAP_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT | \ 157#define IVTV_CAP_DECODER (V4L2_CAP_VIDEO_OUTPUT | \
158 V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY) 158 V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY)
159 159
160struct ivtv_card_video_input { 160struct ivtv_card_video_input {
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index e67bf1b15cf3..f00854ad64ea 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -101,18 +101,15 @@ void ivtv_expand_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal)
101 } 101 }
102} 102}
103 103
104static int check_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal) 104static void check_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal)
105{ 105{
106 int f, l; 106 int f, l;
107 u16 set = 0;
108 107
109 for (f = 0; f < 2; f++) { 108 for (f = 0; f < 2; f++) {
110 for (l = 0; l < 24; l++) { 109 for (l = 0; l < 24; l++) {
111 fmt->service_lines[f][l] = select_service_from_set(f, l, fmt->service_lines[f][l], is_pal); 110 fmt->service_lines[f][l] = select_service_from_set(f, l, fmt->service_lines[f][l], is_pal);
112 set |= fmt->service_lines[f][l];
113 } 111 }
114 } 112 }
115 return set != 0;
116} 113}
117 114
118u16 ivtv_get_service_set(struct v4l2_sliced_vbi_format *fmt) 115u16 ivtv_get_service_set(struct v4l2_sliced_vbi_format *fmt)
@@ -474,7 +471,7 @@ static int ivtv_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format
474 int h = fmt->fmt.pix.height; 471 int h = fmt->fmt.pix.height;
475 472
476 w = min(w, 720); 473 w = min(w, 720);
477 w = max(w, 1); 474 w = max(w, 2);
478 h = min(h, itv->is_50hz ? 576 : 480); 475 h = min(h, itv->is_50hz ? 576 : 480);
479 h = max(h, 2); 476 h = max(h, 2);
480 ivtv_g_fmt_vid_cap(file, fh, fmt); 477 ivtv_g_fmt_vid_cap(file, fh, fmt);
@@ -512,18 +509,18 @@ static int ivtv_try_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_
512static int ivtv_try_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *fmt) 509static int ivtv_try_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *fmt)
513{ 510{
514 struct ivtv_open_id *id = fh; 511 struct ivtv_open_id *id = fh;
512 struct ivtv *itv = id->itv;
515 s32 w = fmt->fmt.pix.width; 513 s32 w = fmt->fmt.pix.width;
516 s32 h = fmt->fmt.pix.height; 514 s32 h = fmt->fmt.pix.height;
517 int field = fmt->fmt.pix.field; 515 int field = fmt->fmt.pix.field;
518 int ret = ivtv_g_fmt_vid_out(file, fh, fmt); 516 int ret = ivtv_g_fmt_vid_out(file, fh, fmt);
519 517
520 if (!ret && id->type == IVTV_DEC_STREAM_TYPE_YUV) { 518 w = min(w, 720);
519 w = max(w, 2);
520 h = min(h, itv->is_out_50hz ? 576 : 480);
521 h = max(h, 2);
522 if (id->type == IVTV_DEC_STREAM_TYPE_YUV)
521 fmt->fmt.pix.field = field; 523 fmt->fmt.pix.field = field;
522 w = min(w, 720);
523 w = max(w, 2);
524 h = min(h, 576);
525 h = max(h, 2);
526 }
527 fmt->fmt.pix.width = w; 524 fmt->fmt.pix.width = w;
528 fmt->fmt.pix.height = h; 525 fmt->fmt.pix.height = h;
529 return ret; 526 return ret;
@@ -593,8 +590,7 @@ static int ivtv_s_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_fo
593 if (ret || id->type == IVTV_DEC_STREAM_TYPE_VBI) 590 if (ret || id->type == IVTV_DEC_STREAM_TYPE_VBI)
594 return ret; 591 return ret;
595 592
596 if (check_service_set(vbifmt, itv->is_50hz) == 0) 593 check_service_set(vbifmt, itv->is_50hz);
597 return -EINVAL;
598 if (atomic_read(&itv->capturing) > 0) 594 if (atomic_read(&itv->capturing) > 0)
599 return -EBUSY; 595 return -EBUSY;
600 itv->video_dec_func(itv, VIDIOC_S_FMT, fmt); 596 itv->video_dec_func(itv, VIDIOC_S_FMT, fmt);