aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-vbi.c
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/cx18/cx18-vbi.c
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/cx18/cx18-vbi.c')
-rw-r--r--drivers/media/video/cx18/cx18-vbi.c18
1 files changed, 10 insertions, 8 deletions
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}