summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--channels.c9
-rw-r--r--channels.h6
-rw-r--r--pat.c17
3 files changed, 31 insertions, 1 deletions
diff --git a/channels.c b/channels.c
index 1e85700..fb5bd84 100644
--- a/channels.c
+++ b/channels.c
@@ -533,6 +533,15 @@ void cChannel::SetPids(int Vpid, int Ppid, int Vtype, int *Apids, char ALangs[][
}
}
+void cChannel::SetTPidData(char TLangs[][MAXLANGCODE2], int TPages[])
+{
+ for (int i = 0; i < MAXTPAGES; i++) {
+ tpages[i] = TPages[i];
+ strn0cpy(tlangs[i], TLangs[i], MAXLANGCODE2);
+ }
+ tpages[MAXTPAGES] = 0;
+}
+
void cChannel::SetCaIds(const int *CaIds)
{
if (caids[0] && caids[0] <= CA_USER_MAX)
diff --git a/channels.h b/channels.h
index a3c1d43..d4b6c97 100644
--- a/channels.h
+++ b/channels.h
@@ -35,6 +35,7 @@
#define MAXDPIDS 16 // dolby (AC3 + DTS)
#define MAXSPIDS 32 // subtitles
#define MAXCAIDS 8 // conditional access
+#define MAXTPAGES 8 // teletext pages
#define MAXLANGCODE1 4 // a 3 letter language code, zero terminated
#define MAXLANGCODE2 8 // up to two 3 letter language codes, separated by '+' and zero terminated
@@ -130,6 +131,8 @@ private:
int spids[MAXSPIDS + 1]; // list is zero-terminated
char slangs[MAXSPIDS][MAXLANGCODE2];
int tpid;
+ char tlangs[MAXTPAGES][MAXLANGCODE2];
+ int tpages[MAXTPAGES + 1]; // list is zero-terminated
int caids[MAXCAIDS + 1]; // list is zero-terminated
int nid;
int tid;
@@ -186,6 +189,8 @@ public:
const char *Dlang(int i) const { return (0 <= i && i < MAXDPIDS) ? dlangs[i] : ""; }
const char *Slang(int i) const { return (0 <= i && i < MAXSPIDS) ? slangs[i] : ""; }
int Tpid(void) const { return tpid; }
+ const char *Tlang(int i) const { return (0 <= i && i < MAXTPAGES) ? tlangs[i] : ""; }
+ const int TPages(int i) const { return (0 <= i && i < MAXTPAGES) ? tpages[i] : 0; }
const int *Caids(void) const { return caids; }
int Ca(int Index = 0) const { return Index < MAXCAIDS ? caids[Index] : 0; }
int Nid(void) const { return nid; }
@@ -222,6 +227,7 @@ public:
void SetName(const char *Name, const char *ShortName, const char *Provider);
void SetPortalName(const char *PortalName);
void SetPids(int Vpid, int Ppid, int Vtype, int *Apids, char ALangs[][MAXLANGCODE2], int *Dpids, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid);
+ void SetTPidData(char TLangs[][MAXLANGCODE2], int TPages[]);
void SetCaIds(const int *CaIds); // list must be zero-terminated
void SetCaDescriptors(int Level);
void SetLinkChannels(cLinkChannels *LinkChannels);
diff --git a/pat.c b/pat.c
index 5285784..d001633 100644
--- a/pat.c
+++ b/pat.c
@@ -337,6 +337,9 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
char DLangs[MAXDPIDS][MAXLANGCODE2] = { "" };
char SLangs[MAXSPIDS][MAXLANGCODE2] = { "" };
int Tpid = 0;
+ char TLangs[MAXTPAGES][MAXLANGCODE2] = { "" };
+ int TPages[MAXTPAGES + 1] = { 0 };
+ int NumTPages = 0;
int NumApids = 0;
int NumDpids = 0;
int NumSpids = 0;
@@ -414,8 +417,19 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
NumSpids++;
}
break;
- case SI::TeletextDescriptorTag:
+ case SI::TeletextDescriptorTag: {
Tpid = stream.getPid();
+ SI::TeletextDescriptor *sd = (SI::TeletextDescriptor *)d;
+ SI::TeletextDescriptor::Teletext ttxt;
+ for (SI::Loop::Iterator it; sd->teletextLoop.getNext(ttxt, it); ) {
+ if ((NumTPages < MAXTPAGES) && ttxt.languageCode[0] && ((ttxt.getTeletextType() == 0x02) || (ttxt.getTeletextType() == 0x05))) {
+ char *s = TLangs[NumTPages];
+ strn0cpy(s, I18nNormalizeLanguageCode(ttxt.languageCode), MAXLANGCODE1);
+ TPages[NumTPages] = (ttxt.getTeletextPageNumber() & 0xff) | ((ttxt.getTeletextMagazineNumber() & 0xff) << 8) | ((ttxt.getTeletextType() & 0xff) << 16);
+ NumTPages++;
+ }
+ }
+ }
break;
case SI::ISO639LanguageDescriptorTag: {
SI::ISO639LanguageDescriptor *ld = (SI::ISO639LanguageDescriptor *)d;
@@ -444,6 +458,7 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
}
if (Setup.UpdateChannels >= 2) {
Channel->SetPids(Vpid, Ppid, Vtype, Apids, ALangs, Dpids, DLangs, Spids, SLangs, Tpid);
+ Channel->SetTPidData(TLangs, TPages);
Channel->SetCaIds(CaDescriptors->CaIds());
}
Channel->SetCaDescriptors(CaDescriptorHandler.AddCaDescriptors(CaDescriptors));