diff options
author | etobi <git@e-tobi.net> | 2010-02-12 21:56:41 +0100 |
---|---|---|
committer | etobi <git@e-tobi.net> | 2013-03-10 13:52:15 +0100 |
commit | 1c37c1a96eaac460f3905ec46899a3361044fe16 (patch) | |
tree | 306742980f4a09b66292beef75c6638e76542fc1 | |
parent | 52b572646b476bbe402fc56e929de310b949efdf (diff) | |
download | vdr-patches-1c37c1a96eaac460f3905ec46899a3361044fe16.tar.gz vdr-patches-1c37c1a96eaac460f3905ec46899a3361044fe16.tar.bz2 |
Allow manual configuration of teletetxt subtitle pages in channels.conf
-rw-r--r-- | channels.c | 39 | ||||
-rw-r--r-- | channels.h | 1 | ||||
-rw-r--r-- | vdr.5 | 6 |
3 files changed, 43 insertions, 3 deletions
@@ -411,9 +411,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 || @@ -556,10 +556,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); @@ -730,6 +737,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) { @@ -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 @@ -233,6 +233,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: |