aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-vbi.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2009-02-06 23:31:22 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:39 -0400
commit01cbc214cfa6e0dbfaea617d32d6d66e7f6608ff (patch)
tree8454aaaeec2c490cf2063bcf7a44573a5f1074f1 /drivers/media/video/cx18/cx18-vbi.c
parentf37aa51190c4391005bb71c92cd976f811500105 (diff)
V4L/DVB (10444): cx18: Fix sliced VBI PTS and fix artifacts in last raw line of field
Fixed an endianess problem with the collection of the PTS from the VBI buffer given to us by the encoder. Also extrapolated the last 12 bytes of the last line of each field, to remove artifacts created by removing the first 12 bytes of each field for raw VBI. 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.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/media/video/cx18/cx18-vbi.c b/drivers/media/video/cx18/cx18-vbi.c
index d6e15e119582..d8e7d371c8e2 100644
--- a/drivers/media/video/cx18/cx18-vbi.c
+++ b/drivers/media/video/cx18/cx18-vbi.c
@@ -179,6 +179,10 @@ void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf,
179 if (streamtype != CX18_ENC_STREAM_TYPE_VBI) 179 if (streamtype != CX18_ENC_STREAM_TYPE_VBI)
180 return; 180 return;
181 181
182 /*
183 * The CX23418 sends us data that is 32 bit LE swapped, but we want
184 * the raw VBI bytes in the order they were in the raster line
185 */
182 cx18_buf_swap(buf); 186 cx18_buf_swap(buf);
183 187
184 /* 188 /*
@@ -190,17 +194,27 @@ void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf,
190 if (cx18_raw_vbi(cx)) { 194 if (cx18_raw_vbi(cx)) {
191 u8 type; 195 u8 type;
192 196
193 /* Skip 12 bytes of header that gets stuffed in */ 197 /*
198 * We've set up to get a field's worth of VBI data at a time.
199 * Skip 12 bytes of header prefixing the first field or the
200 * last 12 bytes in the last VBI line from the first field that
201 * prefixes the second field.
202 */
194 size -= 12; 203 size -= 12;
195 memcpy(p, &buf->buf[12], size); 204 memcpy(p, &buf->buf[12], size);
196 type = p[3]; 205 type = p[3];
197 206
207 /* Extrapolate the last 12 bytes of the field's last line */
208 memset(&p[size], (int) p[size - 1], 12);
209
198 size = buf->bytesused = compress_raw_buf(cx, p, size); 210 size = buf->bytesused = compress_raw_buf(cx, p, size);
199 211
200 /* second field of the frame? */
201 if (type == raw_vbi_sav_rp[1]) { 212 if (type == raw_vbi_sav_rp[1]) {
202 /* Dirty hack needed for backwards 213 /*
203 compatibility of old VBI software. */ 214 * Hack needed for compatibility with old VBI software.
215 * Write the frame # at the end of the last line of the
216 * second field
217 */
204 p += size - 4; 218 p += size - 4;
205 memcpy(p, &cx->vbi.frame, 4); 219 memcpy(p, &cx->vbi.frame, 4);
206 cx->vbi.frame++; 220 cx->vbi.frame++;
@@ -210,7 +224,7 @@ void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf,
210 224
211 /* Sliced VBI data with data insertion */ 225 /* Sliced VBI data with data insertion */
212 226
213 pts = (q[0] == 0x3fffffff) ? q[2] : 0; 227 pts = (be32_to_cpu(q[0] == 0x3fffffff)) ? be32_to_cpu(q[2]) : 0;
214 228
215 /* first field */ 229 /* first field */
216 /* compress_sliced_buf() will skip the 12 bytes of header */ 230 /* compress_sliced_buf() will skip the 12 bytes of header */