summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Grimm <tobias@e-tobi.loc>2009-04-24 02:14:20 +0200
committerTobias Grimm <tobias@e-tobi.loc>2009-04-25 22:37:53 +0200
commit335a8b8ff6c11592da22b57e6d9d1c2e290094f0 (patch)
tree052c152c92c016a0fe8399a1e3e9e107bb6de63d
parent5c73633de1e22b61fa4c7d58285ce10232ab5d7f (diff)
downloadvdr-plugin-ttxtsubs-335a8b8ff6c11592da22b57e6d9d1c2e290094f0.tar.gz
vdr-plugin-ttxtsubs-335a8b8ff6c11592da22b57e6d9d1c2e290094f0.tar.bz2
Dropped cTtxtsubsRecorder - not required for VDR 1.7.5 with TS recordings anymore
-rw-r--r--Makefile2
-rw-r--r--ttxtsubs.c10
-rw-r--r--ttxtsubsrecorder.c200
-rw-r--r--ttxtsubsrecorder.h42
4 files changed, 1 insertions, 253 deletions
diff --git a/Makefile b/Makefile
index 51229b6..c8e11a6 100644
--- a/Makefile
+++ b/Makefile
@@ -48,7 +48,7 @@ DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
### The object files (add further files here):
OBJS = $(PLUGIN).o ttxtsubsdisplayer.o ttxtsubsdisplay.o teletext.o siinfo.o \
- ttxtsubsfilter.o ttxtsubsrecorder.o ttxtsubsreceiver.o \
+ ttxtsubsfilter.o ttxtsubsreceiver.o \
ttxtsubspagemenu.o ttxtsubschannelsettings.o
### Implicit rules:
diff --git a/ttxtsubs.c b/ttxtsubs.c
index 4f0cef4..dec7ea4 100644
--- a/ttxtsubs.c
+++ b/ttxtsubs.c
@@ -40,7 +40,6 @@
#include "ttxtsubsglobals.h"
#include "ttxtsubsdisplayer.h"
-#include "ttxtsubsrecorder.h"
#include "utils.h"
#include "siinfo.h"
#include "ttxtsubspagemenu.h"
@@ -147,7 +146,6 @@ public:
virtual void HideOSD(void) { HideTtxt(); }
virtual void ShowOSD(void) { ShowTtxt(); }
virtual void PlayerTeletextData(uint8_t *p, int length, bool IsPesRecording);
- virtual cTtxtSubsRecorderBase *NewTtxtSubsRecorder(cDevice *dev, const cChannel *ch);
// -- cThread
void Action(void);
@@ -480,14 +478,6 @@ void cPluginTtxtsubs::PlayerTeletextData(uint8_t *p, int length, bool IsPesRecor
r->PES_data(p, length, IsPesRecording);
}
-cTtxtSubsRecorderBase *cPluginTtxtsubs::NewTtxtSubsRecorder(cDevice *dev, const cChannel *ch)
-{
- if(globals.mDoRecord)
- return new cTtxtSubsRecorder(dev, ch);
- else
- return NULL;
-}
-
// -- internal
diff --git a/ttxtsubsrecorder.c b/ttxtsubsrecorder.c
deleted file mode 100644
index 7dcc8e9..0000000
--- a/ttxtsubsrecorder.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * 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 <stdint.h>
-#include <stdlib.h>
-
-#include <vdr/vdrttxtsubshooks.h>
-#include <vdr/device.h>
-#include <vdr/channels.h>
-#include <vdr/receiver.h>
-#include <vdr/ringbuffer.h>
-
-#include "siinfo.h"
-#include "ttxtsubsfilter.h"
-#include "ttxtsubsrecorder.h"
-#include "ttxtsubsreceiver.h"
-#include "teletext.h"
-
-#define MAXPACKETSIZE 20000
-
-// ----- cTtxtSubsRecorder -----
-
-cTtxtSubsRecorder::cTtxtSubsRecorder(cDevice *dev, const cChannel *ch)
- :
- mDev(dev),
- mSid(ch->Sid()),
- mVid(ch->Vpid()),
- mTtxtinfo(NULL),
- mReceiver(NULL),
- mPacketBuffer(NULL)
-{
- mTtxtinfo = (struct ttxtinfo *) malloc(sizeof(*mTtxtinfo));
- struct ttxtpidinfo *pi = NULL;
- int pid, page;
- char lang[4] = "";
-
- if(GetTtxtInfo(dev->CardIndex(), ch, mTtxtinfo)) {
- esyslog("ttxtsubs: cTtxtSubsRecorder::cTtxtSubsRecorder: GetTtxtSubtitleInfo error!");
- } else {
- pi = FindSubs(mTtxtinfo, &pid, &page, lang);
-
- if(!pi && mTtxtinfo->pidcount > 0) {
- pi = &(mTtxtinfo->p[0]);
- isyslog("ttxtsubs: Selected language not found, just recording first teletext pid found.");
- }
-
- if(pi) {
- mReceiver = new cTtxtSubsReceiver(ch->GetChannelID(), ch->Ca(), pi);
- mPacketBuffer = (uint8_t *) malloc(MAXPACKETSIZE);
- } else {
- isyslog("ttxtsubs: No teletext pid found, not recording any (obviously).");
- }
- }
-}
-
-cTtxtSubsRecorder::~cTtxtSubsRecorder(void)
-{
- if(mReceiver) {
- cTtxtSubsReceiver *tmp = mReceiver;
- mReceiver = NULL;
- delete tmp;
- }
-
- if(mTtxtinfo) {
- FreeTtxtInfoData(mTtxtinfo);
- free(mTtxtinfo);
- }
-
- if(mPacketBuffer)
- free(mPacketBuffer);
-}
-
-uint8_t *cTtxtSubsRecorder::GetPacket(uint8_t **outbuf, size_t *lenp)
-{
- int done = 0;
- size_t len;
- uint8_t *b = (uint8_t *) mPacketBuffer;
- uint8_t line[46];
- encodedPTS pts;
-
- *outbuf = NULL;
-
- if(!mReceiver)
- return *outbuf;
-
- len = 46; // skip PES header area
-
- if(mReceiver->Get(line, &pts)) {
- // if first line is a Y0, insert an index page
- // XXX This isn't really correct, we don't know if there is parallel magazine
- // transmission and a page in the index pages' mag is in progress...
-
- int mp;
- //int mag; // X in ETSI EN 300 706
- int packet; // Y
-
- struct ttxt_data_field *d = (struct ttxt_data_field *) line;
-
- mp = UNHAM_INV(d->mag_addr_ham[0], d->mag_addr_ham[1]);
- //mag = mp & 0x7;
- packet = (mp >> 3) & 0x1f;
-
- if(packet == 0) {
- char **iplines;
- int iplcount;
- mReceiver->IndexPage(&iplines, &iplcount);
- for(int i = 0; i < iplcount; i++) {
- memcpy(b + len, (char *) iplines[i], 46);
- len += 46;
- }
- }
-
- // insert the line
- memcpy(b + len, line, 46);
- len += 46;
- }
-
- // get the rest of the lines
- while((len < (MAXPACKETSIZE - 184)) && !done) {
- if(mReceiver->Get(b + len)) {
- len += 46;
- } else
- done = 1;
- }
-
- if(len > 46) { // we have data, make a PES packet according to ETSI EN 300 472
- // fill out packet with stuffing data to 184 byte boundary
- size_t stufflen = 184 - (len % 184);
- if(stufflen == 184)
- stufflen = 0;
- memset((char *) b + len, 0xff, stufflen);
-
- len += stufflen;
-
- // fill in header
- uint8_t header[] = {0x00, 0x00, 0x01, 0xbd, // private data stream 1
- 0x00, 0x00, // len
- 0x80, // 10 and flags
- 0x00, // PTS_DTS_flags and other flags
- 0x24, // PES_header_data_length
- 0xff, 0xff, 0xff, 0xff, 0xff}; // PTS
-
- memcpy((char *) b, (char *) header, sizeof(header));
- b[4] = (len-6) >> 8;
- b[5] = (len-6) & 0xff;
-#define TEST_RECORD_PTS 1
-#if TEST_RECORD_PTS
- if(pts.valid) {
- b[7] |= 0x80;
- b[9] = pts.data[0];
- b[10] = pts.data[1];
- b[11] = pts.data[2];
- b[12] = pts.data[3];
- b[13] = pts.data[4];
- }
-#endif
- memset((char *) b + sizeof(header), 0xff, 45 - sizeof(header)); // add stuffing bytes
- b[45] = 0x1f; // EBU data, our payload type to indicate we have filtered data
-
- *outbuf = b;
- *lenp = len;
- }
-
-#if 0
- if(*outbuf) { // XXX
- dprint("cTtxtSubsRecorder::GetPacket: len: %d\n", len);
- for(size_t i = 46; i < len; i +=46) {
- struct ttxt_data_field *d = (struct ttxt_data_field *) b + i;
- if(d->data_unit_id != 0xff)
- print_line((char *) b + i);
- }
- }
-#endif
-
- return *outbuf;
-}
-
-void cTtxtSubsRecorder::DeviceAttach(void)
-{
- if(mReceiver)
- mDev->AttachReceiver(mReceiver);
-}
-
diff --git a/ttxtsubsrecorder.h b/ttxtsubsrecorder.h
deleted file mode 100644
index f8159b0..0000000
--- a/ttxtsubsrecorder.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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
- *
- */
-
-class cDevice;
-class cChannel;
-class cTtxtSubsReceiver;
-struct ttxtinfo;
-
-class cTtxtSubsRecorder : public cTtxtSubsRecorderBase {
- public:
- cTtxtSubsRecorder(cDevice *dev, const cChannel *ch);
- virtual ~cTtxtSubsRecorder();
-
- // returns a PES packet if there is data to add to the recording
- virtual uint8_t *GetPacket(uint8_t **buf, size_t *len);
- virtual void DeviceAttach(void);
-
- private:
- cDevice *mDev;
- int mSid;
- int mVid;
- ttxtinfo *mTtxtinfo;
- cTtxtSubsReceiver *mReceiver;
- uint8_t *mPacketBuffer;
-};