summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Grimm <tobias@e-tobi.loc>2008-12-14 19:52:13 +0100
committerTobias Grimm <tobias@e-tobi.loc>2009-06-20 17:40:07 +0200
commitda9125bcaad4233983295e5d8c15b0f195891ba5 (patch)
tree5b4477866d04942cabbc8021b48bf6fa48061372
parentab6f2ccf424896a80b6e2fdf9ab9313ea4b7f316 (diff)
downloadvdr-patches-da9125bcaad4233983295e5d8c15b0f195891ba5.tar.gz
vdr-patches-da9125bcaad4233983295e5d8c15b0f195891ba5.tar.bz2
ttxtsubs: Updated patch for VDR 1.7.x by Rolf Ahrenberg
-rw-r--r--Makefile2
-rw-r--r--dvbplayer.c31
-rw-r--r--menu.c5
-rw-r--r--osd.c1
-rw-r--r--recorder.h3
-rw-r--r--vdrttxtsubshooks.c44
-rw-r--r--vdrttxtsubshooks.h36
7 files changed, 119 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 74a6833..d8f43de 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,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 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/dvbplayer.c b/dvbplayer.c
index 9f96462..95c0cd8 100644
--- a/dvbplayer.c
+++ b/dvbplayer.c
@@ -15,6 +15,33 @@
#include "ringbuffer.h"
#include "thread.h"
#include "tools.h"
+#include "vdrttxtsubshooks.h"
+
+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!
+ }
+ }
+}
// --- cPtsIndex -------------------------------------------------------------
@@ -530,8 +557,10 @@ void cDvbPlayer::Action(void)
}
if (p) {
int w;
- if (isPesRecording)
+ if (isPesRecording) {
+ StripExtendedPackets(p, pc);
w = PlayPes(p, pc, playMode != pmPlay && !(playMode == pmSlow && playDir == pdForward) && DeviceIsPlayingVideo());
+ }
else
w = PlayTs(p, pc, playMode != pmPlay && !(playMode == pmSlow && playDir == pdForward) && DeviceIsPlayingVideo());
if (w > 0) {
diff --git a/menu.c b/menu.c
index cd1b30a..ef5e593 100644
--- a/menu.c
+++ b/menu.c
@@ -30,6 +30,7 @@
#include "timers.h"
#include "transfer.h"
#include "videodir.h"
+#include "vdrttxtsubshooks.h"
#define MAXWAIT4EPGINFO 3 // seconds
#define MODETIMEOUT 3 // seconds
@@ -3755,8 +3756,10 @@ cRecordControl::cRecordControl(cDevice *Device, cTimer *Timer, bool Pause)
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 --git a/osd.c b/osd.c
index d16dafb..ab77fe8 100644
--- a/osd.c
+++ b/osd.c
@@ -16,6 +16,7 @@
#include <sys/unistd.h>
#include "device.h"
#include "tools.h"
+#include "vdrttxtsubshooks.h"
// --- cPalette --------------------------------------------------------------
diff --git a/recorder.h b/recorder.h
index 40a3222..ac607b5 100644
--- a/recorder.h
+++ b/recorder.h
@@ -15,6 +15,7 @@
#include "remux.h"
#include "ringbuffer.h"
#include "thread.h"
+#include "vdrttxtsubshooks.h"
class cRecorder : public cReceiver, cThread {
private:
@@ -34,7 +35,7 @@ protected:
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 --git a/vdrttxtsubshooks.c b/vdrttxtsubshooks.c
new file mode 100644
index 0000000..4c1836b
--- /dev/null
+++ b/vdrttxtsubshooks.c
@@ -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 --git a/vdrttxtsubshooks.h b/vdrttxtsubshooks.h
new file mode 100644
index 0000000..cfcd6a5
--- /dev/null
+++ b/vdrttxtsubshooks.h
@@ -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