aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2009-02-01 19:42:12 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:38 -0400
commit776fa869883e60a065df13e73252344477c8e1aa (patch)
treefc02abc35163d8494345a53253b9984cf3d73b86 /drivers/media/video
parent302df9702192a68578916ef922c33370cbba350d (diff)
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: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/cx18/cx18-driver.h1
-rw-r--r--drivers/media/video/cx18/cx18-fileops.c4
-rw-r--r--drivers/media/video/cx18/cx18-vbi.c18
-rw-r--r--drivers/media/video/cx18/cx18-vbi.h2
4 files changed, 12 insertions, 13 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index a41d9c4178f0..c9b6df50ab27 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -293,7 +293,6 @@ struct cx18_stream {
293 int dma; /* can be PCI_DMA_TODEVICE, 293 int dma; /* can be PCI_DMA_TODEVICE,
294 PCI_DMA_FROMDEVICE or 294 PCI_DMA_FROMDEVICE or
295 PCI_DMA_NONE */ 295 PCI_DMA_NONE */
296 u64 dma_pts;
297 wait_queue_head_t waitq; 296 wait_queue_head_t waitq;
298 297
299 /* Buffer Stats */ 298 /* Buffer Stats */
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c
index 0b1dbc67e1ab..68dd50ac4bfe 100644
--- a/drivers/media/video/cx18/cx18-fileops.c
+++ b/drivers/media/video/cx18/cx18-fileops.c
@@ -188,7 +188,6 @@ static struct cx18_buffer *cx18_get_buffer(struct cx18_stream *s, int non_block,
188 while ((buf = cx18_dequeue(s_vbi, &s_vbi->q_full))) { 188 while ((buf = cx18_dequeue(s_vbi, &s_vbi->q_full))) {
189 /* byteswap and process VBI data */ 189 /* byteswap and process VBI data */
190 cx18_process_vbi_data(cx, buf, 190 cx18_process_vbi_data(cx, buf,
191 s_vbi->dma_pts,
192 s_vbi->type); 191 s_vbi->type);
193 cx18_stream_put_buf_fw(s_vbi, buf); 192 cx18_stream_put_buf_fw(s_vbi, buf);
194 } 193 }
@@ -209,8 +208,7 @@ static struct cx18_buffer *cx18_get_buffer(struct cx18_stream *s, int non_block,
209 cx18_buf_swap(buf); 208 cx18_buf_swap(buf);
210 else { 209 else {
211 /* byteswap and process VBI data */ 210 /* byteswap and process VBI data */
212 cx18_process_vbi_data(cx, buf, 211 cx18_process_vbi_data(cx, buf, s->type);
213 s->dma_pts, s->type);
214 } 212 }
215 return buf; 213 return buf;
216 } 214 }
diff --git a/drivers/media/video/cx18/cx18-vbi.c b/drivers/media/video/cx18/cx18-vbi.c
index 38d26c42e4cb..d6e15e119582 100644
--- a/drivers/media/video/cx18/cx18-vbi.c
+++ b/drivers/media/video/cx18/cx18-vbi.c
@@ -168,27 +168,28 @@ static u32 compress_sliced_buf(struct cx18 *cx, u32 line, u8 *buf,
168} 168}
169 169
170void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf, 170void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf,
171 u64 pts_stamp, int streamtype) 171 int streamtype)
172{ 172{
173 u8 *p = (u8 *) buf->buf; 173 u8 *p = (u8 *) buf->buf;
174 u32 *q = (u32 *) buf->buf;
174 u32 size = buf->bytesused; 175 u32 size = buf->bytesused;
176 u32 pts;
175 int lines; 177 int lines;
176 178
177 if (streamtype != CX18_ENC_STREAM_TYPE_VBI) 179 if (streamtype != CX18_ENC_STREAM_TYPE_VBI)
178 return; 180 return;
179 181
182 cx18_buf_swap(buf);
183
180 /* 184 /*
181 * Note the CX23418 provides a 12 byte header, in it's raw VBI 185 * The CX23418 provides a 12 byte header in it's raw VBI buffers to us:
182 * buffers to us, that we currently throw away: 186 * 0x3fffffff [4 bytes of something] [4 byte presentation time stamp?]
183 * 0x3fffffff [4 bytes of something] [4 byte timestamp]
184 */ 187 */
185 188
186 /* Raw VBI data */ 189 /* Raw VBI data */
187 if (cx18_raw_vbi(cx)) { 190 if (cx18_raw_vbi(cx)) {
188 u8 type; 191 u8 type;
189 192
190 cx18_buf_swap(buf);
191
192 /* Skip 12 bytes of header that gets stuffed in */ 193 /* Skip 12 bytes of header that gets stuffed in */
193 size -= 12; 194 size -= 12;
194 memcpy(p, &buf->buf[12], size); 195 memcpy(p, &buf->buf[12], size);
@@ -208,7 +209,8 @@ void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf,
208 } 209 }
209 210
210 /* Sliced VBI data with data insertion */ 211 /* Sliced VBI data with data insertion */
211 cx18_buf_swap(buf); 212
213 pts = (q[0] == 0x3fffffff) ? q[2] : 0;
212 214
213 /* first field */ 215 /* first field */
214 /* compress_sliced_buf() will skip the 12 bytes of header */ 216 /* 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 memcpy(p, &cx->vbi.sliced_data[0], size); 232 memcpy(p, &cx->vbi.sliced_data[0], size);
231 233
232 if (cx->vbi.insert_mpeg) 234 if (cx->vbi.insert_mpeg)
233 copy_vbi_data(cx, lines, pts_stamp); 235 copy_vbi_data(cx, lines, pts);
234 cx->vbi.frame++; 236 cx->vbi.frame++;
235} 237}
diff --git a/drivers/media/video/cx18/cx18-vbi.h b/drivers/media/video/cx18/cx18-vbi.h
index c56ff7d28f20..e7e1ae427f34 100644
--- a/drivers/media/video/cx18/cx18-vbi.h
+++ b/drivers/media/video/cx18/cx18-vbi.h
@@ -22,5 +22,5 @@
22 */ 22 */
23 23
24void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf, 24void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf,
25 u64 pts_stamp, int streamtype); 25 int streamtype);
26int cx18_used_line(struct cx18 *cx, int line, int field); 26int cx18_used_line(struct cx18 *cx, int line, int field);