1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
From d9df9449ab20a37789d6c771a118e551941433f4 Mon Sep 17 00:00:00 2001
From: etobi <git@e-tobi.net>
Date: Fri, 12 Feb 2010 21:56:41 +0100
Subject: [PATCH 3/6] Allow manual configuration of teletetxt subtitle pages in channels.conf
---
channels.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++----
channels.h | 1 +
vdr.5 | 7 +++++++
3 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/channels.c b/channels.c
index 863eab0..197588c 100644
--- a/channels.c
+++ b/channels.c
@@ -556,7 +556,7 @@ void cChannel::SetTeletextSubtitlePages(tTeletextSubtitlePage pages[], int numbe
int mod = CHANNELMOD_NONE;
if (totalTtxtSubtitlePages != numberOfPages)
mod |= CHANNELMOD_PIDS;
- totalTtxtSubtitlePages = 0;
+ totalTtxtSubtitlePages = fixedTtxtSubtitlePages;
for (int i = 0; (i < numberOfPages) && (totalTtxtSubtitlePages < MAXTXTPAGES); i++) {
if (teletextSubtitlePages[totalTtxtSubtitlePages].ttxtMagazine != pages[i].ttxtMagazine ||
teletextSubtitlePages[totalTtxtSubtitlePages].ttxtPage != pages[i].ttxtPage ||
@@ -778,11 +778,22 @@ cString cChannel::ToText(const cChannel *Channel)
q += IntArrayToString(q, Channel->dpids, 10, Channel->dlangs);
}
*q = 0;
+ const int TBufferSize = 5 + 1 + (MAXTXTPAGES * (3 + 1 + MAXLANGCODE1 + 1)) + 10; // '12345;150=deu,151=fin,...', +10: paranoia
+ char tpidbuf[TBufferSize];
+ q = tpidbuf;
+ q += snprintf(q, sizeof(tpidbuf), "%d", Channel->tpid);
+ if (Channel->fixedTtxtSubtitlePages > 0) {
+ q += snprintf(q, sizeof(tpidbuf) - (q - tpidbuf), ";");
+ for (int i = 0; i < Channel->fixedTtxtSubtitlePages; ++i) {
+ tTeletextSubtitlePage page = Channel->teletextSubtitlePages[i];
+ q += snprintf(q, sizeof(tpidbuf) - (q - tpidbuf), "%d=%s", page.PageNumber(), page.ttxtLanguage);
+ }
+ }
char caidbuf[MAXCAIDS * 5 + 10]; // 5: 4 digits plus delimiting ',', 10: paranoia
q = caidbuf;
q += IntArrayToString(q, Channel->caids, 16);
*q = 0;
- buffer = cString::sprintf("%s:%d:%s:%s:%d:%s:%s:%d:%s:%d:%d:%d:%d\n", FullName, Channel->frequency, *Channel->ParametersToString(), *cSource::ToString(Channel->source), Channel->srate, vpidbuf, apidbuf, Channel->tpid, caidbuf, Channel->sid, Channel->nid, Channel->tid, Channel->rid);
+ buffer = cString::sprintf("%s:%d:%s:%s:%d:%s:%s:%s:%s:%d:%d:%d:%d\n", FullName, Channel->frequency, *Channel->ParametersToString(), *cSource::ToString(Channel->source), Channel->srate, vpidbuf, apidbuf, tpidbuf, caidbuf, Channel->sid, Channel->nid, Channel->tid, Channel->rid);
}
return buffer;
}
@@ -816,8 +827,9 @@ bool cChannel::Parse(const char *s)
char *parambuf = NULL;
char *vpidbuf = NULL;
char *apidbuf = NULL;
+ char *tpidbuf = NULL;
char *caidbuf = NULL;
- int fields = sscanf(s, "%a[^:]:%d :%a[^:]:%a[^:] :%d :%a[^:]:%a[^:]:%d :%a[^:]:%d :%d :%d :%d ", &namebuf, &frequency, ¶mbuf, &sourcebuf, &srate, &vpidbuf, &apidbuf, &tpid, &caidbuf, &sid, &nid, &tid, &rid);
+ int fields = sscanf(s, "%a[^:]:%d :%a[^:]:%a[^:] :%d :%a[^:]:%a[^:]:%a[^:]:%a[^:]:%d :%d :%d :%d ", &namebuf, &frequency, ¶mbuf, &sourcebuf, &srate, &vpidbuf, &apidbuf, &tpidbuf, &caidbuf, &sid, &nid, &tid, &rid);
if (fields >= 9) {
if (fields == 9) {
// allow reading of old format
@@ -899,7 +911,37 @@ bool cChannel::Parse(const char *s)
}
dpids[NumDpids] = 0;
}
-
+ if (tpidbuf) {
+ char *p;
+ fixedTtxtSubtitlePages = 0;
+ // 2001;150=deu,151=fin
+ if ((p = strchr(tpidbuf, ';')) != NULL) {
+ char *q, *strtok_next;
+ *p++ = 0;
+ while ((q = strtok_r(p, ",", &strtok_next)) != NULL) {
+ if (fixedTtxtSubtitlePages < MAXTXTPAGES) {
+ int page;
+ char *l = strchr(q, '=');
+ if (l)
+ *l++ = 0;
+ if (sscanf(q, "%d", &page) == 1) {
+ teletextSubtitlePages[fixedTtxtSubtitlePages] = tTeletextSubtitlePage(page);
+ if (l)
+ strn0cpy(teletextSubtitlePages[fixedTtxtSubtitlePages].ttxtLanguage, l, MAXLANGCODE1);
+ fixedTtxtSubtitlePages++;
+ }
+ else
+ esyslog("ERROR: invalid Teletext page!"); // no need to set ok to 'false'
+ }
+ else
+ esyslog("ERROR: too many Teletext pages!"); // no need to set ok to 'false'
+ p = NULL;
+ }
+ totalTtxtSubtitlePages = fixedTtxtSubtitlePages;
+ }
+ if (sscanf(tpidbuf, "%d", &tpid) != 1)
+ return false;
+ }
if (caidbuf) {
char *p = caidbuf;
char *q;
@@ -936,6 +978,7 @@ bool cChannel::Parse(const char *s)
free(sourcebuf);
free(vpidbuf);
free(apidbuf);
+ free(tpidbuf);
free(caidbuf);
free(namebuf);
if (!GetChannelID().Valid()) {
diff --git a/channels.h b/channels.h
index 60973b7..897c8cd 100644
--- a/channels.h
+++ b/channels.h
@@ -144,6 +144,7 @@ private:
uint16_t compositionPageIds[MAXSPIDS];
uint16_t ancillaryPageIds[MAXSPIDS];
int tpid;
+ int fixedTtxtSubtitlePages;
int totalTtxtSubtitlePages;
tTeletextSubtitlePage teletextSubtitlePages[MAXTXTPAGES];
int caids[MAXCAIDS + 1]; // list is zero-terminated
diff --git a/vdr.5 b/vdr.5
index 4b2cb90..c7da844 100644
--- a/vdr.5
+++ b/vdr.5
@@ -207,6 +207,13 @@ can be indicated by adding a second language code, delimited by a '+' sign, as i
.TP
.B TPID
The teletext PID.
+
+Fixed teletext subtitling pages can be defined separated by a semicolon.
+The pages (separated by commas) can contain ISO 639 language codes, delimited
+by a '=' sign, as in
+
+.B ...:2001;150=deu,151=fin:...
+
.TP
.B Conditional access
A hexadecimal integer defining how this channel can be accessed:
--
1.6.6.1
|