summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoretobi <git@e-tobi.net>2009-10-25 20:26:04 +0100
committeretobi <git@e-tobi.net>2009-10-25 20:26:04 +0100
commit6bf565287bd718a72b8d862cae4d41797ca82fdc (patch)
tree4a511b3cfe291b4e7e52f5480bec04919d8665c0
parentbd012765a88067d3806e208923674750fffa0542 (diff)
downloadvdr-plugin-osdteletext-6bf565287bd718a72b8d862cae4d41797ca82fdc.tar.gz
vdr-plugin-osdteletext-6bf565287bd718a72b8d862cae4d41797ca82fdc.tar.bz2
Added command line option to enable storing TopText pages, which is
now disabled by default (References #177) Patch provided by Andreas Brachold
-rw-r--r--HISTORY2
-rw-r--r--README2
-rw-r--r--README.DE1
-rw-r--r--osdteletext.c14
-rw-r--r--txtrecv.c38
-rw-r--r--txtrecv.h8
6 files changed, 43 insertions, 22 deletions
diff --git a/HISTORY b/HISTORY
index 733a9fd..ff2ca0b 100644
--- a/HISTORY
+++ b/HISTORY
@@ -7,6 +7,8 @@ VDR Plugin 'osdteletext' Revision History
- Fixed possible segfault (Closes #179) - (Thx to Manuel Reimer)
- Added setup option to disable maine menu entry (Closes #149)
(Thx to Manuel Reimer!)
+- Added command line option to enable storing TopText pages, which is
+ now disabled by default (References #177) (Thx to Andreas Brachold!)
2009-06-02: version 0.8.3
- Updated Ukrainian translation provided by Yarema P. aka Knedlyk (Closes #133)
diff --git a/README b/README
index bc1c5e2..68a9005 100644
--- a/README
+++ b/README
@@ -97,6 +97,8 @@ Command line options:
one-file-per-page system.
Default is "packed" for the
one-file-for-a-few-pages system.
+ -t --toptext Store top text pages at cache.
+ (unviewable pages)
Colors:
On all sorts of output devices which are not limited as to color depth
diff --git a/README.DE b/README.DE
index e99a73a..5bb7718 100644
--- a/README.DE
+++ b/README.DE
@@ -74,6 +74,7 @@ Kommandozeilen-Optionen:
System "Eine Datei - eine Seite".
Voreinstellung ist "packed" für ein System, das
in eine Datei mehrere Seiten speichert.
+ -t --toptext Speichere TopText Seiten (nich anzeigbar)
Farben:
Auf allen Ausgabegeräten, die nicht in der Farbtiefe des OSD beschränkt sind,
diff --git a/osdteletext.c b/osdteletext.c
index 34c9184..ec6e65a 100644
--- a/osdteletext.c
+++ b/osdteletext.c
@@ -34,6 +34,7 @@ private:
// Add any member variables or functions you may need here.
cTxtStatus *txtStatus;
bool startReceiver;
+ bool storeTopText;
void initTexts();
public:
cPluginTeletextosd(void);
@@ -96,7 +97,6 @@ protected:
};*/
-
cPluginTeletextosd::cPluginTeletextosd(void)
{
// Initialize any member variables here.
@@ -128,7 +128,8 @@ const char *cPluginTeletextosd::CommandLineHelp(void)
" Choose \"legacy\" for the traditional\n"
" one-file-per-page system.\n"
" Default is \"packed\" for the \n"
- " one-file-for-a-few-pages system.\n";
+ " one-file-for-a-few-pages system.\n"
+ " -t, --toptext Store top text pages at cache. (unviewable pages)\n";
}
bool cPluginTeletextosd::ProcessArgs(int argc, char *argv[])
@@ -137,13 +138,14 @@ bool cPluginTeletextosd::ProcessArgs(int argc, char *argv[])
static struct option long_options[] = {
{ "directory", required_argument, NULL, 'd' },
{ "max-cache", required_argument, NULL, 'n' },
- { "cache-system", required_argument, NULL, 's' },
+ { "cache-system", required_argument, NULL, 's' },
+ { "toptext", no_argument, NULL, 't' },
{ NULL }
};
int c;
int maxStorage=-1;
- while ((c = getopt_long(argc, argv, "s:d:n:", long_options, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "s:d:n:t", long_options, NULL)) != -1) {
switch (c) {
case 's':
if (!optarg)
@@ -160,6 +162,8 @@ bool cPluginTeletextosd::ProcessArgs(int argc, char *argv[])
maxStorage=n;
}
break;
+ case 't': storeTopText=true;
+ break;
}
}
//do this here because the option -s to change the storage system might be given
@@ -177,7 +181,7 @@ bool cPluginTeletextosd::Start(void)
Storage::instance()->init();
initTexts();
if (startReceiver)
- txtStatus=new cTxtStatus();
+ txtStatus=new cTxtStatus(storeTopText);
if (ttSetup.OSDheight<=100) ttSetup.OSDheight=Setup.OSDHeight;
if (ttSetup.OSDwidth<=100) ttSetup.OSDwidth=Setup.OSDWidth;
diff --git a/txtrecv.c b/txtrecv.c
index 4fe5aea..de5a507 100644
--- a/txtrecv.c
+++ b/txtrecv.c
@@ -487,11 +487,16 @@ void cTelePage::save()
buf=0x00; s->write(&buf,1,fd);
s->write(pagebuf,24*40,fd);
s->close(fd);
- }
+ }
}
+bool cTelePage::IsTopTextPage()
+{
+ return (page.page & 0xFF) <= 0x99 && (page.page & 0x0F) <= 0x9;
+}
-cTxtStatus::cTxtStatus(void)
+cTxtStatus::cTxtStatus(bool storeTopText)
+ :storeTopText(storeTopText)
{
receiver = NULL;
currentLiveChannel = tChannelID::InvalidID;
@@ -531,7 +536,7 @@ void cTxtStatus::ChannelSwitch(const cDevice *Device, int ChannelNumber)
int TPid = newLiveChannel->Tpid();
if (TPid) {
- receiver = new cTxtReceiver(TPid, currentLiveChannel);
+ receiver = new cTxtReceiver(TPid, currentLiveChannel, storeTopText);
cDevice::ActualDevice()->AttachReceiver(receiver);
}
@@ -539,9 +544,9 @@ void cTxtStatus::ChannelSwitch(const cDevice *Device, int ChannelNumber)
}
-cTxtReceiver::cTxtReceiver(int TPid, tChannelID chan)
+cTxtReceiver::cTxtReceiver(int TPid, tChannelID chan, bool storeTopText)
: cReceiver(chan, -1, TPid), cThread("osdteletext-receiver"),
- TxtPage(0), buffer((188+60)*75)
+ TxtPage(0), storeTopText(storeTopText), buffer((188+60)*75)
{
Storage::instance()->prepareDirectory(ChannelID());
// 10 ms timeout on getting TS frames
@@ -616,6 +621,17 @@ uchar cTxtReceiver::unham16 (uchar *p)
return (c1 & 0x0F) | (c2 & 0x0F) *16;
}
+void cTxtReceiver::SaveAndDeleteTxtPage()
+{
+ if (storeTopText || !TxtPage->IsTopTextPage()) {
+ if (TxtPage) {
+ TxtPage->save();
+ delete TxtPage;
+ TxtPage=NULL;
+ }
+ }
+}
+
void cTxtReceiver::DecodeTXT(uchar* TXT_buf)
{
// Format of buffer:
@@ -666,11 +682,7 @@ void cTxtReceiver::DecodeTXT(uchar* TXT_buf)
// Page no, 10- and 1-digit
if (b1 == 0xff) break;
- if (TxtPage) {
- TxtPage->save();
- delete TxtPage;
- TxtPage=NULL;
- }
+ SaveAndDeleteTxtPage();
b2 = unham16 (ptr+2); // Sub-code 0..6 + C4
b3 = unham16 (ptr+4); // Sub-code 8..13 + C5,C6
@@ -704,11 +716,7 @@ void cTxtReceiver::DecodeTXT(uchar* TXT_buf)
}
/*case 23:
{
- if (TxtPage) {
- TxtPage->save();
- delete TxtPage;
- TxtPage=NULL;
- }
+ SaveAndDeleteTxtPage();
break;
}*/
default:
diff --git a/txtrecv.h b/txtrecv.h
index b25908b..82ea056 100644
--- a/txtrecv.h
+++ b/txtrecv.h
@@ -148,6 +148,7 @@ class cTelePage {
~cTelePage();
void SetLine(int, uchar*);
void save();
+ bool IsTopTextPage();
};
class cRingTxtFrames : public cRingBufferFrame {
@@ -163,13 +164,15 @@ private:
void DecodeTXT(uchar*);
uchar unham16 (uchar*);
cTelePage *TxtPage;
+ void SaveAndDeleteTxtPage();
+ bool storeTopText;
protected:
virtual void Activate(bool On);
virtual void Receive(uchar *Data, int Length);
virtual void Action();
cRingTxtFrames buffer;
public:
- cTxtReceiver(int TPid, tChannelID chan);
+ cTxtReceiver(int TPid, tChannelID chan, bool storeTopText);
virtual ~cTxtReceiver();
virtual void Stop();
};
@@ -178,10 +181,11 @@ class cTxtStatus : public cStatus {
private:
cTxtReceiver *receiver;
tChannelID currentLiveChannel;
+ bool storeTopText;
protected:
virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber);
public:
- cTxtStatus(void);
+ cTxtStatus(bool storeTopText);
~cTxtStatus();
};