summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Grimm <tobias@e-tobi.loc>2008-12-13 22:53:59 +0100
committerTobias Grimm <tobias@e-tobi.loc>2008-12-13 22:55:49 +0100
commitc1e686a7106f3d68f0e185f94307353c30bb8cd3 (patch)
tree107d35a7fd12ea24aa475c13f5164cdae4b43b35
parentfdb8ccc63d6fae2b7bde71073da2f556e281bc6d (diff)
downloadvdr-plugin-ttxtsubs-c1e686a7106f3d68f0e185f94307353c30bb8cd3.tar.gz
vdr-plugin-ttxtsubs-c1e686a7106f3d68f0e185f94307353c30bb8cd3.tar.bz2
Removed VDR*.patch and Checkpatch.sh and added up-to-date VDR patches into into "patches" subdirectory (thx to Rolf Ahrenberg)
-rw-r--r--Checkpatch.sh40
-rw-r--r--HISTORY2
-rw-r--r--Makefile1
-rw-r--r--README29
-rw-r--r--VDR-1.3.5.patch251
-rw-r--r--VDR.patch251
-rw-r--r--patches/vdr-1.6.0-ttxtsubs.patch286
-rw-r--r--patches/vdr-1.7.0-ttxtsubs.patch286
8 files changed, 583 insertions, 563 deletions
diff --git a/Checkpatch.sh b/Checkpatch.sh
deleted file mode 100644
index e4b2321..0000000
--- a/Checkpatch.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-
-DIR=`dirname $0`
-
-if [ ! -f "$DIR/../../../osd.c" ]; then
- echo
- echo
- echo "Warning while building ttxtsubs plugin:"
- echo $0: "Can not find VDR's osd.c so can not check for correct patch!"
- echo
- echo
- exit 0;
-fi
-
-grep vdrttxtsubshooks "$DIR/../../../osd.c" >> /dev/null;
-if [ $? -ne 0 ]; then
- echo
- echo
- echo "Error while building ttxtsubs plugin:"
- echo "You have not patched your VDR - please read the README!"
- echo
- echo
- exit 1;
-fi
-
-#grep OSD_HOOK_2 "$DIR/../../../osd.c" >> /dev/null;
-#if [ $? -ne 0 ]; then
-# echo
-# echo
-# echo "Error while building ttxtsubs plugin:"
-# echo " You have an older version of the VDR patch installed!"
-# echo " You need to upgrade it."
-# echo " Please do:"
-# echo " cd /path/to/vdr [ replace with your path ]"
-# echo " patch -b < PLUGINS/src/ttxtsubs/VDR.upgrade-patch"
-# echo " make"
-# echo
-# exit 1;
-#fi
-
diff --git a/HISTORY b/HISTORY
index d280983..2dd6f91 100644
--- a/HISTORY
+++ b/HISTORY
@@ -31,6 +31,8 @@ VDR Plugin 'ttxtsubs' Revision History
- switched completely to VDR 1.6's I18N system and removed the old crap - no
more support for older VDR versions!
- Removed VDR < 1.6.0 support code
+- Removed VDR*.patch and Checkpatch.sh and added up-to-date VDR patches
+ into into "patches" subdirectory (thx to Rolf Ahrenberg)
2004-05-31: Version 0.0.5
diff --git a/Makefile b/Makefile
index 6304512..00609c9 100644
--- a/Makefile
+++ b/Makefile
@@ -97,7 +97,6 @@ i18n: $(I18Nmo)
### Targets:
all: libvdr-$(PLUGIN).so i18n
- @sh ./Checkpatch.sh
libvdr-$(PLUGIN).so: $(OBJS)
$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
diff --git a/README b/README
index d201a78..c0c7ae1 100644
--- a/README
+++ b/README
@@ -63,28 +63,17 @@ reworked a few times.
Installation:
This plugin is for VDR >= 1.6.0. It currently needs a few hooks in, and
-changes to, VDR to work. A patch file is included. The patches should
+changes to, VDR to work. A patch file is included and it should
be harmless if you don't have the plugin loaded, so even if you patch
VDR and later decide not to use this plugin you don't necessarily have
to reinstall VDR. It is probably possible to build the plugin for
other version of VDR, but don't count on it.
-Steps (version numbers may differ):
-
-As usual, unpack the plugin and make a link:
- cd ..../vdr-1.2.6/PLUGINS/src
- tar zxvf ..../vdr-ttxtsubs-0.0.5.tgz
- ln -s ttxtsubs-0.0.5 ttxtsubs
-
-Go back to your VDR directory and install the patches and the new files:
- cd ../../
- cp PLUGINS/src/ttxtsubs-0.0.5/vdrttxtsubshooks.[ch] .
- patch -b < PLUGINS/src/ttxtsubs-0.0.5/VDR.patch
-
-Rebuild VDR:
- make clean
- make include-dir
- make
- make plugins
-
-Now you should be able to start VDR with "-P ttxtsubs".
+cd /put/your/path/here/VDR/PLUGINS/src
+tar -xzf /put/your/path/here/vdr-ttxtsubs-X.Y.Z.tgz
+ln -s ttxtsubs-X.Y.Z ttxtsubs
+cd /put/your/path/here/VDR
+patch -p1 < PLUGINS/src/ttxtsubs/patches/vdr-X.Y.Z-ttxtsubs.patch
+make
+make plugins
+./vdr -P ttxtsubs
diff --git a/VDR-1.3.5.patch b/VDR-1.3.5.patch
deleted file mode 100644
index 8a1a32c..0000000
--- a/VDR-1.3.5.patch
+++ /dev/null
@@ -1,251 +0,0 @@
-diff -upr ./DIST/Makefile ./Makefile
---- ./DIST/Makefile 2004-01-18 15:16:53.000000000 +0100
-+++ ./Makefile 2004-03-01 05:19:59.000000000 +0100
-@@ -37,7 +37,8 @@ OBJS = audio.o channels.o ci.o config.o
- dvbplayer.o dvbspu.o eit.o eitscan.o epg.o filter.o font.o i18n.o interface.o keys.o\
- lirc.o menu.o menuitems.o nit.o osdbase.o osd.o pat.o player.o plugin.o rcu.o\
- receiver.o recorder.o recording.o remote.o remux.o ringbuffer.o sdt.o sections.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
-
- FIXFONT_ISO8859_1 = -adobe-courier-bold-r-normal--25-*-100-100-m-*-iso8859-1
- OSDFONT_ISO8859_1 = -adobe-helvetica-medium-r-normal--23-*-100-100-p-*-iso8859-1
-diff -upr ./DIST/dvbplayer.c ./dvbplayer.c
---- ./DIST/dvbplayer.c 2003-10-18 13:31:54.000000000 +0200
-+++ ./dvbplayer.c 2004-03-01 05:18:15.000000000 +0100
-@@ -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)
-@@ -522,6 +563,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/menu.c ./menu.c
---- ./DIST/menu.c 2004-02-29 15:11:16.000000000 +0100
-+++ ./menu.c 2004-03-01 05:18:15.000000000 +0100
-@@ -3104,8 +3104,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/menu.h ./menu.h
---- ./DIST/menu.h 2004-02-15 15:11:28.000000000 +0100
-+++ ./menu.h 2004-03-01 05:18:15.000000000 +0100
-@@ -15,6 +15,7 @@
- #include "epg.h"
- #include "osd.h"
- #include "dvbplayer.h"
-+#include "vdrttxtsubshooks.h"
- #include "recorder.h"
- #include "recording.h"
-
-diff -upr ./DIST/osd.c ./osd.c
---- ./DIST/osd.c 2003-06-04 18:13:00.000000000 +0200
-+++ ./osd.c 2004-03-01 05:18:15.000000000 +0100
-@@ -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/recorder.c ./recorder.c
---- ./DIST/recorder.c 2003-10-18 13:35:02.000000000 +0200
-+++ ./recorder.c 2004-03-01 05:18:15.000000000 +0100
-@@ -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)
- ,cThread("recording")
- {
-@@ -35,6 +41,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:
-
-@@ -56,6 +65,10 @@ cRecorder::cRecorder(const char *FileNam
- cRecorder::~cRecorder()
- {
- Detach();
-+#ifdef VDRTTXTSUBSHOOKS
-+ if(ttxtSubsRecorder)
-+ delete ttxtSubsRecorder;
-+#endif
- delete index;
- delete fileName;
- delete remux;
-@@ -128,6 +141,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/recorder.h ./recorder.h
---- ./DIST/recorder.h 2002-06-08 11:35:03.000000000 +0200
-+++ ./recorder.h 2004-03-01 05:18:15.000000000 +0100
-@@ -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();
diff --git a/VDR.patch b/VDR.patch
deleted file mode 100644
index 7ef6fd9..0000000
--- a/VDR.patch
+++ /dev/null
@@ -1,251 +0,0 @@
-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();
diff --git a/patches/vdr-1.6.0-ttxtsubs.patch b/patches/vdr-1.6.0-ttxtsubs.patch
new file mode 100644
index 0000000..0f43506
--- /dev/null
+++ b/patches/vdr-1.6.0-ttxtsubs.patch
@@ -0,0 +1,286 @@
+diff -Nru vdr-1.6.0-vanilla/Makefile vdr-1.6.0-ttxtsubs/Makefile
+--- vdr-1.6.0-vanilla/Makefile 2008-03-27 21:43:25.000000000 +0200
++++ vdr-1.6.0-ttxtsubs/Makefile 2008-03-27 21:44:18.000000000 +0200
+@@ -43,6 +43,8 @@
+ skinclassic.o skins.o skinsttng.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 -Nru vdr-1.6.0-vanilla/dvbplayer.c vdr-1.6.0-ttxtsubs/dvbplayer.c
+--- vdr-1.6.0-vanilla/dvbplayer.c 2008-03-27 21:43:25.000000000 +0200
++++ vdr-1.6.0-ttxtsubs/dvbplayer.c 2008-03-27 21:44:18.000000000 +0200
+@@ -14,6 +14,7 @@
+ #include "ringbuffer.h"
+ #include "thread.h"
+ #include "tools.h"
++#include "vdrttxtsubshooks.h"
+
+ // --- cBackTrace ------------------------------------------------------------
+
+@@ -312,6 +313,32 @@
+ firstPacket = true;
+ }
+
++static void StripExtendedPackets(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
++ // EBU Teletext data, ETSI EN 300 472
++ if (b[i + 8] == 0x24 && b[i + 45] >= 0x10 && b[i + 45] < 0x20) {
++ 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!
++ }
++ }
++}
++
+ bool cDvbPlayer::NextFile(uchar FileNumber, int FileOffset)
+ {
+ if (FileNumber > 0)
+@@ -503,6 +530,7 @@
+ }
+ }
+ if (p) {
++ StripExtendedPackets(p, pc);
+ int w = PlayPes(p, pc, playMode != pmPlay);
+ if (w > 0) {
+ p += w;
+diff -Nru vdr-1.6.0-vanilla/menu.c vdr-1.6.0-ttxtsubs/menu.c
+--- vdr-1.6.0-vanilla/menu.c 2008-03-27 21:43:25.000000000 +0200
++++ vdr-1.6.0-ttxtsubs/menu.c 2008-03-27 21:44:18.000000000 +0200
+@@ -28,6 +28,7 @@
+ #include "themes.h"
+ #include "timers.h"
+ #include "transfer.h"
++#include "vdrttxtsubshooks.h"
+ #include "videodir.h"
+
+ #define MAXWAIT4EPGINFO 3 // seconds
+@@ -3811,8 +3812,10 @@
+ isyslog("record %s", fileName);
+ if (MakeDirs(fileName, true)) {
+ const cChannel *ch = timer->Channel();
+- recorder = new cRecorder(fileName, ch->GetChannelID(), timer->Priority(), ch->Vpid(), ch->Apids(), ch->Dpids(), ch->Spids());
++ cTtxtSubsRecorderBase *subsRecorder = cVDRTtxtsubsHookListener::Hook()->NewTtxtSubsRecorder(device, ch);
++ recorder = new cRecorder(fileName, ch->GetChannelID(), timer->Priority(), ch->Vpid(), ch->Apids(), ch->Dpids(), ch->Spids(), subsRecorder);
+ if (device->AttachReceiver(recorder)) {
++ if (subsRecorder) subsRecorder->DeviceAttach();
+ Recording.WriteInfo();
+ cStatus::MsgRecording(device, Recording.Name(), Recording.FileName(), true);
+ if (!Timer && !cReplayControl::LastReplayed()) // an instant recording, maybe from cRecordControls::PauseLiveVideo()
+diff -Nru vdr-1.6.0-vanilla/osd.c vdr-1.6.0-ttxtsubs/osd.c
+--- vdr-1.6.0-vanilla/osd.c 2008-03-27 21:43:25.000000000 +0200
++++ vdr-1.6.0-ttxtsubs/osd.c 2008-03-27 21:44:18.000000000 +0200
+@@ -15,6 +15,7 @@
+ #include <sys/stat.h>
+ #include <sys/unistd.h>
+ #include "tools.h"
++#include "vdrttxtsubshooks.h"
+
+ // --- cPalette --------------------------------------------------------------
+
+diff -Nru vdr-1.6.0-vanilla/recorder.c vdr-1.6.0-ttxtsubs/recorder.c
+--- vdr-1.6.0-vanilla/recorder.c 2008-03-27 21:43:25.000000000 +0200
++++ vdr-1.6.0-ttxtsubs/recorder.c 2008-03-27 21:44:18.000000000 +0200
+@@ -11,6 +11,7 @@
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <unistd.h>
++#include <stdint.h>
+ #include "shutdown.h"
+
+ #define RECORDERBUFSIZE MEGABYTE(5)
+@@ -26,6 +27,7 @@
+
+ class cFileWriter : public cThread {
+ private:
++ cTtxtSubsRecorderBase *ttxtSubsRecorder;
+ cRemux *remux;
+ cFileName *fileName;
+ cIndexFile *index;
+@@ -38,13 +40,14 @@
+ protected:
+ virtual void Action(void);
+ public:
+- cFileWriter(const char *FileName, cRemux *Remux);
++ cFileWriter(const char *FileName, cRemux *Remux, cTtxtSubsRecorderBase *tsr);
+ virtual ~cFileWriter();
+ };
+
+-cFileWriter::cFileWriter(const char *FileName, cRemux *Remux)
++cFileWriter::cFileWriter(const char *FileName, cRemux *Remux, cTtxtSubsRecorderBase *tsr)
+ :cThread("file writer")
+ {
++ ttxtSubsRecorder = tsr;
+ fileName = NULL;
+ remux = Remux;
+ index = NULL;
+@@ -67,6 +70,8 @@
+ Cancel(3);
+ delete index;
+ delete fileName;
++ if (ttxtSubsRecorder)
++ delete ttxtSubsRecorder;
+ }
+
+ bool cFileWriter::RunningLowOnDiskSpace(void)
+@@ -111,6 +116,16 @@
+ }
+ fileSize += Count;
+ remux->Del(Count);
++ // 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)) {
++ recordFile->Write(subsp, len);
++ fileSize += len;
++ }
++ }
+ }
+ else
+ break;
+@@ -126,7 +141,7 @@
+
+ // --- cRecorder -------------------------------------------------------------
+
+-cRecorder::cRecorder(const char *FileName, tChannelID ChannelID, int Priority, int VPid, const int *APids, const int *DPids, const int *SPids)
++cRecorder::cRecorder(const char *FileName, tChannelID ChannelID, int Priority, int VPid, const int *APids, const int *DPids, const int *SPids, cTtxtSubsRecorderBase *tsr)
+ :cReceiver(ChannelID, Priority, VPid, APids, Setup.UseDolbyDigital ? DPids : NULL, SPids)
+ ,cThread("recording")
+ {
+@@ -137,7 +152,7 @@
+ ringBuffer = new cRingBufferLinear(RECORDERBUFSIZE, TS_SIZE * 2, true, "Recorder");
+ ringBuffer->SetTimeouts(0, 100);
+ remux = new cRemux(VPid, APids, Setup.UseDolbyDigital ? DPids : NULL, SPids, true);
+- writer = new cFileWriter(FileName, remux);
++ writer = new cFileWriter(FileName, remux, tsr);
+ }
+
+ cRecorder::~cRecorder()
+diff -Nru vdr-1.6.0-vanilla/recorder.h vdr-1.6.0-ttxtsubs/recorder.h
+--- vdr-1.6.0-vanilla/recorder.h 2008-03-27 21:43:25.000000000 +0200
++++ vdr-1.6.0-ttxtsubs/recorder.h 2008-03-27 21:44:18.000000000 +0200
+@@ -15,6 +15,7 @@
+ #include "remux.h"
+ #include "ringbuffer.h"
+ #include "thread.h"
++#include "vdrttxtsubshooks.h"
+
+ class cFileWriter;
+
+@@ -28,7 +29,7 @@
+ virtual void Receive(uchar *Data, int Length);
+ virtual void Action(void);
+ public:
+- cRecorder(const char *FileName, tChannelID ChannelID, int Priority, int VPid, const int *APids, const int *DPids, const int *SPids);
++ cRecorder(const char *FileName, tChannelID ChannelID, int Priority, int VPid, const int *APids, const int *DPids, const int *SPids, cTtxtSubsRecorderBase *tsr);
+ // Creates a new recorder for the channel with the given ChannelID and
+ // the given Priority that will record the given PIDs into the file FileName.
+ virtual ~cRecorder();
+diff -Nru vdr-1.6.0-vanilla/vdrttxtsubshooks.c vdr-1.6.0-ttxtsubs/vdrttxtsubshooks.c
+--- vdr-1.6.0-vanilla/vdrttxtsubshooks.c 1970-01-01 02:00:00.000000000 +0200
++++ vdr-1.6.0-ttxtsubs/vdrttxtsubshooks.c 2008-03-27 21:44:18.000000000 +0200
+@@ -0,0 +1,44 @@
++
++#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)
++ { if(gListener) gListener->PlayerTeletextData(p, length); };
++ virtual cTtxtSubsRecorderBase *NewTtxtSubsRecorder(cDevice *dev, const cChannel *ch)
++ { if(gListener) return gListener->NewTtxtSubsRecorder(dev, ch); else return NULL; };
++};
++
++
++// ------ 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 -Nru vdr-1.6.0-vanilla/vdrttxtsubshooks.h vdr-1.6.0-ttxtsubs/vdrttxtsubshooks.h
+--- vdr-1.6.0-vanilla/vdrttxtsubshooks.h 1970-01-01 02:00:00.000000000 +0200
++++ vdr-1.6.0-ttxtsubs/vdrttxtsubshooks.h 2008-03-27 21:44:18.000000000 +0200
+@@ -0,0 +1,36 @@
++
++#ifndef __VDRTTXTSUBSHOOKS_H
++#define __VDRTTXTSUBSHOOKS_H
++
++class cDevice;
++class cChannel;
++
++#define VDRTTXTSUBSHOOKS
++
++class cTtxtSubsRecorderBase {
++ public:
++ virtual ~cTtxtSubsRecorderBase() {};
++
++ // returns a PES packet if there is data to add to the recording
++ virtual uint8_t *GetPacket(uint8_t **buf, size_t *len) { return NULL; };
++ virtual void DeviceAttach(void) {};
++};
++
++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) {};
++ virtual cTtxtSubsRecorderBase *NewTtxtSubsRecorder(cDevice *dev, const cChannel *ch)
++ { return NULL; };
++
++ // used by VDR to call hook listeners
++ static cVDRTtxtsubsHookListener *Hook(void);
++};
++
++#endif
diff --git a/patches/vdr-1.7.0-ttxtsubs.patch b/patches/vdr-1.7.0-ttxtsubs.patch
new file mode 100644
index 0000000..aa5adef
--- /dev/null
+++ b/patches/vdr-1.7.0-ttxtsubs.patch
@@ -0,0 +1,286 @@
+diff -Nru vdr-1.7.0-vanilla/Makefile vdr-1.7.0-ttxtsubs/Makefile
+--- vdr-1.7.0-vanilla/Makefile 2008-02-29 23:43:03.000000000 +0200
++++ vdr-1.7.0-ttxtsubs/Makefile 2008-04-13 18:49:20.000000000 +0300
+@@ -43,6 +43,8 @@
+ skinclassic.o skins.o skinsttng.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 -Nru vdr-1.7.0-vanilla/dvbplayer.c vdr-1.7.0-ttxtsubs/dvbplayer.c
+--- vdr-1.7.0-vanilla/dvbplayer.c 2008-02-09 17:10:54.000000000 +0200
++++ vdr-1.7.0-ttxtsubs/dvbplayer.c 2008-04-13 18:49:20.000000000 +0300
+@@ -14,6 +14,7 @@
+ #include "ringbuffer.h"
+ #include "thread.h"
+ #include "tools.h"
++#include "vdrttxtsubshooks.h"
+
+ // --- cBackTrace ------------------------------------------------------------
+
+@@ -312,6 +313,32 @@
+ firstPacket = true;
+ }
+
++static void StripExtendedPackets(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
++ // EBU Teletext data, ETSI EN 300 472
++ if (b[i + 8] == 0x24 && b[i + 45] >= 0x10 && b[i + 45] < 0x20) {
++ 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!
++ }
++ }
++}
++
+ bool cDvbPlayer::NextFile(uchar FileNumber, int FileOffset)
+ {
+ if (FileNumber > 0)
+@@ -503,6 +530,7 @@
+ }
+ }
+ if (p) {
++ StripExtendedPackets(p, pc);
+ int w = PlayPes(p, pc, playMode != pmPlay);
+ if (w > 0) {
+ p += w;
+diff -Nru vdr-1.7.0-vanilla/menu.c vdr-1.7.0-ttxtsubs/menu.c
+--- vdr-1.7.0-vanilla/menu.c 2008-04-12 14:37:17.000000000 +0300
++++ vdr-1.7.0-ttxtsubs/menu.c 2008-04-13 18:49:20.000000000 +0300
+@@ -28,6 +28,7 @@
+ #include "themes.h"
+ #include "timers.h"
+ #include "transfer.h"
++#include "vdrttxtsubshooks.h"
+ #include "videodir.h"
+
+ #define MAXWAIT4EPGINFO 3 // seconds
+@@ -3751,8 +3752,10 @@
+ isyslog("record %s", fileName);
+ if (MakeDirs(fileName, true)) {
+ const cChannel *ch = timer->Channel();
+- recorder = new cRecorder(fileName, ch->GetChannelID(), timer->Priority(), ch->Vpid(), ch->Apids(), ch->Dpids(), ch->Spids());
++ cTtxtSubsRecorderBase *subsRecorder = cVDRTtxtsubsHookListener::Hook()->NewTtxtSubsRecorder(device, ch);
++ recorder = new cRecorder(fileName, ch->GetChannelID(), timer->Priority(), ch->Vpid(), ch->Apids(), ch->Dpids(), ch->Spids(), subsRecorder);
+ if (device->AttachReceiver(recorder)) {
++ if (subsRecorder) subsRecorder->DeviceAttach();
+ Recording.WriteInfo();
+ cStatus::MsgRecording(device, Recording.Name(), Recording.FileName(), true);
+ if (!Timer && !cReplayControl::LastReplayed()) // an instant recording, maybe from cRecordControls::PauseLiveVideo()
+diff -Nru vdr-1.7.0-vanilla/osd.c vdr-1.7.0-ttxtsubs/osd.c
+--- vdr-1.7.0-vanilla/osd.c 2007-10-12 15:38:36.000000000 +0300
++++ vdr-1.7.0-ttxtsubs/osd.c 2008-04-13 18:49:20.000000000 +0300
+@@ -15,6 +15,7 @@
+ #include <sys/stat.h>
+ #include <sys/unistd.h>
+ #include "tools.h"
++#include "vdrttxtsubshooks.h"
+
+ // --- cPalette --------------------------------------------------------------
+
+diff -Nru vdr-1.7.0-vanilla/recorder.c vdr-1.7.0-ttxtsubs/recorder.c
+--- vdr-1.7.0-vanilla/recorder.c 2007-02-24 18:36:24.000000000 +0200
++++ vdr-1.7.0-ttxtsubs/recorder.c 2008-04-13 18:49:20.000000000 +0300
+@@ -11,6 +11,7 @@
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <unistd.h>
++#include <stdint.h>
+ #include "shutdown.h"
+
+ #define RECORDERBUFSIZE MEGABYTE(5)
+@@ -26,6 +27,7 @@
+
+ class cFileWriter : public cThread {
+ private:
++ cTtxtSubsRecorderBase *ttxtSubsRecorder;
+ cRemux *remux;
+ cFileName *fileName;
+ cIndexFile *index;
+@@ -38,13 +40,14 @@
+ protected:
+ virtual void Action(void);
+ public:
+- cFileWriter(const char *FileName, cRemux *Remux);
++ cFileWriter(const char *FileName, cRemux *Remux, cTtxtSubsRecorderBase *tsr);
+ virtual ~cFileWriter();
+ };
+
+-cFileWriter::cFileWriter(const char *FileName, cRemux *Remux)
++cFileWriter::cFileWriter(const char *FileName, cRemux *Remux, cTtxtSubsRecorderBase *tsr)
+ :cThread("file writer")
+ {
++ ttxtSubsRecorder = tsr;
+ fileName = NULL;
+ remux = Remux;
+ index = NULL;
+@@ -67,6 +70,8 @@
+ Cancel(3);
+ delete index;
+ delete fileName;
++ if (ttxtSubsRecorder)
++ delete ttxtSubsRecorder;
+ }
+
+ bool cFileWriter::RunningLowOnDiskSpace(void)
+@@ -111,6 +116,16 @@
+ }
+ fileSize += Count;
+ remux->Del(Count);
++ // 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)) {
++ recordFile->Write(subsp, len);
++ fileSize += len;
++ }
++ }
+ }
+ else
+ break;
+@@ -126,7 +141,7 @@
+
+ // --- cRecorder -------------------------------------------------------------
+
+-cRecorder::cRecorder(const char *FileName, tChannelID ChannelID, int Priority, int VPid, const int *APids, const int *DPids, const int *SPids)
++cRecorder::cRecorder(const char *FileName, tChannelID ChannelID, int Priority, int VPid, const int *APids, const int *DPids, const int *SPids, cTtxtSubsRecorderBase *tsr)
+ :cReceiver(ChannelID, Priority, VPid, APids, Setup.UseDolbyDigital ? DPids : NULL, SPids)
+ ,cThread("recording")
+ {
+@@ -137,7 +152,7 @@
+ ringBuffer = new cRingBufferLinear(RECORDERBUFSIZE, TS_SIZE * 2, true, "Recorder");
+ ringBuffer->SetTimeouts(0, 100);
+ remux = new cRemux(VPid, APids, Setup.UseDolbyDigital ? DPids : NULL, SPids, true);
+- writer = new cFileWriter(FileName, remux);
++ writer = new cFileWriter(FileName, remux, tsr);
+ }
+
+ cRecorder::~cRecorder()
+diff -Nru vdr-1.7.0-vanilla/recorder.h vdr-1.7.0-ttxtsubs/recorder.h
+--- vdr-1.7.0-vanilla/recorder.h 2007-01-05 12:44:05.000000000 +0200
++++ vdr-1.7.0-ttxtsubs/recorder.h 2008-04-13 18:49:20.000000000 +0300
+@@ -15,6 +15,7 @@
+ #include "remux.h"
+ #include "ringbuffer.h"
+ #include "thread.h"
++#include "vdrttxtsubshooks.h"
+
+ class cFileWriter;
+
+@@ -28,7 +29,7 @@
+ virtual void Receive(uchar *Data, int Length);
+ virtual void Action(void);
+ public:
+- cRecorder(const char *FileName, tChannelID ChannelID, int Priority, int VPid, const int *APids, const int *DPids, const int *SPids);
++ cRecorder(const char *FileName, tChannelID ChannelID, int Priority, int VPid, const int *APids, const int *DPids, const int *SPids, cTtxtSubsRecorderBase *tsr);
+ // Creates a new recorder for the channel with the given ChannelID and
+ // the given Priority that will record the given PIDs into the file FileName.
+ virtual ~cRecorder();
+diff -Nru vdr-1.7.0-vanilla/vdrttxtsubshooks.c vdr-1.7.0-ttxtsubs/vdrttxtsubshooks.c
+--- vdr-1.7.0-vanilla/vdrttxtsubshooks.c 1970-01-01 02:00:00.000000000 +0200
++++ vdr-1.7.0-ttxtsubs/vdrttxtsubshooks.c 2008-04-13 18:49:20.000000000 +0300
+@@ -0,0 +1,44 @@
++
++#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)
++ { if(gListener) gListener->PlayerTeletextData(p, length); };
++ virtual cTtxtSubsRecorderBase *NewTtxtSubsRecorder(cDevice *dev, const cChannel *ch)
++ { if(gListener) return gListener->NewTtxtSubsRecorder(dev, ch); else return NULL; };
++};
++
++
++// ------ 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 -Nru vdr-1.7.0-vanilla/vdrttxtsubshooks.h vdr-1.7.0-ttxtsubs/vdrttxtsubshooks.h
+--- vdr-1.7.0-vanilla/vdrttxtsubshooks.h 1970-01-01 02:00:00.000000000 +0200
++++ vdr-1.7.0-ttxtsubs/vdrttxtsubshooks.h 2008-04-13 18:49:20.000000000 +0300
+@@ -0,0 +1,36 @@
++
++#ifndef __VDRTTXTSUBSHOOKS_H
++#define __VDRTTXTSUBSHOOKS_H
++
++class cDevice;
++class cChannel;
++
++#define VDRTTXTSUBSHOOKS
++
++class cTtxtSubsRecorderBase {
++ public:
++ virtual ~cTtxtSubsRecorderBase() {};
++
++ // returns a PES packet if there is data to add to the recording
++ virtual uint8_t *GetPacket(uint8_t **buf, size_t *len) { return NULL; };
++ virtual void DeviceAttach(void) {};
++};
++
++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) {};
++ virtual cTtxtSubsRecorderBase *NewTtxtSubsRecorder(cDevice *dev, const cChannel *ch)
++ { return NULL; };
++
++ // used by VDR to call hook listeners
++ static cVDRTtxtsubsHookListener *Hook(void);
++};
++
++#endif