staticvoid ivtv_set_wss(struct ivtv *itv, int enabled, int mode)
{ struct v4l2_sliced_vbi_data data;
if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) return; /* When using a 50 Hz system, always turn on the wide screen signal with 4x3 ratio as the default. Turning this signal on and off can confuse certain TVs. As far as I can tell there is no reason not to
transmit this signal. */ if ((itv->std_out & V4L2_STD_625_50) && !enabled) {
enabled = 1;
mode = 0x08; /* 4x3 full format */
}
data.id = V4L2_SLICED_WSS_625;
data.field = 0;
data.line = enabled ? 23 : 0;
data.data[0] = mode & 0xff;
data.data[1] = (mode >> 8) & 0xff;
ivtv_call_hw(itv, IVTV_HW_SAA7127, vbi, s_vbi_data, &data);
}
staticint odd_parity(u8 c)
{
c ^= (c >> 4);
c ^= (c >> 2);
c ^= (c >> 1);
for (i = 0; i < cnt; i++) { if (copy_from_user(&d, sliced + i, sizeof(struct v4l2_sliced_vbi_data))) {
ret = -EFAULT; break;
}
ivtv_write_vbi_line(itv, &d, &cc, &found_cc);
}
/* Compressed VBI format, all found sliced blocks put next to one another
Returns new compressed size */ static u32 compress_sliced_buf(struct ivtv *itv, u32 line, u8 *buf, u32 size, u8 sav)
{
u32 line_size = itv->vbi.sliced_decoder_line_size; struct v4l2_decode_vbi_line vbi = {}; int i; unsigned lines = 0;
/* find the first valid line */ for (i = 0; i < size; i++, buf++) { if (buf[0] == 0xff && !buf[1] && !buf[2] && buf[3] == sav) break;
}
size -= i; if (size < line_size) { return line;
} for (i = 0; i < size / line_size; i++) {
u8 *p = buf + i * line_size;
/* second field of the frame? */ if (type == itv->vbi.raw_decoder_sav_even_field) { /* Dirty hack needed for backwards
compatibility of old VBI software. */
p += size - 4;
memcpy(p, &itv->vbi.frame, 4);
itv->vbi.frame++;
} return;
}
/* Sliced VBI data with data insertion */ if (streamtype == IVTV_ENC_STREAM_TYPE_VBI) { int lines;
ivtv_buf_swap(buf);
/* first field */
lines = compress_sliced_buf(itv, 0, p, size / 2,
itv->vbi.sliced_decoder_sav_odd_field); /* second field */ /* experimentation shows that the second half does not always begin
at the exact address. So start a bit earlier (hence 32). */
lines = compress_sliced_buf(itv, lines, p + size / 2 - 32, size / 2 + 32,
itv->vbi.sliced_decoder_sav_even_field); /* always return at least one empty line */ if (lines == 0) {
itv->vbi.sliced_data[0].id = 0;
itv->vbi.sliced_data[0].line = 0;
itv->vbi.sliced_data[0].field = 0;
lines = 1;
}
buf->bytesused = size = lines * sizeof(itv->vbi.sliced_data[0]);
memcpy(p, &itv->vbi.sliced_data[0], size);
if (itv->vbi.insert_mpeg) {
copy_vbi_data(itv, lines, pts_stamp);
}
itv->vbi.frame++; return;
}
/* Sliced VBI re-inserted from an MPEG stream */ if (streamtype == IVTV_DEC_STREAM_TYPE_VBI) { /* If the size is not 4-byte aligned, then the starting address for the swapping is also shifted. After swapping the data the real start address of the VBI data is exactly 4 bytes after the original start. It's a bit fiddly but it works like a charm. Non-4-byte alignment happens when an lseek is done on the input mpeg file to a non-4-byte aligned position. So on arrival here
the VBI data is also non-4-byte aligned. */ int offset = size & 3; int cnt;
if (offset) {
p += 4 - offset;
} /* Swap Buffer */ for (y = 0; y < size; y += 4) {
swab32s((u32 *)(p + y));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.