summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Hanisch <dvb@flensrocker.de>2010-08-20 22:27:18 +0200
committerLars Hanisch <dvb@flensrocker.de>2010-08-20 22:27:18 +0200
commit304c20feba95453752174a5d7a45def058bcd336 (patch)
treeb93549c0fcc9458b70dc752804ebab8a6457bbca
parent4f56cb2cfaa5845d81156c18bd19862321cd8db4 (diff)
downloadvdr-plugin-pvrinput-304c20feba95453752174a5d7a45def058bcd336.tar.gz
vdr-plugin-pvrinput-304c20feba95453752174a5d7a45def058bcd336.tar.bz2
activate WSS service and insert wss bits into vbi-packets
-rwxr-xr-xdevice.c2
-rwxr-xr-xpvrinput.c2
-rwxr-xr-xreader.c74
3 files changed, 49 insertions, 29 deletions
diff --git a/device.c b/device.c
index 633b784..648dc51 100755
--- a/device.c
+++ b/device.c
@@ -647,7 +647,7 @@ bool cPvrDevice::SetVBImode(int vbiLinesPerFrame, int vbistatus)
return false;
}
if ((ctrl.value == V4L2_MPEG_STREAM_VBI_FMT_IVTV) && (vbiLinesPerFrame == 625)) {
- vbifmt.fmt.sliced.service_set = V4L2_SLICED_TELETEXT_B;
+ vbifmt.fmt.sliced.service_set = V4L2_SLICED_TELETEXT_B | V4L2_SLICED_WSS_625;
vbifmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
vbifmt.fmt.sliced.reserved[0] = 0;
vbifmt.fmt.sliced.reserved[1] = 0;
diff --git a/pvrinput.c b/pvrinput.c
index eba6742..2f2006a 100755
--- a/pvrinput.c
+++ b/pvrinput.c
@@ -6,7 +6,7 @@
#endif
#endif
-static const char *VERSION = "2010-08-19-ttx2";
+static const char *VERSION = "2010-08-20-ttx-wss";
static const char *DESCRIPTION = tr("use Hauppauge PVR as input device");
static const char *MAINMENUENTRY = tr("PVR picture settings");
diff --git a/reader.c b/reader.c
index 048ed3d..bb4b019 100755
--- a/reader.c
+++ b/reader.c
@@ -304,29 +304,22 @@ void cPvrReadThread::PesToTs(uint8_t *Data, uint32_t Length)
switch (fmt) {
case vbifmt_itv0: {
uint32_t bit = 1;
+ int lm_nr = 0;
int line_nr = 0;
- while (bit != 0) {
- if (vbi_fmt->itv0.linemask[0] & bit) {
+ while ((lm_nr != 1) || (bit != 0x10)) {
+ if (vbi_fmt->itv0.linemask[lm_nr] & bit) {
if ((line_nr < 35) && ((vbi_fmt->itv0.line[line_nr].id == V4L2_MPEG_VBI_IVTV_TELETEXT_B)
- //|| (vbi_fmt->itv0.line[line_nr].id == V4L2_MPEG_VBI_IVTV_WSS_625) // implement in the future
- //|| (vbi_fmt->itv0.line[line_nr].id == V4L2_MPEG_VBI_IVTV_VPS) // for now only teletext
- ))
+ || (vbi_fmt->itv0.line[line_nr].id == V4L2_MPEG_VBI_IVTV_WSS_625)
+ //|| (vbi_fmt->itv0.line[line_nr].id == V4L2_MPEG_VBI_IVTV_VPS)
+ ))
needed_size += 46;
line_nr++;
}
bit <<= 1;
- }
- bit = 1;
- while (bit != 0x10) {
- if (vbi_fmt->itv0.linemask[1] & bit) {
- if ((line_nr < 35) && ((vbi_fmt->itv0.line[line_nr].id == V4L2_MPEG_VBI_IVTV_TELETEXT_B)
- //|| (vbi_fmt->itv0.line[line_nr].id == V4L2_MPEG_VBI_IVTV_WSS_625) // implement in the future
- //|| (vbi_fmt->itv0.line[line_nr].id == V4L2_MPEG_VBI_IVTV_VPS) // for now only teletext
- ))
- needed_size += 46;
- line_nr++;
+ if (bit == 0) {
+ lm_nr++;
+ bit = 1;
}
- bit <<= 1;
}
break;
}
@@ -335,9 +328,9 @@ void cPvrReadThread::PesToTs(uint8_t *Data, uint32_t Length)
return; // not enough data
for (int vbiNr = 0; vbiNr < 36; vbiNr++) {
if ((vbi_fmt->ITV0.line[vbiNr].id == V4L2_MPEG_VBI_IVTV_TELETEXT_B)
- //|| (vbi_fmt->ITV0.line[vbiNr].id == V4L2_MPEG_VBI_IVTV_WSS_625) // implement in the future
- //|| (vbi_fmt->ITV0.line[vbiNr].id == V4L2_MPEG_VBI_IVTV_VPS) // for now only teletext
- )
+ || (vbi_fmt->ITV0.line[vbiNr].id == V4L2_MPEG_VBI_IVTV_WSS_625)
+ //|| (vbi_fmt->ITV0.line[vbiNr].id == V4L2_MPEG_VBI_IVTV_VPS)
+ )
needed_size += 46;
}
break;
@@ -366,12 +359,23 @@ void cPvrReadThread::PesToTs(uint8_t *Data, uint32_t Length)
uint8_t itv0_linemaskNr = 0;
uint8_t itv0_field_parity = 1;
uint8_t itv0_line_offset = 6;
+
+ uint8_t data_unit_id = 0;
+ uint8_t framing_code = 0;
+ uint8_t field_parity = 0;
+ uint8_t line_offset = 0;
+ uint8_t copy_vbi_bytes = 0;
+ uint8_t vbi_bytes[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ bool copy_vbi_line = false;
+ v4l2_mpeg_vbi_itv0_line *vbi_line = 0;
while (true) {
- v4l2_mpeg_vbi_itv0_line *vbi_line = 0;
- uint8_t data_unit_id = 0;
- uint8_t framing_code = 0;
- uint8_t field_parity = 0;
- uint8_t line_offset = 0;
+ data_unit_id = 0;
+ framing_code = 0;
+ field_parity = 0;
+ line_offset = 0;
+ copy_vbi_bytes = 0;
+ copy_vbi_line = false;
+ vbi_line = 0;
switch (fmt) {
case vbifmt_itv0: {
if ((itv0_vbiLineNr < 35) && (vbi_fmt->itv0.linemask[itv0_linemaskNr] & itv0_bit)) {
@@ -379,9 +383,14 @@ void cPvrReadThread::PesToTs(uint8_t *Data, uint32_t Length)
case V4L2_MPEG_VBI_IVTV_TELETEXT_B: {
data_unit_id = 0x02;
framing_code = 0xE4;
+ copy_vbi_line = true;
break;
}
case V4L2_MPEG_VBI_IVTV_WSS_625: {
+ data_unit_id = 0xC4;
+ framing_code = kInvTab[vbi_fmt->itv0.line[itv0_vbiLineNr].data[0]];
+ vbi_bytes[0] = kInvTab[vbi_fmt->itv0.line[itv0_vbiLineNr].data[1]];
+ copy_vbi_bytes = 1;
break;
}
case V4L2_MPEG_VBI_IVTV_VPS: {
@@ -412,9 +421,14 @@ void cPvrReadThread::PesToTs(uint8_t *Data, uint32_t Length)
case V4L2_MPEG_VBI_IVTV_TELETEXT_B: {
data_unit_id = 0x02;
framing_code = 0xE4;
+ copy_vbi_line = true;
break;
}
case V4L2_MPEG_VBI_IVTV_WSS_625: {
+ data_unit_id = 0xC4;
+ framing_code = kInvTab[vbi_fmt->ITV0.line[ITV0_vbiLineNr].data[0]];
+ vbi_bytes[0] = kInvTab[vbi_fmt->ITV0.line[ITV0_vbiLineNr].data[1]];
+ copy_vbi_bytes = 1;
break;
}
case V4L2_MPEG_VBI_IVTV_VPS: {
@@ -431,7 +445,7 @@ void cPvrReadThread::PesToTs(uint8_t *Data, uint32_t Length)
}
}
- if (vbi_line != 0) {
+ if ((vbi_line != 0) && (copy_vbi_line || copy_vbi_bytes)) {
if (ts_line_nr == 0) { // send current packet and prepare next one
PutData(ts_buffer, TS_SIZE);
first = false;
@@ -447,8 +461,14 @@ void cPvrReadThread::PesToTs(uint8_t *Data, uint32_t Length)
ts_buffer[4 + ts_line_nr * 46 + 1] = 0x2C;
ts_buffer[4 + ts_line_nr * 46 + 2] = 0xC0 | (field_parity << 5) | (line_offset & 0x1f);
ts_buffer[4 + ts_line_nr * 46 + 3] = framing_code;
- for (int datNr = 0; datNr < 42; datNr++)
- ts_buffer[4 + ts_line_nr * 46 + 4 + datNr] = kInvTab[vbi_line->data[datNr]];
+ if (copy_vbi_line) {
+ for (int datNr = 0; datNr < 42; datNr++)
+ ts_buffer[4 + ts_line_nr * 46 + 4 + datNr] = kInvTab[vbi_line->data[datNr]];
+ }
+ else if (copy_vbi_bytes > 0) {
+ for (int datNr = 0; datNr < copy_vbi_bytes; datNr++)
+ ts_buffer[4 + ts_line_nr * 46 + 4 + datNr] = vbi_bytes[datNr];
+ }
ts_line_nr++;
if (ts_line_nr == 4)
ts_line_nr = 0;