|
@@ -23,20 +23,22 @@ int cx8800_vbi_fmt (struct file *file, void *priv,
|
|
|
f->fmt.vbi.samples_per_line = VBI_LINE_LENGTH;
|
|
|
f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
|
|
|
f->fmt.vbi.offset = 244;
|
|
|
- f->fmt.vbi.count[0] = VBI_LINE_COUNT;
|
|
|
- f->fmt.vbi.count[1] = VBI_LINE_COUNT;
|
|
|
|
|
|
if (dev->core->tvnorm & V4L2_STD_525_60) {
|
|
|
/* ntsc */
|
|
|
f->fmt.vbi.sampling_rate = 28636363;
|
|
|
f->fmt.vbi.start[0] = 10;
|
|
|
f->fmt.vbi.start[1] = 273;
|
|
|
+ f->fmt.vbi.count[0] = VBI_LINE_NTSC_COUNT;
|
|
|
+ f->fmt.vbi.count[1] = VBI_LINE_NTSC_COUNT;
|
|
|
|
|
|
} else if (dev->core->tvnorm & V4L2_STD_625_50) {
|
|
|
/* pal */
|
|
|
f->fmt.vbi.sampling_rate = 35468950;
|
|
|
- f->fmt.vbi.start[0] = 7 -1;
|
|
|
- f->fmt.vbi.start[1] = 319 -1;
|
|
|
+ f->fmt.vbi.start[0] = V4L2_VBI_ITU_625_F1_START + 5;
|
|
|
+ f->fmt.vbi.start[1] = V4L2_VBI_ITU_625_F2_START + 5;
|
|
|
+ f->fmt.vbi.count[0] = VBI_LINE_PAL_COUNT;
|
|
|
+ f->fmt.vbi.count[1] = VBI_LINE_PAL_COUNT;
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
@@ -111,8 +113,13 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
|
|
|
unsigned int *num_buffers, unsigned int *num_planes,
|
|
|
unsigned int sizes[], void *alloc_ctxs[])
|
|
|
{
|
|
|
+ struct cx8800_dev *dev = q->drv_priv;
|
|
|
+
|
|
|
*num_planes = 1;
|
|
|
- sizes[0] = VBI_LINE_COUNT * VBI_LINE_LENGTH * 2;
|
|
|
+ if (dev->core->tvnorm & V4L2_STD_525_60)
|
|
|
+ sizes[0] = VBI_LINE_NTSC_COUNT * VBI_LINE_LENGTH * 2;
|
|
|
+ else
|
|
|
+ sizes[0] = VBI_LINE_PAL_COUNT * VBI_LINE_LENGTH * 2;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -122,10 +129,15 @@ static int buffer_prepare(struct vb2_buffer *vb)
|
|
|
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
|
|
|
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
|
|
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
|
|
+ unsigned int lines;
|
|
|
unsigned int size;
|
|
|
int rc;
|
|
|
|
|
|
- size = VBI_LINE_COUNT * VBI_LINE_LENGTH * 2;
|
|
|
+ if (dev->core->tvnorm & V4L2_STD_525_60)
|
|
|
+ lines = VBI_LINE_NTSC_COUNT;
|
|
|
+ else
|
|
|
+ lines = VBI_LINE_PAL_COUNT;
|
|
|
+ size = lines * VBI_LINE_LENGTH * 2;
|
|
|
if (vb2_plane_size(vb, 0) < size)
|
|
|
return -EINVAL;
|
|
|
vb2_set_plane_payload(vb, 0, size);
|
|
@@ -135,9 +147,9 @@ static int buffer_prepare(struct vb2_buffer *vb)
|
|
|
return -EIO;
|
|
|
|
|
|
cx88_risc_buffer(dev->pci, &buf->risc, sgt->sgl,
|
|
|
- 0, VBI_LINE_LENGTH * VBI_LINE_COUNT,
|
|
|
+ 0, VBI_LINE_LENGTH * lines,
|
|
|
VBI_LINE_LENGTH, 0,
|
|
|
- VBI_LINE_COUNT);
|
|
|
+ lines);
|
|
|
return 0;
|
|
|
}
|
|
|
|