Skip to content

Commit

Permalink
V4L/DVB (10444): cx18: Fix sliced VBI PTS and fix artifacts in last r…
Browse files Browse the repository at this point in the history
…aw 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>
  • Loading branch information
Andy Walls authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent f37aa51 commit 01cbc21
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions drivers/media/video/cx18/cx18-vbi.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf,
if (streamtype != CX18_ENC_STREAM_TYPE_VBI)
return;

/*
* The CX23418 sends us data that is 32 bit LE swapped, but we want
* the raw VBI bytes in the order they were in the raster line
*/
cx18_buf_swap(buf);

/*
Expand All @@ -190,17 +194,27 @@ void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf,
if (cx18_raw_vbi(cx)) {
u8 type;

/* Skip 12 bytes of header that gets stuffed in */
/*
* We've set up to get a field's worth of VBI data at a time.
* Skip 12 bytes of header prefixing the first field or the
* last 12 bytes in the last VBI line from the first field that
* prefixes the second field.
*/
size -= 12;
memcpy(p, &buf->buf[12], size);
type = p[3];

/* Extrapolate the last 12 bytes of the field's last line */
memset(&p[size], (int) p[size - 1], 12);

size = buf->bytesused = compress_raw_buf(cx, p, size);

/* second field of the frame? */
if (type == raw_vbi_sav_rp[1]) {
/* Dirty hack needed for backwards
compatibility of old VBI software. */
/*
* Hack needed for compatibility with old VBI software.
* Write the frame # at the end of the last line of the
* second field
*/
p += size - 4;
memcpy(p, &cx->vbi.frame, 4);
cx->vbi.frame++;
Expand All @@ -210,7 +224,7 @@ void cx18_process_vbi_data(struct cx18 *cx, struct cx18_buffer *buf,

/* Sliced VBI data with data insertion */

pts = (q[0] == 0x3fffffff) ? q[2] : 0;
pts = (be32_to_cpu(q[0] == 0x3fffffff)) ? be32_to_cpu(q[2]) : 0;

/* first field */
/* compress_sliced_buf() will skip the 12 bytes of header */
Expand Down

0 comments on commit 01cbc21

Please sign in to comment.