diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-06-21 11:22:19 +0200 |
---|---|---|
committer | Hans Verkuil <hverkuil@xs4all.nl> | 2008-06-21 11:22:19 +0200 |
commit | 68aca1081b2f3894edb2e49a5effc9d502b02d44 (patch) | |
tree | b828ca3086969afc37a365559a23c0fe019f5a97 /linux/drivers/media/video/cx18/cx18-ioctl.c | |
parent | 06e3b9b0bdf9034084ee98819fa971ead4812e11 (diff) | |
download | mediapointer-dvb-s2-68aca1081b2f3894edb2e49a5effc9d502b02d44.tar.gz mediapointer-dvb-s2-68aca1081b2f3894edb2e49a5effc9d502b02d44.tar.bz2 |
cx18: make sure all v4l2_format fields are filled in
From: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/drivers/media/video/cx18/cx18-ioctl.c')
-rw-r--r-- | linux/drivers/media/video/cx18/cx18-ioctl.c | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/linux/drivers/media/video/cx18/cx18-ioctl.c b/linux/drivers/media/video/cx18/cx18-ioctl.c index 7d901429f..fc4cfbdcd 100644 --- a/linux/drivers/media/video/cx18/cx18-ioctl.c +++ b/linux/drivers/media/video/cx18/cx18-ioctl.c @@ -152,22 +152,24 @@ static int cx18_g_fmt_vid_cap(struct file *file, void *fh, { struct cx18_open_id *id = fh; struct cx18 *cx = id->cx; + struct v4l2_pix_format *pixfmt = &fmt->fmt.pix; - CX18_DEBUG_IOCTL("VIDIOC_G_FMT: V4L2_BUF_TYPE_VIDEO_CAPTURE\n"); - - fmt->fmt.pix.width = cx->params.width; - fmt->fmt.pix.height = cx->params.height; - fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; - fmt->fmt.pix.field = V4L2_FIELD_INTERLACED; + pixfmt->width = cx->params.width; + pixfmt->height = cx->params.height; + pixfmt->colorspace = V4L2_COLORSPACE_SMPTE170M; + pixfmt->field = V4L2_FIELD_INTERLACED; + pixfmt->priv = 0; if (id->type == CX18_ENC_STREAM_TYPE_YUV) { - fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_HM12; + pixfmt->pixelformat = V4L2_PIX_FMT_HM12; /* YUV size is (Y=(h*w) + UV=(h*(w/2))) */ - fmt->fmt.pix.sizeimage = - fmt->fmt.pix.height * fmt->fmt.pix.width + - fmt->fmt.pix.height * (fmt->fmt.pix.width / 2); + pixfmt->sizeimage = + pixfmt->height * pixfmt->width + + pixfmt->height * (pixfmt->width / 2); + pixfmt->bytesperline = 720; } else { - fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; - fmt->fmt.pix.sizeimage = 128 * 1024; + pixfmt->pixelformat = V4L2_PIX_FMT_MPEG; + pixfmt->sizeimage = 128 * 1024; + pixfmt->bytesperline = 0; } return 0; } @@ -176,16 +178,20 @@ static int cx18_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) { struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; + struct v4l2_vbi_format *vbifmt = &fmt->fmt.vbi; CX18_DEBUG_IOCTL("VIDIOC_G_FMT: V4L2_BUF_TYPE_VBI_CAPTURE\n"); - fmt->fmt.vbi.sampling_rate = 27000000; - fmt->fmt.vbi.offset = 248; - fmt->fmt.vbi.samples_per_line = cx->vbi.raw_decoder_line_size - 4; - fmt->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; - fmt->fmt.vbi.start[0] = cx->vbi.start[0]; - fmt->fmt.vbi.start[1] = cx->vbi.start[1]; - fmt->fmt.vbi.count[0] = fmt->fmt.vbi.count[1] = cx->vbi.count; + vbifmt->sampling_rate = 27000000; + vbifmt->offset = 248; + vbifmt->samples_per_line = cx->vbi.raw_decoder_line_size - 4; + vbifmt->sample_format = V4L2_PIX_FMT_GREY; + vbifmt->start[0] = cx->vbi.start[0]; + vbifmt->start[1] = cx->vbi.start[1]; + vbifmt->count[0] = vbifmt->count[1] = cx->vbi.count; + vbifmt->flags = 0; + vbifmt->reserved[0] = 0; + vbifmt->reserved[1] = 0; return 0; } @@ -199,8 +205,9 @@ static int cx18_g_fmt_sliced_vbi_cap(struct file *file, void *fh, CX18_DEBUG_IOCTL("VIDIOC_G_FMT: V4L2_BUF_TYPE_SLICED_VBI_CAPTURE\n"); + vbifmt->reserved[0] = 0; + vbifmt->reserved[1] = 0; vbifmt->io_size = sizeof(struct v4l2_sliced_vbi_data) * 36; - memset(vbifmt->reserved, 0, sizeof(vbifmt->reserved)); memset(vbifmt->service_lines, 0, sizeof(vbifmt->service_lines)); cx18_av_cmd(cx, VIDIOC_G_FMT, fmt); @@ -253,7 +260,8 @@ static int cx18_try_fmt_sliced_vbi_cap(struct file *file, void *fh, CX18_DEBUG_IOCTL("VIDIOC_TRY_FMT: V4L2_BUF_TYPE_SLICED_VBI_CAPTURE\n"); vbifmt->io_size = sizeof(struct v4l2_sliced_vbi_data) * 36; - memset(vbifmt->reserved, 0, sizeof(vbifmt->reserved)); + vbifmt->reserved[0] = 0; + vbifmt->reserved[1] = 0; if (vbifmt->service_set) cx18_expand_service_set(vbifmt, cx->is_50hz); |