Commit 776fa869 authored by Andy Walls's avatar Andy Walls Committed by Mauro Carvalho Chehab

V4L/DVB (10440): cx18: Fix presentation timestamp (PTS) for VBI buffers

The old code from ivtv used a CX23415/6 PTS, which was simply left at 0 in the
cx18 driver.  Since the CX23418 gives us what I think is a PTS (or some other
90 kHz clock count) with each VBI buffer, this change has the cx18 driver use
that as a PTS.
Signed-off-by: default avatarAndy Walls <awalls@radix.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 302df970
...@@ -293,7 +293,6 @@ struct cx18_stream { ...@@ -293,7 +293,6 @@ struct cx18_stream {
int dma; /* can be PCI_DMA_TODEVICE, int dma; /* can be PCI_DMA_TODEVICE,
PCI_DMA_FROMDEVICE or PCI_DMA_FROMDEVICE or
PCI_DMA_NONE */ PCI_DMA_NONE */
u64 dma_pts;
wait_queue_head_t waitq; wait_queue_head_t waitq;
/* Buffer Stats */ /* Buffer Stats */
......
...@@ -188,7 +188,6 @@ static struct cx18_buffer *cx18_get_buffer(struct cx18_stream *s, int non_block, ...@@ -188,7 +188,6 @@ static struct cx18_buffer *cx18_get_buffer(struct cx18_stream *s, int non_block,
while ((buf = cx18_dequeue(s_vbi, &s_vbi->q_full))) { while ((buf = cx18_dequeue(s_vbi, &s_vbi->q_full))) {
/* byteswap and process VBI data */ /* byteswap and process VBI data */
cx18_process_vbi_data(cx, buf, cx18_process_vbi_data(cx, buf,
s_vbi->dma_pts,
s_vbi->type); s_vbi->type);
cx18_stream_put_buf_fw(s_vbi, buf); cx18_stream_put_buf_fw(s_vbi, buf);
} }
...@@ -209,8 +208,7 @@ static struct cx18_buffer *cx18_get_buffer(struct cx18_stream *s, int non_block, ...@@ -209,8 +208,7 @@ static struct cx18_buffer *cx18_get_buffer(struct cx18_stream *s, int non_block,
cx18_buf_swap(buf); cx18_buf_swap(buf);
else { else {
/* byteswap and process VBI data */ /* byteswap and process VBI data */
cx18_process_vbi_data(cx, buf, cx18_process_vbi_data(cx, buf, s->type);
s->dma_pts, s->type);
} }
return buf; return buf;
} }
......
...@@ -168,27 +168,28 @@ static u32 compress_sliced_buf(struct cx18 *cx, u32 line, u8 *buf, ...@@ -168,27 +168,28 @@ static u32 compress_sliced_buf(struct cx18 *cx, u32 line, u8 *buf,
} }
void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf, void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf,
u64 pts_stamp, int streamtype) int streamtype)
{ {
u8 *p = (u8 *) buf->buf; u8 *p = (u8 *) buf->buf;
u32 *q = (u32 *) buf->buf;
u32 size = buf->bytesused; u32 size = buf->bytesused;
u32 pts;
int lines; int lines;
if (streamtype != CX18_ENC_STREAM_TYPE_VBI) if (streamtype != CX18_ENC_STREAM_TYPE_VBI)
return; return;
cx18_buf_swap(buf);
/* /*
* Note the CX23418 provides a 12 byte header, in it's raw VBI * The CX23418 provides a 12 byte header in it's raw VBI buffers to us:
* buffers to us, that we currently throw away: * 0x3fffffff [4 bytes of something] [4 byte presentation time stamp?]
* 0x3fffffff [4 bytes of something] [4 byte timestamp]
*/ */
/* Raw VBI data */ /* Raw VBI data */
if (cx18_raw_vbi(cx)) { if (cx18_raw_vbi(cx)) {
u8 type; u8 type;
cx18_buf_swap(buf);
/* Skip 12 bytes of header that gets stuffed in */ /* Skip 12 bytes of header that gets stuffed in */
size -= 12; size -= 12;
memcpy(p, &buf->buf[12], size); memcpy(p, &buf->buf[12], size);
...@@ -208,7 +209,8 @@ void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf, ...@@ -208,7 +209,8 @@ void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf,
} }
/* Sliced VBI data with data insertion */ /* Sliced VBI data with data insertion */
cx18_buf_swap(buf);
pts = (q[0] == 0x3fffffff) ? q[2] : 0;
/* first field */ /* first field */
/* compress_sliced_buf() will skip the 12 bytes of header */ /* compress_sliced_buf() will skip the 12 bytes of header */
...@@ -230,6 +232,6 @@ void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf, ...@@ -230,6 +232,6 @@ void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf,
memcpy(p, &cx->vbi.sliced_data[0], size); memcpy(p, &cx->vbi.sliced_data[0], size);
if (cx->vbi.insert_mpeg) if (cx->vbi.insert_mpeg)
copy_vbi_data(cx, lines, pts_stamp); copy_vbi_data(cx, lines, pts);
cx->vbi.frame++; cx->vbi.frame++;
} }
...@@ -22,5 +22,5 @@ ...@@ -22,5 +22,5 @@
*/ */
void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf, void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf,
u64 pts_stamp, int streamtype); int streamtype);
int cx18_used_line(struct cx18 *cx, int line, int field); int cx18_used_line(struct cx18 *cx, int line, int field);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment