1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
|
diff --git a/MANUAL b/MANUAL
index 54e166e..57b687f 100644
--- a/MANUAL
+++ b/MANUAL
@@ -730,6 +730,9 @@ Version 1.6
background transparency. By default the values as broadcast
are used.
+ Record Teletext Subtitles = no
+ If set to 'yes', teletext subtitles will be recorded.
+
LNB:
SLOF = 11700 The switching frequency (in MHz) between low and
diff --git a/Makefile b/Makefile
index 18d7eb9..3da4382 100644
--- a/Makefile
+++ b/Makefile
@@ -45,6 +45,8 @@ OBJS = audio.o channels.o ci.o config.o cutter.o device.o diseqc.o dvbdevice.o d
skinclassic.o skins.o skinsttng.o sourceparams.o sources.o spu.o status.o svdrp.o themes.o thread.o\
timers.o tools.o transfer.o vdr.o videodir.o
+OBJS += vdrttxtsubshooks.o
+
ifndef NO_KBD
DEFINES += -DREMOTE_KBD
endif
diff --git a/channels.c b/channels.c
index b9204f2..44d4be2 100644
--- a/channels.c
+++ b/channels.c
@@ -378,6 +378,26 @@ void cChannel::SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *Compos
}
}
+void cChannel::SetTeletextSubtitlePages(tTeletextSubtitlePage pages[], int numberOfPages)
+{
+ int mod = CHANNELMOD_NONE;
+ if (totalTtxtSubtitlePages != (fixedTtxtSubtitlePages + numberOfPages))
+ mod |= CHANNELMOD_PIDS;
+ totalTtxtSubtitlePages = fixedTtxtSubtitlePages;
+ for (int i = 0; (i < numberOfPages) && (totalTtxtSubtitlePages < MAXTXTPAGES); i++) {
+ if (teletextSubtitlePages[totalTtxtSubtitlePages].ttxtMagazine != pages[i].ttxtMagazine ||
+ teletextSubtitlePages[totalTtxtSubtitlePages].ttxtPage != pages[i].ttxtPage ||
+ teletextSubtitlePages[totalTtxtSubtitlePages].ttxtType != pages[i].ttxtType ||
+ strcmp(teletextSubtitlePages[totalTtxtSubtitlePages].ttxtLanguage, pages[i].ttxtLanguage)) {
+ mod |= CHANNELMOD_PIDS;
+ teletextSubtitlePages[totalTtxtSubtitlePages] = pages[i];
+ }
+ totalTtxtSubtitlePages++;
+ }
+ modification |= mod;
+ Channels.SetModified();
+}
+
void cChannel::SetCaIds(const int *CaIds)
{
if (caids[0] && caids[0] <= CA_USER_MAX)
@@ -506,10 +526,17 @@ 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
+ const int TBufferSize = (MAXTXTPAGES * 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->fixedTtxtSubtitlePages > 0) {
+ *q++ = '+';
+ for (int i = 0; i < Channel->fixedTtxtSubtitlePages; ++i) {
+ tTeletextSubtitlePage page = Channel->teletextSubtitlePages[i];
+ q += snprintf(q, sizeof(tpidbuf) - (q - tpidbuf), "%d=%s", page.PageNumber(), page.ttxtLanguage);
+ }
+ }
if (Channel->spids[0]) {
*q++ = ';';
q += IntArrayToString(q, Channel->spids, 10, Channel->slangs);
@@ -678,6 +705,32 @@ bool cChannel::Parse(const char *s)
}
spids[NumSpids] = 0;
}
+ fixedTtxtSubtitlePages = 0;
+ if ((p = strchr(tpidbuf, '+')) != NULL) {
+ *p++ = 0;
+ char *q;
+ char *strtok_next;
+ while ((q = strtok_r(p, ",", &strtok_next)) != NULL) {
+ if (fixedTtxtSubtitlePages < MAXTXTPAGES) {
+ int page;
+ char *l = strchr(q, '=');
+ if (l)
+ *l++ = 0;
+ if (sscanf(q, "%d", &page) == 1) {
+ teletextSubtitlePages[fixedTtxtSubtitlePages] = tTeletextSubtitlePage(page);
+ if (l)
+ strn0cpy(teletextSubtitlePages[fixedTtxtSubtitlePages].ttxtLanguage, l, MAXLANGCODE2);
+ fixedTtxtSubtitlePages++;
+ }
+ else
+ esyslog("ERROR: invalid Teletext page!"); // no need to set ok to 'false'
+ }
+ else
+ esyslog("ERROR: too many Teletext pages!"); // no need to set ok to 'false'
+ p = NULL;
+ }
+ totalTtxtSubtitlePages = fixedTtxtSubtitlePages;
+ }
if (sscanf(tpidbuf, "%d", &tpid) != 1)
return false;
if (caidbuf) {
diff --git a/channels.h b/channels.h
index 51f9830..6e7367f 100644
--- a/channels.h
+++ b/channels.h
@@ -35,6 +35,7 @@
#define MAXDPIDS 16 // dolby (AC3 + DTS)
#define MAXSPIDS 32 // subtitles
#define MAXCAIDS 12 // conditional access
+#define MAXTXTPAGES 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
@@ -71,6 +72,16 @@ public:
static const tChannelID InvalidID;
};
+struct tTeletextSubtitlePage {
+ 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;
+ uchar ttxtType;
+ int PageNumber(void) const { return BCDCHARTOINT(ttxtMagazine) * 100 + BCDCHARTOINT(ttxtPage); }
+ };
+
class cChannel;
class cLinkChannel : public cListObject {
@@ -115,6 +126,9 @@ private:
uint16_t compositionPageIds[MAXSPIDS];
uint16_t ancillaryPageIds[MAXSPIDS];
int tpid;
+ int fixedTtxtSubtitlePages;
+ int totalTtxtSubtitlePages;
+ tTeletextSubtitlePage teletextSubtitlePages[MAXTXTPAGES];
int caids[MAXCAIDS + 1]; // list is zero-terminated
int nid;
int tid;
@@ -164,6 +178,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 *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; }
@@ -190,6 +206,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, int *Atypes, char ALangs[][MAXLANGCODE2], int *Dpids, int *Dtypes, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid);
+ 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/ci.c b/ci.c
index 59d62ef..b024f67 100644
--- a/ci.c
+++ b/ci.c
@@ -1913,6 +1913,8 @@ void cCamSlot::AddChannel(const cChannel *Channel)
AddPid(Channel->Sid(), *Dpid, STREAM_TYPE_PRIVATE);
for (const int *Spid = Channel->Spids(); *Spid; Spid++)
AddPid(Channel->Sid(), *Spid, STREAM_TYPE_PRIVATE);
+ if (Channel->Tpid() && Setup.SupportTeletext)
+ AddPid(Channel->Sid(), Channel->Tpid(), STREAM_TYPE_PRIVATE);
}
}
@@ -1936,6 +1938,9 @@ bool cCamSlot::CanDecrypt(const cChannel *Channel)
CaPmt.AddPid(*Dpid, STREAM_TYPE_PRIVATE);
for (const int *Spid = Channel->Spids(); *Spid; Spid++)
CaPmt.AddPid(*Spid, STREAM_TYPE_PRIVATE);
+ if (Channel->Tpid() && Setup.SupportTeletext) {
+ CaPmt.AddPid(Channel->Tpid(), STREAM_TYPE_PRIVATE);
+ }
cas->SendPMT(&CaPmt);
cTimeMs Timeout(QUERY_REPLY_TIMEOUT);
do {
diff --git a/config.c b/config.c
index 73bb00d..982bd78 100644
--- a/config.c
+++ b/config.c
@@ -333,6 +333,7 @@ cSetup::cSetup(void)
MarginStop = 10;
AudioLanguages[0] = -1;
DisplaySubtitles = 0;
+ SupportTeletext = 0;
SubtitleLanguages[0] = -1;
SubtitleOffset = 0;
SubtitleFgTransparency = 0;
@@ -525,6 +526,7 @@ bool cSetup::Parse(const char *Name, const char *Value)
else if (!strcasecmp(Name, "MarginStop")) MarginStop = atoi(Value);
else if (!strcasecmp(Name, "AudioLanguages")) return ParseLanguages(Value, AudioLanguages);
else if (!strcasecmp(Name, "DisplaySubtitles")) DisplaySubtitles = atoi(Value);
+ else if (!strcasecmp(Name, "SupportTeletext")) SupportTeletext = atoi(Value);
else if (!strcasecmp(Name, "SubtitleLanguages")) return ParseLanguages(Value, SubtitleLanguages);
else if (!strcasecmp(Name, "SubtitleOffset")) SubtitleOffset = atoi(Value);
else if (!strcasecmp(Name, "SubtitleFgTransparency")) SubtitleFgTransparency = atoi(Value);
@@ -621,6 +623,7 @@ bool cSetup::Save(void)
Store("MarginStop", MarginStop);
StoreLanguages("AudioLanguages", AudioLanguages);
Store("DisplaySubtitles", DisplaySubtitles);
+ Store("SupportTeletext", SupportTeletext);
StoreLanguages("SubtitleLanguages", SubtitleLanguages);
Store("SubtitleOffset", SubtitleOffset);
Store("SubtitleFgTransparency", SubtitleFgTransparency);
diff --git a/config.h b/config.h
index c51e3df..e46b4bd 100644
--- a/config.h
+++ b/config.h
@@ -235,6 +235,7 @@ public:
int MarginStart, MarginStop;
int AudioLanguages[I18N_MAX_LANGUAGES + 1];
int DisplaySubtitles;
+ int SupportTeletext;
int SubtitleLanguages[I18N_MAX_LANGUAGES + 1];
int SubtitleOffset;
int SubtitleFgTransparency, SubtitleBgTransparency;
diff --git a/device.c b/device.c
index ba098d8..84bdd30 100644
--- a/device.c
+++ b/device.c
@@ -18,6 +18,7 @@
#include "receiver.h"
#include "status.h"
#include "transfer.h"
+#include "vdrttxtsubshooks.h"
// --- cLiveSubtitle ---------------------------------------------------------
@@ -1250,6 +1251,13 @@ int cDevice::PlayPesPacket(const uchar *Data, int Length, bool VideoOnly)
}
break;
case 0xBD: { // private stream 1
+ // EBU Teletext data, ETSI EN 300 472
+ // if PES data header length = 24 and data_identifier = 0x10..0x1F (EBU Data)
+ if (Data[8] == 0x24 && Data[45] >= 0x10 && Data[45] < 0x20) {
+ cVDRTtxtsubsHookListener::Hook()->PlayerTeletextData((uint8_t*)Data, Length);
+ break;
+ }
+
int PayloadOffset = Data[8] + 9;
// Compatibility mode for old subtitles plugin:
@@ -1409,6 +1417,7 @@ int cDevice::PlayTs(const uchar *Data, int Length, bool VideoOnly)
tsToPesVideo.Reset();
tsToPesAudio.Reset();
tsToPesSubtitle.Reset();
+ tsToPesTeletext.Reset();
}
else if (Length < TS_SIZE) {
esyslog("ERROR: skipped %d bytes of TS fragment", Length);
@@ -1454,6 +1463,17 @@ int cDevice::PlayTs(const uchar *Data, int Length, bool VideoOnly)
if (!VideoOnly || HasIBPTrickSpeed())
PlayTsSubtitle(Data, TS_SIZE);
}
+ else if (Pid == patPmtParser.Tpid()) {
+ if (!VideoOnly || HasIBPTrickSpeed()) {
+ int l;
+ tsToPesTeletext.PutTs(Data, Length);
+ if (const uchar *p = tsToPesTeletext.GetPes(l)) {
+ if ((l > 45) && (p[0] == 0x00) && (p[1] == 0x00) && (p[2] == 0x01) && (p[3] == 0xbd) && (p[8] == 0x24) && (p[45] >= 0x10) && (p[45] < 0x20))
+ cVDRTtxtsubsHookListener::Hook()->PlayerTeletextData((uchar *)p, l, false, patPmtParser.TeletextSubtitlePages(), patPmtParser.TotalTeletextSubtitlePages());
+ tsToPesTeletext.Reset();
+ }
+ }
+ }
}
}
else if (Pid == patPmtParser.Ppid()) {
diff --git a/device.h b/device.h
index fd587a8..078f080 100644
--- a/device.h
+++ b/device.h
@@ -538,6 +538,7 @@ private:
cTsToPes tsToPesVideo;
cTsToPes tsToPesAudio;
cTsToPes tsToPesSubtitle;
+ cTsToPes tsToPesTeletext;
bool isPlayingVideo;
protected:
const cPatPmtParser *PatPmtParser(void) const { return &patPmtParser; }
diff --git a/menu.c b/menu.c
index ef2bb46..3548ccd 100644
--- a/menu.c
+++ b/menu.c
@@ -2798,6 +2798,7 @@ void cMenuSetupDVB::Setup(void)
Add(new cMenuEditIntItem( tr("Setup.DVB$Subtitle foreground transparency"), &data.SubtitleFgTransparency, 0, 9));
Add(new cMenuEditIntItem( tr("Setup.DVB$Subtitle background transparency"), &data.SubtitleBgTransparency, 0, 10));
}
+ Add(new cMenuEditBoolItem(tr("Setup.DVB$Enable teletext support"), &data.SupportTeletext));
SetCurrent(Get(current));
Display();
diff --git a/po/ca_ES.po b/po/ca_ES.po
index b104fea..1c09d79 100644
--- a/po/ca_ES.po
+++ b/po/ca_ES.po
@@ -950,6 +950,9 @@ msgstr "Transpar
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Transparncia fons subttols"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "Configuraci de l'LNB"
diff --git a/po/cs_CZ.po b/po/cs_CZ.po
index bcafac7..370609f 100644
--- a/po/cs_CZ.po
+++ b/po/cs_CZ.po
@@ -949,6 +949,9 @@ msgstr "Průhlednost písma titulků"
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Průhlednost pozadí titulků"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/da_DK.po b/po/da_DK.po
index 81b11eb..5daca8d 100644
--- a/po/da_DK.po
+++ b/po/da_DK.po
@@ -947,6 +947,9 @@ msgstr "Undertekst forgrundsgennemsigtighed"
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Undertekst baggrundsgennemsigtighed"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/de_DE.po b/po/de_DE.po
index 6d5b822..0a00a5a 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -947,6 +947,9 @@ msgstr "Untertitel-Transparenz Vordergrund"
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Untertitel-Transparenz Hintergrund"
+msgid "Setup.DVB$Enable teletext support"
+msgstr "Videotext-Untersttzung aktivieren"
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/el_GR.po b/po/el_GR.po
index 9756ea7..5d4d6ea 100644
--- a/po/el_GR.po
+++ b/po/el_GR.po
@@ -947,6 +947,9 @@ msgstr ""
msgid "Setup.DVB$Subtitle background transparency"
msgstr ""
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/es_ES.po b/po/es_ES.po
index 193e75e..1f36b60 100644
--- a/po/es_ES.po
+++ b/po/es_ES.po
@@ -948,6 +948,9 @@ msgstr "Transparencia primer plano subt
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Transparencia fondo subttulos"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/et_EE.po b/po/et_EE.po
index 49794dd..83ff319 100644
--- a/po/et_EE.po
+++ b/po/et_EE.po
@@ -947,6 +947,9 @@ msgstr "Subtiitri l
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Subtiitri tausta lbipaistvus"
+msgid "Setup.DVB$Enable teletext support"
+msgstr "Teleteksti tugi"
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/fi_FI.po b/po/fi_FI.po
index b093e88..4abf6a8 100644
--- a/po/fi_FI.po
+++ b/po/fi_FI.po
@@ -950,6 +950,9 @@ msgstr "Tekstityksen läpinäkyvyys"
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Tekstityksen taustan läpinäkyvyys"
+msgid "Setup.DVB$Enable teletext support"
+msgstr "Salli teksti-TV-tuki"
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/fr_FR.po b/po/fr_FR.po
index b5c5120..86a961a 100644
--- a/po/fr_FR.po
+++ b/po/fr_FR.po
@@ -953,6 +953,9 @@ msgstr "Transparence de l'avant-plan"
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Transparence du fond"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/hr_HR.po b/po/hr_HR.po
index ed519a2..43f2ea5 100644
--- a/po/hr_HR.po
+++ b/po/hr_HR.po
@@ -949,6 +949,9 @@ msgstr "Transparentnost titla"
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Transparentnost pozadine titla"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/hu_HU.po b/po/hu_HU.po
index 17b905f..06f4505 100644
--- a/po/hu_HU.po
+++ b/po/hu_HU.po
@@ -950,6 +950,9 @@ msgstr "Felirat transzparenci
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Felirat htternek transzparencija"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/it_IT.po b/po/it_IT.po
index 501300e..e0227d3 100644
--- a/po/it_IT.po
+++ b/po/it_IT.po
@@ -954,6 +954,9 @@ msgstr "Trasparenza sottotitoli"
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Trasparenza sfondo sottotitoli"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/lt_LT.po b/po/lt_LT.po
index 6cb1faa..4efc707 100644
--- a/po/lt_LT.po
+++ b/po/lt_LT.po
@@ -947,6 +947,9 @@ msgstr "Subtitrų fonto permatomumas"
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Subtitrų fono permatomumas"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "Konverteris (LNB)"
diff --git a/po/nl_NL.po b/po/nl_NL.po
index ae2b85e..34a71e9 100644
--- a/po/nl_NL.po
+++ b/po/nl_NL.po
@@ -951,6 +951,9 @@ msgstr "Transparantie voorgrond ondertiteling"
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Transparantie achtergrond ondertiteling"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/nn_NO.po b/po/nn_NO.po
index 8ec8dfb..9c129ee 100644
--- a/po/nn_NO.po
+++ b/po/nn_NO.po
@@ -948,6 +948,9 @@ msgstr ""
msgid "Setup.DVB$Subtitle background transparency"
msgstr ""
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/pl_PL.po b/po/pl_PL.po
index a5c1b47..9645eca 100644
--- a/po/pl_PL.po
+++ b/po/pl_PL.po
@@ -948,6 +948,9 @@ msgstr "Prze
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Przerocze podtytuw: To"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/pt_PT.po b/po/pt_PT.po
index c443312..3c108ea 100644
--- a/po/pt_PT.po
+++ b/po/pt_PT.po
@@ -948,6 +948,9 @@ msgstr "Transpar
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Transparncia de fundo das legendas"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/ro_RO.po b/po/ro_RO.po
index f8c5a1e..35ec9ec 100644
--- a/po/ro_RO.po
+++ b/po/ro_RO.po
@@ -950,6 +950,9 @@ msgstr "Transparen
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Transparena fundalului subtitrrii"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/ru_RU.po b/po/ru_RU.po
index e683b8b..b90e565 100644
--- a/po/ru_RU.po
+++ b/po/ru_RU.po
@@ -948,6 +948,9 @@ msgstr "
msgid "Setup.DVB$Subtitle background transparency"
msgstr " "
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr ""
diff --git a/po/sk_SK.po b/po/sk_SK.po
index 46edef5..aabb641 100644
--- a/po/sk_SK.po
+++ b/po/sk_SK.po
@@ -947,6 +947,9 @@ msgstr "Prieh
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Priehadnos pozadia titulkov"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/sl_SI.po b/po/sl_SI.po
index 89c6923..8ef4387 100644
--- a/po/sl_SI.po
+++ b/po/sl_SI.po
@@ -948,6 +948,9 @@ msgstr "Transparentnost podnapisov"
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Transparentnost ozadja podnapisov"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/sv_SE.po b/po/sv_SE.po
index 150f95e..020c64d 100644
--- a/po/sv_SE.po
+++ b/po/sv_SE.po
@@ -950,6 +950,9 @@ msgstr "Transparent f
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Transparent bakgrund textremsa"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/tr_TR.po b/po/tr_TR.po
index 194943b..338c649 100644
--- a/po/tr_TR.po
+++ b/po/tr_TR.po
@@ -947,6 +947,9 @@ msgstr "Altyaz
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Altyaz arka effaflk"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "LNB"
diff --git a/po/uk_UA.po b/po/uk_UA.po
index 433ec70..c0a7947 100644
--- a/po/uk_UA.po
+++ b/po/uk_UA.po
@@ -947,6 +947,9 @@ msgstr "Прозорість переднього плану субтитрів"
msgid "Setup.DVB$Subtitle background transparency"
msgstr "Прозорість заднього плану субтитрів"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "Конвертер"
diff --git a/po/zh_CN.po b/po/zh_CN.po
index c28fe88..8a594e3 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -950,6 +950,9 @@ msgstr "字幕前景透明度"
msgid "Setup.DVB$Subtitle background transparency"
msgstr "字幕背景透明度"
+msgid "Setup.DVB$Enable teletext support"
+msgstr ""
+
msgid "LNB"
msgstr "切换器设置"
diff --git a/receiver.c b/receiver.c
index 6a9ba04..a5c8967 100644
--- a/receiver.c
+++ b/receiver.c
@@ -81,7 +81,8 @@ bool cReceiver::SetPids(const cChannel *Channel)
(Channel->Ppid() == Channel->Vpid() || AddPid(Channel->Ppid())) &&
AddPids(Channel->Apids()) &&
AddPids(Channel->Dpids()) &&
- AddPids(Channel->Spids());
+ AddPids(Channel->Spids()) &&
+ (!Setup.SupportTeletext || AddPid(Channel->Tpid()));
}
return true;
}
diff --git a/remux.c b/remux.c
index 78ab294..4f9950f 100644
--- a/remux.c
+++ b/remux.c
@@ -219,6 +219,29 @@ int cPatPmtGenerator::MakeSubtitlingDescriptor(uchar *Target, const char *Langua
return i;
}
+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; n < pageCount; n++) {
+ const char* Language = pages[n].ttxtLanguage;
+ Target[i++] = *Language++;
+ Target[i++] = *Language++;
+ Target[i++] = *Language++;
+ Target[i++] = (pages[n].ttxtType << 3) + pages[n].ttxtMagazine;
+ Target[i++] = pages[n].ttxtPage;
+ j++;
+ }
+ if (j > 0) {
+ Target[l] = j * 5; // update length
+ IncEsInfoLength(i);
+ return i;
+ }
+ return 0;
+}
+
int cPatPmtGenerator::MakeLanguageDescriptor(uchar *Target, const char *Language)
{
int i = 0;
@@ -306,6 +329,7 @@ void cPatPmtGenerator::GeneratePmt(const cChannel *Channel)
if (Channel) {
int Vpid = Channel->Vpid();
int Ppid = Channel->Ppid();
+ int Tpid = Channel->Tpid();
uchar *p = buf;
int i = 0;
p[i++] = 0x02; // table id
@@ -338,6 +362,10 @@ void cPatPmtGenerator::GeneratePmt(const cChannel *Channel)
i += MakeStream(buf + i, 0x06, Channel->Spid(n));
i += MakeSubtitlingDescriptor(buf + i, Channel->Slang(n), Channel->SubtitlingType(n), Channel->CompositionPageId(n), Channel->AncillaryPageId(n));
}
+ if (Tpid) {
+ i += MakeStream(buf + i, 0x06, Tpid);
+ 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;
@@ -411,6 +439,7 @@ void cPatPmtParser::Reset(void)
pmtPid = -1;
vpid = vtype = 0;
ppid = 0;
+ tpid = 0;
}
void cPatPmtParser::ParsePat(const uchar *Data, int Length)
@@ -496,11 +525,13 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
int NumSpids = 0;
vpid = vtype = 0;
ppid = 0;
+ tpid = 0;
apids[0] = 0;
dpids[0] = 0;
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());
@@ -599,6 +630,28 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
spids[NumSpids]= 0;
}
break;
+ case SI::TeletextDescriptorTag: {
+ dbgpatpmt(" teletext");
+ tpid = stream.getPid();
+ SI::TeletextDescriptor *sd = (SI::TeletextDescriptor *)d;
+ SI::TeletextDescriptor::Teletext ttxt;
+ if (totalTtxtSubtitlePages < MAXTXTPAGES) {
+ for (SI::Loop::Iterator it; sd->teletextLoop.getNext(ttxt, it); ) {
+ bool isSubtitlePage = (ttxt.getTeletextType() == 0x02) || (ttxt.getTeletextType() == 0x05);
+ if (isSubtitlePage && ttxt.languageCode[0]) {
+ dbgpatpmt(" '%s:%x.%x'", ttxt.languageCode, ttxt.getTeletextMagazineNumber(), ttxt.getTeletextPageNumber());
+ strn0cpy(teletextSubtitlePages[totalTtxtSubtitlePages].ttxtLanguage, I18nNormalizeLanguageCode(ttxt.languageCode), MAXLANGCODE1);
+ teletextSubtitlePages[totalTtxtSubtitlePages].ttxtPage = ttxt.getTeletextPageNumber();
+ teletextSubtitlePages[totalTtxtSubtitlePages].ttxtMagazine = ttxt.getTeletextMagazineNumber();
+ teletextSubtitlePages[totalTtxtSubtitlePages].ttxtType = ttxt.getTeletextType();
+ totalTtxtSubtitlePages++;
+ if (totalTtxtSubtitlePages >= MAXTXTPAGES)
+ break;
+ }
+ }
+ }
+ }
+ break;
case SI::ISO639LanguageDescriptorTag: {
SI::ISO639LanguageDescriptor *ld = (SI::ISO639LanguageDescriptor *)d;
dbgpatpmt(" '%s'", ld->languageCode);
diff --git a/remux.h b/remux.h
index b882279..4af51e5 100644
--- a/remux.h
+++ b/remux.h
@@ -174,6 +174,7 @@ protected:
int MakeStream(uchar *Target, uchar Type, int Pid);
int MakeAC3Descriptor(uchar *Target, uchar Type);
int MakeSubtitlingDescriptor(uchar *Target, const char *Language, uchar SubtitlingType, uint16_t CompositionPageId, uint16_t AncillaryPageId);
+ 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);
@@ -219,6 +220,7 @@ private:
int vpid;
int ppid;
int vtype;
+ int tpid;
int apids[MAXAPIDS + 1]; // list is zero-terminated
int atypes[MAXAPIDS + 1]; // list is zero-terminated
char alangs[MAXAPIDS][MAXLANGCODE2];
@@ -231,6 +233,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:
@@ -263,6 +267,9 @@ public:
int Vtype(void) const { return vtype; }
///< Returns the video stream type as defined by the current PMT, or 0 if no video
///< stream type has been detected, yet.
+ int Tpid(void) { return tpid; }
+ ///< Returns the teletext pid as defined by the current PMT, or 0 if no teletext
+ ///< pid has been detected, yet.
const int *Apids(void) const { return apids; }
const int *Dpids(void) const { return dpids; }
const int *Spids(void) const { return spids; }
@@ -277,6 +284,8 @@ public:
uchar SubtitlingType(int i) const { return (0 <= i && i < MAXSPIDS) ? subtitlingTypes[i] : uchar(0); }
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); }
+ const tTeletextSubtitlePage *TeletextSubtitlePages() const { return teletextSubtitlePages; }
+ int TotalTeletextSubtitlePages() const { return totalTtxtSubtitlePages; }
};
// TS to PES converter:
diff --git a/vdr.5 b/vdr.5
index c46a2bf..96e142a 100644
--- a/vdr.5
+++ b/vdr.5
@@ -225,6 +225,12 @@ by an '=' sign, as in
.B ...:201;2001=deu,2002=eng:...
+Manual teletext subtitling pages can be defined separated by a '+' sign.
+The pages (separated by commas) can contain language codes, delimited by a '='
+sign, as in
+
+.B ...:201+150=deu,151=fin;2001,2002:...
+
.TP
.B Conditional access
A hexadecimal integer defining how this channel can be accessed:
diff --git a/vdrttxtsubshooks.c b/vdrttxtsubshooks.c
new file mode 100644
index 0000000..2471788
--- /dev/null
+++ b/vdrttxtsubshooks.c
@@ -0,0 +1,63 @@
+/*
+ * vdr-ttxtsubs - A plugin for the Linux Video Disk Recorder
+ * Copyright (c) 2003 - 2008 Ragnar Sundblad <ragge@nada.kth.se>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+
+#include "vdrttxtsubshooks.h"
+
+// XXX Really should be a list...
+static cVDRTtxtsubsHookListener *gListener;
+
+// ------ class cVDRTtxtsubsHookProxy ------
+
+class cVDRTtxtsubsHookProxy : public cVDRTtxtsubsHookListener
+{
+ public:
+ virtual void HideOSD(void) { if(gListener) gListener->HideOSD(); };
+ virtual void ShowOSD(void) { if(gListener) gListener->ShowOSD(); };
+ virtual void PlayerTeletextData(uint8_t *p, int length, bool IsPesRecording, const struct tTeletextSubtitlePage teletextSubtitlePages[] = NULL, int pageCount = 0)
+ { if(gListener) gListener->PlayerTeletextData(p, length, IsPesRecording, teletextSubtitlePages, pageCount); };
+ virtual int ManualPageNumber(const cChannel *channel)
+ { if(gListener) return gListener->ManualPageNumber(channel); else return 0; };
+};
+
+
+// ------ class cVDRTtxtsubsHookListener ------
+
+cVDRTtxtsubsHookListener::~cVDRTtxtsubsHookListener()
+{
+ gListener = 0;
+}
+
+void cVDRTtxtsubsHookListener::HookAttach(void)
+{
+ gListener = this;
+ //printf("cVDRTtxtsubsHookListener::HookAttach\n");
+}
+
+static cVDRTtxtsubsHookProxy gProxy;
+
+cVDRTtxtsubsHookListener *cVDRTtxtsubsHookListener::Hook(void)
+{
+ return &gProxy;
+}
+
diff --git a/vdrttxtsubshooks.h b/vdrttxtsubshooks.h
new file mode 100644
index 0000000..2f97969
--- /dev/null
+++ b/vdrttxtsubshooks.h
@@ -0,0 +1,46 @@
+/*
+ * vdr-ttxtsubs - A plugin for the Linux Video Disk Recorder
+ * Copyright (c) 2003 - 2008 Ragnar Sundblad <ragge@nada.kth.se>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __VDRTTXTSUBSHOOKS_H
+#define __VDRTTXTSUBSHOOKS_H
+
+#define TTXTSUBSVERSNUM 2
+
+class cDevice;
+class cChannel;
+struct tTeletextSubtitlePage;
+
+class cVDRTtxtsubsHookListener {
+ public:
+ cVDRTtxtsubsHookListener(void) {};
+ virtual ~cVDRTtxtsubsHookListener();
+
+ void HookAttach(void);
+
+ virtual void HideOSD(void) {};
+ virtual void ShowOSD(void) {};
+ virtual void PlayerTeletextData(uint8_t *p, int length, bool IsPesRecording = true, const struct tTeletextSubtitlePage teletextSubtitlePages[] = NULL, int pageCount = 0) {};
+ virtual int ManualPageNumber(const cChannel *channel) { return 0; };
+
+ // used by VDR to call hook listeners
+ static cVDRTtxtsubsHookListener *Hook(void);
+};
+
+#endif
|