summaryrefslogtreecommitdiff
path: root/patches/patch-set/0001-Record-teletext-subtitles.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/patch-set/0001-Record-teletext-subtitles.patch')
-rw-r--r--patches/patch-set/0001-Record-teletext-subtitles.patch82
1 files changed, 50 insertions, 32 deletions
diff --git a/patches/patch-set/0001-Record-teletext-subtitles.patch b/patches/patch-set/0001-Record-teletext-subtitles.patch
index 4272381..207ac62 100644
--- a/patches/patch-set/0001-Record-teletext-subtitles.patch
+++ b/patches/patch-set/0001-Record-teletext-subtitles.patch
@@ -1,37 +1,36 @@
-From 43914f1e49c368fbcc4d97e63e0e878de1238594 Mon Sep 17 00:00:00 2001
+From 21d95f17ee8373033602f0cc79d3589ae2978019 Mon Sep 17 00:00:00 2001
From: etobi <git@e-tobi.net>
Date: Fri, 12 Feb 2010 21:55:04 +0100
Subject: [PATCH 1/6] Record teletext subtitles
---
- channels.c | 7 +++++++
- channels.h | 14 ++++++++++++++
+ channels.c | 6 ++++++
+ channels.h | 16 ++++++++++++++++
pat.c | 18 +++++++++++++++++-
receiver.c | 2 +-
- remux.c | 28 ++++++++++++++++++++++++++++
- remux.h | 1 +
- 6 files changed, 68 insertions(+), 2 deletions(-)
+ remux.c | 29 +++++++++++++++++++++++++++++
+ remux.h | 3 +++
+ 6 files changed, 72 insertions(+), 2 deletions(-)
diff --git a/channels.c b/channels.c
-index c14df19..817b7d3 100644
+index c14df19..08ddf3e 100644
--- a/channels.c
+++ b/channels.c
-@@ -551,6 +551,13 @@ void cChannel::SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *Compos
+@@ -551,6 +551,12 @@ void cChannel::SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *Compos
}
}
-+void cChannel::SetTeletextSubtitlePages(tTeletextSubtitlePage pages[])
++void cChannel::SetTeletextSubtitlePages(tTeletextSubtitlePage pages[], int numberOfPages)
+{
-+ for (int i = 0; i < MAXTXTPAGES; i++)
-+ teletextSubtitlePages[i] = pages[i];
-+ teletextSubtitlePages[MAXTXTPAGES].ttxtType = 0;
++ for (int i = 0; (i < numberOfPages) && (totalTtxtSubtitlePages < MAXTXTPAGES); i++)
++ teletextSubtitlePages[totalTtxtSubtitlePages++] = pages[i];
+}
+
void cChannel::SetCaIds(const int *CaIds)
{
if (caids[0] && caids[0] <= CA_USER_MAX)
diff --git a/channels.h b/channels.h
-index b465f6a..18ed7c6 100644
+index b465f6a..acb346e 100644
--- a/channels.h
+++ b/channels.h
@@ -35,6 +35,7 @@
@@ -47,8 +46,8 @@ index b465f6a..18ed7c6 100644
};
+struct tTeletextSubtitlePage {
-+ tTeletextSubtitlePage(void) { ttxtPage = ttxtMagazine = ttxtType = ttxtLanguage[0] = 0; }
-+ tTeletextSubtitlePage(int page) { ttxtMagazine = (page / 100) & 0x7; ttxtPage = (((page % 100) / 10) << 4) + (page % 10); ttxtType = 0x02; }
++ tTeletextSubtitlePage(void) { ttxtPage = ttxtMagazine = 0; ttxtType = 0x02; strcpy(ttxtLanguage, "und"); }
++ tTeletextSubtitlePage(int page) { ttxtMagazine = (page / 100) & 0x7; ttxtPage = (((page % 100) / 10) << 4) + (page % 10); ttxtType = 0x02; strcpy(ttxtLanguage, "und"); }
+ char ttxtLanguage[MAXLANGCODE1];
+ uchar ttxtPage;
+ uchar ttxtMagazine;
@@ -59,32 +58,34 @@ index b465f6a..18ed7c6 100644
class cChannel;
class cLinkChannel : public cListObject {
-@@ -133,6 +144,7 @@ private:
+@@ -133,6 +144,8 @@ private:
uint16_t compositionPageIds[MAXSPIDS];
uint16_t ancillaryPageIds[MAXSPIDS];
int tpid;
-+ tTeletextSubtitlePage teletextSubtitlePages[MAXTXTPAGES + 1]; // list is termintated by ttxtType=0
++ int totalTtxtSubtitlePages;
++ tTeletextSubtitlePage teletextSubtitlePages[MAXTXTPAGES];
int caids[MAXCAIDS + 1]; // list is zero-terminated
int nid;
int tid;
-@@ -192,6 +204,7 @@ public:
+@@ -192,6 +205,8 @@ public:
uint16_t CompositionPageId(int i) const { return (0 <= i && i < MAXSPIDS) ? compositionPageIds[i] : uint16_t(0); }
uint16_t AncillaryPageId(int i) const { return (0 <= i && i < MAXSPIDS) ? ancillaryPageIds[i] : uint16_t(0); }
int Tpid(void) const { return tpid; }
-+ const tTeletextSubtitlePage TeletextSubtitlePage(int i) const { return (0 <= i && i < MAXTXTPAGES) ? teletextSubtitlePages[i] : tTeletextSubtitlePage(); };
++ const tTeletextSubtitlePage *TeletextSubtitlePages() const { return teletextSubtitlePages; };
++ int TotalTeletextSubtitlePages() const { return totalTtxtSubtitlePages; };
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; }
-@@ -228,6 +241,7 @@ public:
+@@ -228,6 +243,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 SetTeletextSubtitlePages(tTeletextSubtitlePage pages[]);
++ void SetTeletextSubtitlePages(tTeletextSubtitlePage pages[], int numberOfPages);
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 9b3ded6..f4be6a6 100644
+index 9b3ded6..ff25501 100644
--- a/pat.c
+++ b/pat.c
@@ -341,6 +341,8 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
@@ -123,7 +124,7 @@ index 9b3ded6..f4be6a6 100644
}
if (Setup.UpdateChannels >= 2) {
Channel->SetPids(Vpid, Ppid, Vtype, Apids, ALangs, Dpids, DLangs, Spids, SLangs, Tpid);
-+ Channel->SetTeletextSubtitlePages(TeletextSubtitlePages);
++ Channel->SetTeletextSubtitlePages(TeletextSubtitlePages, NumTPages);
Channel->SetCaIds(CaDescriptors->CaIds());
Channel->SetSubtitlingDescriptors(SubtitlingTypes, CompositionPageIds, AncillaryPageIds);
}
@@ -141,26 +142,26 @@ index f922e98..dab95b3 100644
return true;
}
diff --git a/remux.c b/remux.c
-index 070a06a..869b6e4 100644
+index 070a06a..b5c7a06 100644
--- a/remux.c
+++ b/remux.c
@@ -215,6 +215,29 @@ int cPatPmtGenerator::MakeSubtitlingDescriptor(uchar *Target, const char *Langua
return i;
}
-+int cPatPmtGenerator::MakeTeletextDescriptor(uchar *Target, const cChannel *Channel)
++int cPatPmtGenerator::MakeTeletextDescriptor(uchar *Target, const tTeletextSubtitlePage *pages, int pageCount)
+{
+ int i = 0, j = 0;
+ Target[i++] = SI::TeletextDescriptorTag;
+ int l = i;
+ Target[i++] = 0x00; // length
-+ for (int n = 0; Channel->TeletextSubtitlePage(n).ttxtType; n++) {
-+ const char* Language = Channel->TeletextSubtitlePage(n).ttxtLanguage;
++ for (int n = 0; n < pageCount; n++) {
++ const char* Language = pages[n].ttxtLanguage;
+ Target[i++] = *Language++;
+ Target[i++] = *Language++;
+ Target[i++] = *Language++;
-+ Target[i++] = (Channel->TeletextSubtitlePage(n).ttxtType << 3) + Channel->TeletextSubtitlePage(n).ttxtMagazine;
-+ Target[i++] = Channel->TeletextSubtitlePage(n).ttxtPage;
++ Target[i++] = (pages[n].ttxtType << 3) + pages[n].ttxtMagazine;
++ Target[i++] = pages[n].ttxtPage;
+ j++;
+ }
+ if (j > 0) {
@@ -188,23 +189,40 @@ index 070a06a..869b6e4 100644
}
+ if (Tpid) {
+ i += MakeStream(buf + i, 0x06, Tpid);
-+ i += MakeTeletextDescriptor(buf + i, Channel);
++ i += MakeTeletextDescriptor(buf + i, Channel->TeletextSubtitlePages(), Channel->TotalTeletextSubtitlePages());
+ }
int sl = i - SectionLength - 2 + 4; // -2 = SectionLength storage, +4 = length of CRC
buf[SectionLength] |= (sl >> 8) & 0x0F;
+@@ -493,6 +521,7 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
+ spids[0] = 0;
+ atypes[0] = 0;
+ dtypes[0] = 0;
++ totalTtxtSubtitlePages = 0;
+ SI::PMT::Stream stream;
+ for (SI::Loop::Iterator it; Pmt.streamLoop.getNext(stream, it); ) {
+ dbgpatpmt(" stream type = %02X, pid = %d", stream.getStreamType(), stream.getPid());
diff --git a/remux.h b/remux.h
-index 1115c4a..cef50d7 100644
+index 1115c4a..5ee6722 100644
--- a/remux.h
+++ b/remux.h
@@ -170,6 +170,7 @@ protected:
int MakeStream(uchar *Target, uchar Type, int Pid);
int MakeAC3Descriptor(uchar *Target);
int MakeSubtitlingDescriptor(uchar *Target, const char *Language, uchar SubtitlingType, uint16_t CompositionPageId, uint16_t AncillaryPageId);
-+ int MakeTeletextDescriptor(uchar *Target, const cChannel *Channel);
++ int MakeTeletextDescriptor(uchar *Target, const tTeletextSubtitlePage *pages, int pageCount);
int MakeLanguageDescriptor(uchar *Target, const char *Language);
int MakeCRC(uchar *Target, const uchar *Data, int Length);
void GeneratePmtPid(const cChannel *Channel);
+@@ -227,6 +228,8 @@ private:
+ uint16_t compositionPageIds[MAXSPIDS];
+ uint16_t ancillaryPageIds[MAXSPIDS];
+ bool updatePrimaryDevice;
++ int totalTtxtSubtitlePages;
++ tTeletextSubtitlePage teletextSubtitlePages[MAXTXTPAGES];
+ protected:
+ int SectionLength(const uchar *Data, int Length) { return (Length >= 3) ? ((int(Data[1]) & 0x0F) << 8)| Data[2] : 0; }
+ public:
--
1.6.5