summaryrefslogtreecommitdiff
path: root/patches/patch-set.1.7.21/0003-Allow-manual-configuration-of-teletetxt-subtitle-pag.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/patch-set.1.7.21/0003-Allow-manual-configuration-of-teletetxt-subtitle-pag.patch')
-rw-r--r--patches/patch-set.1.7.21/0003-Allow-manual-configuration-of-teletetxt-subtitle-pag.patch112
1 files changed, 112 insertions, 0 deletions
diff --git a/patches/patch-set.1.7.21/0003-Allow-manual-configuration-of-teletetxt-subtitle-pag.patch b/patches/patch-set.1.7.21/0003-Allow-manual-configuration-of-teletetxt-subtitle-pag.patch
new file mode 100644
index 0000000..e772f77
--- /dev/null
+++ b/patches/patch-set.1.7.21/0003-Allow-manual-configuration-of-teletetxt-subtitle-pag.patch
@@ -0,0 +1,112 @@
+From 88c023f4fc9025de7b1d98ae1bd4523378b012fb 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 | 39 ++++++++++++++++++++++++++++++++++++---
+ channels.h | 1 +
+ vdr.5 | 6 ++++++
+ 3 files changed, 43 insertions(+), 3 deletions(-)
+
+diff --git a/channels.c b/channels.c
+index 5ab31bb..44d4be2 100644
+--- a/channels.c
++++ b/channels.c
+@@ -381,9 +381,9 @@ void cChannel::SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *Compos
+ void cChannel::SetTeletextSubtitlePages(tTeletextSubtitlePage pages[], int numberOfPages)
+ {
+ int mod = CHANNELMOD_NONE;
+- if (totalTtxtSubtitlePages != numberOfPages)
++ if (totalTtxtSubtitlePages != (fixedTtxtSubtitlePages + 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 ||
+@@ -526,10 +526,17 @@ cString cChannel::ToText(const cChannel *Channel)
+ q += IntArrayToString(q, Channel->dpids, 10, Channel->dlangs, Channel->dtypes);
+ }
+ *q = 0;
+- const int TBufferSize = MAXSPIDS * (5 + 1 + MAXLANGCODE2) + 10; // 5 digits plus delimiting ',' or ';' plus optional '=cod+cod', +10: paranoia and tpid
++ const int TBufferSize = (MAXTXTPAGES * MAXSPIDS) * (5 + 1 + MAXLANGCODE2) + 10; // 5 digits plus delimiting ',' or ';' plus optional '=cod+cod', +10: paranoia and tpid
+ char tpidbuf[TBufferSize];
+ q = tpidbuf;
+ q += snprintf(q, sizeof(tpidbuf), "%d", Channel->tpid);
++ if (Channel->fixedTtxtSubtitlePages > 0) {
++ *q++ = '+';
++ 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);
++ }
++ }
+ if (Channel->spids[0]) {
+ *q++ = ';';
+ q += IntArrayToString(q, Channel->spids, 10, Channel->slangs);
+@@ -698,6 +705,32 @@ bool cChannel::Parse(const char *s)
+ }
+ spids[NumSpids] = 0;
+ }
++ fixedTtxtSubtitlePages = 0;
++ if ((p = strchr(tpidbuf, '+')) != NULL) {
++ *p++ = 0;
++ char *q;
++ char *strtok_next;
++ 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, MAXLANGCODE2);
++ 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) {
+diff --git a/channels.h b/channels.h
+index 3fc443c..6e7367f 100644
+--- a/channels.h
++++ b/channels.h
+@@ -126,6 +126,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 c46a2bf..96e142a 100644
+--- a/vdr.5
++++ b/vdr.5
+@@ -225,6 +225,12 @@ by an '=' sign, as in
+
+ .B ...:201;2001=deu,2002=eng:...
+
++Manual teletext subtitling pages can be defined separated by a '+' sign.
++The pages (separated by commas) can contain language codes, delimited by a '='
++sign, as in
++
++.B ...:201+150=deu,151=fin;2001,2002:...
++
+ .TP
+ .B Conditional access
+ A hexadecimal integer defining how this channel can be accessed:
+--
+1.7.6.3
+