The subtitle PIDs are now stored in the channels.conf file as an extension to the TPID field

This commit is contained in:
Klaus Schmidinger 2011-08-21 14:18:37 +02:00
parent dac837d38d
commit d00941c1fd
4 changed files with 57 additions and 7 deletions

View File

@ -1112,6 +1112,7 @@ Rolf Ahrenberg <rahrenbe@cc.hut.fi>
for fixing some crashes in subtitle display
for reporting that DELETENULL() was not thread safe
for reporting a crash in subtitle display, related to cOsd::Osds
for a patch that stores the subtitle PIDs in the channels.conf file
Ralf Klueber <ralf.klueber@vodafone.com>
for reporting a bug in cutting a recording if there is only a single editing mark

View File

@ -6718,3 +6718,5 @@ Video Disk Recorder Revision History
- The new functions cRecording::NumFrames() and cRecording::LengthInSeconds() return
the number of frames and length (in seconds) of a recording (suggested by Steffen
Barszus).
- The subtitle PIDs are now stored in the channels.conf file as an extension to the
TPID field (thanks to Rolf Ahrenberg).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.c 2.17 2010/11/07 12:24:59 kls Exp $
* $Id: channels.c 2.18 2011/08/21 14:13:54 kls Exp $
*/
#include "channels.h"
@ -497,8 +497,8 @@ cString cChannel::ToText(const cChannel *Channel)
if (Channel->vpid && Channel->vtype)
q += snprintf(q, sizeof(vpidbuf) - (q - vpidbuf), "=%d", Channel->vtype);
*q = 0;
const int BufferSize = (MAXAPIDS + MAXDPIDS) * (5 + 1 + MAXLANGCODE2 + 5) + 10; // 5 digits plus delimiting ',' or ';' plus optional '=cod+cod@type', +10: paranoia
char apidbuf[BufferSize];
const int ABufferSize = (MAXAPIDS + MAXDPIDS) * (5 + 1 + MAXLANGCODE2 + 5) + 10; // 5 digits plus delimiting ',' or ';' plus optional '=cod+cod@type', +10: paranoia
char apidbuf[ABufferSize];
q = apidbuf;
q += IntArrayToString(q, Channel->apids, 10, Channel->alangs, Channel->atypes);
if (Channel->dpids[0]) {
@ -506,11 +506,19 @@ 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
char tpidbuf[TBufferSize];
q = tpidbuf;
q += snprintf(q, sizeof(tpidbuf), "%d", Channel->tpid);
if (Channel->spids[0]) {
*q++ = ';';
q += IntArrayToString(q, Channel->spids, 10, Channel->slangs);
}
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->parameters, *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->parameters, *cSource::ToString(Channel->source), Channel->srate, vpidbuf, apidbuf, tpidbuf, caidbuf, Channel->sid, Channel->nid, Channel->tid, Channel->rid);
}
return buffer;
}
@ -544,14 +552,17 @@ 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, &parambuf, &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, &parambuf, &sourcebuf, &srate, &vpidbuf, &apidbuf, &tpidbuf, &caidbuf, &sid, &nid, &tid, &rid);
if (fields >= 9) {
if (fields == 9) {
// allow reading of old format
sid = atoi(caidbuf);
delete caidbuf;
caidbuf = NULL;
if (sscanf(tpidbuf, "%d", &tpid) != 1)
return false;
caids[0] = tpid;
caids[1] = 0;
tpid = 0;
@ -562,6 +573,7 @@ bool cChannel::Parse(const char *s)
atypes[0] = 0;
dpids[0] = 0;
dtypes[0] = 0;
spids[0] = 0;
ok = false;
if (parambuf && sourcebuf && vpidbuf && apidbuf) {
parameters = parambuf;
@ -644,7 +656,30 @@ bool cChannel::Parse(const char *s)
dpids[NumDpids] = 0;
dtypes[NumDpids] = 0;
}
if (sscanf(tpidbuf, "%d", &tpid) != 1)
return false;
int NumSpids = 0;
if ((p = strchr(tpidbuf, ';')) != NULL) {
*p++ = 0;
char *q;
char *strtok_next;
while ((q = strtok_r(p, ",", &strtok_next)) != NULL) {
if (NumSpids < MAXSPIDS) {
char *l = strchr(q, '=');
if (l) {
*l++ = 0;
strn0cpy(slangs[NumSpids], l, MAXLANGCODE2);
}
else
*slangs[NumSpids] = 0;
spids[NumSpids++] = strtol(q, NULL, 10);
}
else
esyslog("ERROR: too many SPIDs!"); // no need to set ok to 'false'
p = NULL;
}
spids[NumSpids] = 0;
}
if (caidbuf) {
char *p = caidbuf;
char *q;
@ -681,6 +716,7 @@ bool cChannel::Parse(const char *s)
free(sourcebuf);
free(vpidbuf);
free(apidbuf);
free(tpidbuf);
free(caidbuf);
free(namebuf);
if (!GetChannelID().Valid()) {

13
vdr.5
View File

@ -8,7 +8,7 @@
.\" License as specified in the file COPYING that comes with the
.\" vdr distribution.
.\"
.\" $Id: vdr.5 2.22 2011/04/03 10:21:36 kls Exp $
.\" $Id: vdr.5 2.23 2011/08/21 14:06:50 kls Exp $
.\"
.TH vdr 5 "10 Feb 2008" "1.6" "Video Disk Recorder Files"
.SH NAME
@ -214,6 +214,17 @@ if there is an audio type.
.TP
.B TPID
The teletext PID.
If this channel also carries DVB subtitles, the DVB subtitling PIDs follow the
teletext PID, separated by a semicolon, as in
.B ...:201;2001,2002:...
If certain subtitling PIDs broadcast in specific languages, the language
codes for these can be appended to the individual subtitling PID, separated
by an '=' sign, as in
.B ...:201;2001=deu,2002=eng:...
.TP
.B Conditional access
A hexadecimal integer defining how this channel can be accessed: