From db11fa1dc7e82affbdd3bd220aded900d930f225 Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Sat, 7 Feb 2009 01:31:22 -0300 Subject: [PATCH] --- yaml --- r: 137831 b: refs/heads/master c: 01cbc214cfa6e0dbfaea617d32d6d66e7f6608ff h: refs/heads/master i: 137829: 411207865d8f3e4f7c615c9828e4fe3c9709ead0 137827: 60af83b604457a5916b0ff135efb9abe20f2b71f 137823: 15742b256b0699c6904f6a6c60fd71d12d4a3a3c v: v3 --- [refs] | 2 +- trunk/drivers/media/video/cx18/cx18-vbi.c | 24 ++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 9c99d637af94..4099d1270254 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f37aa51190c4391005bb71c92cd976f811500105 +refs/heads/master: 01cbc214cfa6e0dbfaea617d32d6d66e7f6608ff diff --git a/trunk/drivers/media/video/cx18/cx18-vbi.c b/trunk/drivers/media/video/cx18/cx18-vbi.c index d6e15e119582..d8e7d371c8e2 100644 --- a/trunk/drivers/media/video/cx18/cx18-vbi.c +++ b/trunk/drivers/media/video/cx18/cx18-vbi.c @@ -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); /* @@ -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++; @@ -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 */