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
|
diff -upr ./DIST/vdr-1.2.5/Makefile ./Makefile
--- ./DIST/vdr-1.2.5/Makefile 2003-08-09 13:09:45.000000000 +0200
+++ ./Makefile 2003-09-26 01:49:20.000000000 +0200
@@ -37,7 +37,8 @@ OBJS = audio.o channels.o ci.o config.o
dvbplayer.o dvbspu.o eit.o eitscan.o font.o i18n.o interface.o keys.o\
lirc.o menu.o menuitems.o osdbase.o osd.o player.o plugin.o rcu.o\
receiver.o recorder.o recording.o remote.o remux.o ringbuffer.o sources.o\
- spu.o status.o svdrp.o thread.o timers.o tools.o transfer.o vdr.o videodir.o
+ spu.o status.o svdrp.o thread.o timers.o tools.o transfer.o vdr.o videodir.o\
+ vdrttxtsubshooks.o
OSDFONT = -adobe-helvetica-medium-r-normal--23-*-100-100-p-*-iso8859-1
FIXFONT = -adobe-courier-bold-r-normal--25-*-100-100-m-*-iso8859-1
diff -upr ./DIST/vdr-1.2.5/dvbplayer.c ./dvbplayer.c
--- ./DIST/vdr-1.2.5/dvbplayer.c 2003-05-24 11:04:26.000000000 +0200
+++ ./dvbplayer.c 2003-09-26 01:49:20.000000000 +0200
@@ -14,6 +14,7 @@
#include "ringbuffer.h"
#include "thread.h"
#include "tools.h"
+#include "vdrttxtsubshooks.h"
// --- cBackTrace ----------------------------------------------------------
@@ -323,6 +324,12 @@ void cDvbPlayer::StripAudioPackets(uchar
int l = b[i + 4] * 256 + b[i + 5] + 6;
switch (c) {
case 0xBD: // dolby
+#ifdef VDRTTXTSUBSHOOKS
+ if (b[i + 8] == 0x24 && b[i + 45] >= 0x10 && b[i + 45] < 0x20) {
+ break; // run these through the ring buffer to get somewhat correct
+ // timing for the subtitles
+ } else
+#endif
if (Except)
PlayAudio(&b[i], l);
// continue with deleting the data - otherwise it disturbs DVB replay
@@ -349,6 +356,40 @@ void cDvbPlayer::StripAudioPackets(uchar
}
}
+#ifdef VDRTTXTSUBSHOOKS
+static void StripTtxtPackets(uchar *b, int Length)
+{
+ for (int i = 0; i < Length - 6; i++) {
+ if (b[i] == 0x00 && b[i + 1] == 0x00 && b[i + 2] == 0x01) {
+ uchar c = b[i + 3];
+ int l = b[i + 4] * 256 + b[i + 5] + 6;
+ switch (c) {
+ case 0xBD: // dolby
+ {
+ if (b[i + 8] == 0x24 && b[i + 45] >= 0x10 && b[i + 45] < 0x20) {
+ // EBU Teletext data, ETSI EN 300 472
+ cVDRTtxtsubsHookListener::Hook()->PlayerTeletextData(&b[i], l);
+ }
+ // continue with deleting the data - otherwise it disturbs DVB replay
+ int n = l;
+ for (int j = i; j < Length && n--; j++)
+ b[j] = 0x00;
+ break;
+ }
+ default:
+ break;
+ }
+ if (l)
+ i += l - 1; // the loop increments, too!
+ }
+ /*XXX
+ else
+ esyslog("ERROR: broken packet header");
+ XXX*/
+ }
+}
+#endif
+
bool cDvbPlayer::NextFile(uchar FileNumber, int FileOffset)
{
if (FileNumber > 0)
@@ -524,6 +565,11 @@ void cDvbPlayer::Action(void)
StripAudioPackets(p, pc, AudioTrack);
}
}
+#ifdef VDRTTXTSUBSHOOKS
+ // pick out the teletext packets here
+ if(p)
+ StripTtxtPackets((uchar *) p, pc);
+#endif
if (p) {
int w = PlayVideo(p, pc);
if (w > 0) {
diff -upr ./DIST/vdr-1.2.5/menu.c ./menu.c
--- ./DIST/vdr-1.2.5/menu.c 2003-09-14 12:49:28.000000000 +0200
+++ ./menu.c 2003-09-26 01:50:59.000000000 +0200
@@ -3014,8 +3014,18 @@ cRecordControl::cRecordControl(cDevice *
isyslog("record %s", fileName);
if (MakeDirs(fileName, true)) {
const cChannel *ch = timer->Channel();
+#ifdef VDRTTXTSUBSHOOKS
+ cTtxtSubsRecorderBase *subsRecorder = cVDRTtxtsubsHookListener::Hook()
+ ->NewTtxtSubsRecorder(device, ch);
+ recorder = new cRecorder(fileName, ch->Ca(), timer->Priority(), ch->Vpid(), ch->Apid1(), ch->Apid2(), ch->Dpid1(), ch->Dpid2(), subsRecorder);
+#else
recorder = new cRecorder(fileName, ch->Ca(), timer->Priority(), ch->Vpid(), ch->Apid1(), ch->Apid2(), ch->Dpid1(), ch->Dpid2());
+#endif
if (device->AttachReceiver(recorder)) {
+#ifdef VDRTTXTSUBSHOOKS
+ if(subsRecorder)
+ subsRecorder->DeviceAttach();
+#endif
Recording.WriteSummary();
cStatus::MsgRecording(device, Recording.Name());
if (!Timer && !cReplayControl::LastReplayed()) // an instant recording, maybe from cRecordControls::PauseLiveVideo()
diff -upr ./DIST/vdr-1.2.5/menu.h ./menu.h
--- ./DIST/vdr-1.2.5/menu.h 2003-08-03 11:37:18.000000000 +0200
+++ ./menu.h 2003-09-26 01:49:20.000000000 +0200
@@ -14,6 +14,7 @@
#include "device.h"
#include "osd.h"
#include "dvbplayer.h"
+#include "vdrttxtsubshooks.h"
#include "recorder.h"
#include "recording.h"
diff -upr ./DIST/vdr-1.2.5/osd.c ./osd.c
--- ./DIST/vdr-1.2.5/osd.c 2003-06-04 18:13:00.000000000 +0200
+++ ./osd.c 2003-09-26 01:49:20.000000000 +0200
@@ -12,6 +12,7 @@
#include "device.h"
#include "i18n.h"
#include "status.h"
+#include "vdrttxtsubshooks.h"
// --- cOsd ------------------------------------------------------------------
@@ -62,6 +63,10 @@ void cOsd::SetColor(eDvbColor colorFg, e
cOsdBase *cOsd::OpenRaw(int x, int y)
{
+#ifdef VDRTTXTSUBSHOOKS
+ // OSD_HOOK_2 - Information to Checkpatch.sh
+ cVDRTtxtsubsHookListener::Hook()->HideOSD();
+#endif
#ifdef DEBUG_OSD
return NULL;
#else
@@ -138,6 +143,9 @@ void cOsd::Close(void)
delete osd;
osd = NULL;
#endif
+#ifdef VDRTTXTSUBSHOOKS
+ cVDRTtxtsubsHookListener::Hook()->ShowOSD();
+#endif
}
void cOsd::Clear(void)
diff -upr ./DIST/vdr-1.2.5/recorder.c ./recorder.c
--- ./DIST/vdr-1.2.5/recorder.c 2003-08-02 15:01:19.000000000 +0200
+++ ./recorder.c 2003-09-26 01:52:35.000000000 +0200
@@ -10,6 +10,8 @@
#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>
+#include <stdint.h>
+#include "vdrttxtsubshooks.h"
#include "recorder.h"
// The size of the array used to buffer video data:
@@ -23,7 +25,11 @@
#define MINFREEDISKSPACE (512) // MB
#define DISKCHECKINTERVAL 100 // seconds
+#ifdef VDRTTXTSUBSHOOKS
+cRecorder::cRecorder(const char *FileName, int Ca, int Priority, int VPid, int APid1, int APid2, int DPid1, int DPid2, cTtxtSubsRecorderBase *tsr)
+#else
cRecorder::cRecorder(const char *FileName, int Ca, int Priority, int VPid, int APid1, int APid2, int DPid1, int DPid2)
+#endif
:cReceiver(Ca, Priority, 5, VPid, APid1, APid2, DPid1, DPid2)
{
ringBuffer = NULL;
@@ -34,6 +40,9 @@ cRecorder::cRecorder(const char *FileNam
fileSize = 0;
active = false;
lastDiskSpaceCheck = time(NULL);
+#ifdef VDRTTXTSUBSHOOKS
+ ttxtSubsRecorder = tsr;
+#endif
// Make sure the disk is up and running:
@@ -55,6 +64,10 @@ cRecorder::cRecorder(const char *FileNam
cRecorder::~cRecorder()
{
Detach();
+#ifdef VDRTTXTSUBSHOOKS
+ if(ttxtSubsRecorder)
+ delete ttxtSubsRecorder;
+#endif
delete index;
delete fileName;
delete remux;
@@ -129,6 +142,19 @@ void cRecorder::Action(void)
break;
}
fileSize += Result;
+#ifdef VDRTTXTSUBSHOOKS
+ // not sure if the pictureType test is needed, but it seems we can get
+ // incomplete pes packets from remux if we are not getting pictures?
+ if (ttxtSubsRecorder && pictureType != NO_PICTURE) {
+ uint8_t *subsp;
+ size_t len;
+ if(ttxtSubsRecorder->GetPacket(&subsp, &len)) {
+ safe_write(recordFile, subsp, len);
+ fileSize += len;
+ // fprintf(stderr, "cRecorder::Action: Wrote ttxtsubs data len %d\n", len); // XXX
+ }
+ }
+#endif
}
else
break;
diff -upr ./DIST/vdr-1.2.5/recorder.h ./recorder.h
--- ./DIST/vdr-1.2.5/recorder.h 2002-06-08 11:35:03.000000000 +0200
+++ ./recorder.h 2003-09-26 01:49:20.000000000 +0200
@@ -15,6 +15,7 @@
#include "remux.h"
#include "ringbuffer.h"
#include "thread.h"
+#include "vdrttxtsubshooks.h"
class cRecorder : public cReceiver, cThread {
private:
@@ -29,12 +30,19 @@ private:
time_t lastDiskSpaceCheck;
bool RunningLowOnDiskSpace(void);
bool NextFile(void);
+#ifdef VDRTTXTSUBSHOOKS
+ cTtxtSubsRecorderBase *ttxtSubsRecorder;
+#endif
protected:
virtual void Activate(bool On);
virtual void Receive(uchar *Data, int Length);
virtual void Action(void);
public:
+#ifdef VDRTTXTSUBSHOOKS
+ cRecorder(const char *FileName, int Ca, int Priority, int VPid, int APid1, int APid2, int DPid1, int DPid2, cTtxtSubsRecorderBase *tsr);
+#else
cRecorder(const char *FileName, int Ca, int Priority, int VPid, int APid1, int APid2, int DPid1, int DPid2);
+#endif
// Creates a new recorder that requires conditional access Ca, has
// the given Priority and will record the given PIDs into the file FileName.
virtual ~cRecorder();
|