diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2005-09-04 14:48:39 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2005-09-04 14:48:39 +0200 |
commit | 1bc5ba817c785f6d99ab5e82a9b5f5be3238dd1c (patch) | |
tree | a323b5038b0265edfad42422a8d8534895bc1496 /channels.c | |
parent | c4ff05bbcaf8dd31ac88bdc76f2815da25ac08b0 (diff) | |
download | vdr-1bc5ba817c785f6d99ab5e82a9b5f5be3238dd1c.tar.gz vdr-1bc5ba817c785f6d99ab5e82a9b5f5be3238dd1c.tar.bz2 |
Changed the audio PID language codes to hold up to two 3 letter codes; automatic audio channel setting for two channel audio
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 25 |
1 files changed, 14 insertions, 11 deletions
@@ -4,12 +4,13 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.c 1.44 2005/08/06 12:22:41 kls Exp $ + * $Id: channels.c 1.45 2005/09/04 10:49:12 kls Exp $ */ #include "channels.h" #include <linux/dvb/frontend.h> #include <ctype.h> +#include "device.h" // IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d' // format characters in order to allow any number of blanks after a numeric @@ -386,7 +387,7 @@ void cChannel::SetPortalName(const char *PortalName) #define STRDIFF 0x01 #define VALDIFF 0x02 -static int IntArraysDiffer(const int *a, const int *b, const char na[][4] = NULL, const char nb[][4] = NULL) +static int IntArraysDiffer(const int *a, const int *b, const char na[][MAXLANGCODE2] = NULL, const char nb[][MAXLANGCODE2] = NULL) { int result = 0; for (int i = 0; a[i] || b[i]; i++) { @@ -400,7 +401,7 @@ static int IntArraysDiffer(const int *a, const int *b, const char na[][4] = NULL return result; } -static int IntArrayToString(char *s, const int *a, int Base = 10, const char n[][4] = NULL) +static int IntArrayToString(char *s, const int *a, int Base = 10, const char n[][MAXLANGCODE2] = NULL) { char *q = s; int i = 0; @@ -416,7 +417,7 @@ static int IntArrayToString(char *s, const int *a, int Base = 10, const char n[] return q - s; } -void cChannel::SetPids(int Vpid, int Ppid, int *Apids, char ALangs[][4], int *Dpids, char DLangs[][4], int Tpid) +void cChannel::SetPids(int Vpid, int Ppid, int *Apids, char ALangs[][MAXLANGCODE2], int *Dpids, char DLangs[][MAXLANGCODE2], int Tpid) { int mod = CHANNELMOD_NONE; if (vpid != Vpid || ppid != Ppid || tpid != Tpid) @@ -427,8 +428,9 @@ void cChannel::SetPids(int Vpid, int Ppid, int *Apids, char ALangs[][4], int *Dp if (m & VALDIFF) mod |= CHANNELMOD_PIDS; if (mod) { - char OldApidsBuf[(MAXAPIDS + MAXDPIDS) * 10 + 10]; // 10: 5 digits plus delimiting ',' or ';' plus optional '=cod', +10: paranoia - char NewApidsBuf[(MAXAPIDS + MAXDPIDS) * 10 + 10]; + const int BufferSize = (MAXAPIDS + MAXDPIDS) * (5 + 1 + MAXLANGCODE2) + 10; // 5 digits plus delimiting ',' or ';' plus optional '=cod+cod', +10: paranoia + char OldApidsBuf[BufferSize]; + char NewApidsBuf[BufferSize]; char *q = OldApidsBuf; q += IntArrayToString(q, apids, 10, alangs); if (dpids[0]) { @@ -448,12 +450,12 @@ void cChannel::SetPids(int Vpid, int Ppid, int *Apids, char ALangs[][4], int *Dp ppid = Ppid; for (int i = 0; i < MAXAPIDS; i++) { apids[i] = Apids[i]; - strn0cpy(alangs[i], ALangs[i], 4); + strn0cpy(alangs[i], ALangs[i], MAXLANGCODE2); } apids[MAXAPIDS] = 0; for (int i = 0; i < MAXDPIDS; i++) { dpids[i] = Dpids[i]; - strn0cpy(dlangs[i], DLangs[i], 4); + strn0cpy(dlangs[i], DLangs[i], MAXLANGCODE2); } dpids[MAXDPIDS] = 0; tpid = Tpid; @@ -633,7 +635,8 @@ cString cChannel::ToText(const cChannel *Channel) if (Channel->ppid && Channel->ppid != Channel->vpid) q += snprintf(q, sizeof(vpidbuf) - (q - vpidbuf), "+%d", Channel->ppid); *q = 0; - char apidbuf[(MAXAPIDS + MAXDPIDS) * 10 + 10]; // 10: 5 digits plus delimiting ',' or ';' plus optional '=cod', +10: paranoia + const int BufferSize = (MAXAPIDS + MAXDPIDS) * (5 + 1 + MAXLANGCODE2) + 10; // 5 digits plus delimiting ',' or ';' plus optional '=cod+cod', +10: paranoia + char apidbuf[BufferSize]; q = apidbuf; q += IntArrayToString(q, Channel->apids, 10, Channel->alangs); if (Channel->dpids[0]) { @@ -722,7 +725,7 @@ bool cChannel::Parse(const char *s) char *l = strchr(q, '='); if (l) { *l++ = 0; - strn0cpy(alangs[NumApids], l, 4); + strn0cpy(alangs[NumApids], l, MAXLANGCODE2); } else *alangs[NumApids] = 0; @@ -743,7 +746,7 @@ bool cChannel::Parse(const char *s) char *l = strchr(q, '='); if (l) { *l++ = 0; - strn0cpy(dlangs[NumDpids], l, 4); + strn0cpy(dlangs[NumDpids], l, MAXLANGCODE2); } else *dlangs[NumDpids] = 0; |