diff --git a/pat.c b/pat.c index b7493ec..9262491 100644 --- a/pat.c +++ b/pat.c @@ -17,6 +17,7 @@ #include "libsi/section.h" #include "libsi/descriptor.h" #include "thread.h" +#include "vdrttxtsubshooks.h" #define PMT_SCAN_TIMEOUT 10 // seconds @@ -347,6 +348,8 @@ void cPatFilter::Process(u_short Pid, u_ char DLangs[MAXDPIDS][MAXLANGCODE2] = { "" }; char SLangs[MAXSPIDS][MAXLANGCODE2] = { "" }; int Tpid = 0; + tTeletextSubtitlePage TeletextSubtitlePages[MAXTXTPAGES]; + int NumTPages = 0; int NumApids = 0; int NumDpids = 0; int NumSpids = 0; @@ -438,8 +441,21 @@ void cPatFilter::Process(u_short Pid, u_ NumSpids++; } break; - case SI::TeletextDescriptorTag: + case SI::TeletextDescriptorTag: { Tpid = esPid; + SI::TeletextDescriptor *sd = (SI::TeletextDescriptor *)d; + SI::TeletextDescriptor::Teletext ttxt; + for (SI::Loop::Iterator it; sd->teletextLoop.getNext(ttxt, it); ) { + bool isSubtitlePage = (ttxt.getTeletextType() == 0x02) || (ttxt.getTeletextType() == 0x05); + if ((NumTPages < MAXTXTPAGES) && ttxt.languageCode[0] && isSubtitlePage) { + strn0cpy(TeletextSubtitlePages[NumTPages].ttxtLanguage, I18nNormalizeLanguageCode(ttxt.languageCode), MAXLANGCODE1); + TeletextSubtitlePages[NumTPages].ttxtPage = ttxt.getTeletextPageNumber(); + TeletextSubtitlePages[NumTPages].ttxtMagazine = ttxt.getTeletextMagazineNumber(); + TeletextSubtitlePages[NumTPages].ttxtType = ttxt.getTeletextType(); + NumTPages++; + } + } + } break; case SI::ISO639LanguageDescriptorTag: { SI::ISO639LanguageDescriptor *ld = (SI::ISO639LanguageDescriptor *)d; @@ -541,6 +557,11 @@ void cPatFilter::Process(u_short Pid, u_ } if (Setup.UpdateChannels >= 2) { Channel->SetPids(Vpid, Ppid, Vtype, Apids, Atypes, ALangs, Dpids, Dtypes, DLangs, Spids, SLangs, Tpid); + if (NumTPages < MAXTXTPAGES) { + int manualPageNumber = cVDRTtxtsubsHookListener::Hook()->ManualPageNumber(Channel); + if (manualPageNumber) + TeletextSubtitlePages[NumTPages++] = tTeletextSubtitlePage(manualPageNumber); + } if (!cSource::IsType(Channel->Source(), 'I')) Channel->SetCaIds(CaDescriptors->CaIds()); Channel->SetSubtitlingDescriptors(SubtitlingTypes, CompositionPageIds, AncillaryPageIds);