summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Grimm <tobias@e-tobi.loc>2009-01-10 17:30:34 +0100
committerTobias Grimm <tobias@e-tobi.loc>2009-01-10 22:18:43 +0100
commit1459b3e8300e0ec62a288d0f56bafb0ab1e6769f (patch)
tree1b7cb0e1469f052f19dc6603cf08c79d82ac79b1
parentb38bb4f0b5cf564e007c9248645482f9b0a3c1ab (diff)
downloadvdr-plugin-osdteletext-1459b3e8300e0ec62a288d0f56bafb0ab1e6769f.tar.gz
vdr-plugin-osdteletext-1459b3e8300e0ec62a288d0f56bafb0ab1e6769f.tar.bz2
Merged class ChannelStatus into cTxtStatus and changed the code that
detects, if the current live channel has been changed and the OsdTeletext receiver needs to switch to the new channel as well
-rw-r--r--HISTORY3
-rw-r--r--menu.c11
-rw-r--r--menu.h8
-rw-r--r--osdteletext.c5
-rw-r--r--txtrecv.c41
-rw-r--r--txtrecv.h1
6 files changed, 34 insertions, 35 deletions
diff --git a/HISTORY b/HISTORY
index 515580a..ddc7f62 100644
--- a/HISTORY
+++ b/HISTORY
@@ -15,6 +15,9 @@ VDR Plugin 'osdteletext' Revision History
Walter K. (Closes #41)
- Removed the OSDTELETEXT_REINSERTION_PATCH (dead code)
- Removed timingdebug code
+- Merged class ChannelStatus into cTxtStatus and changed the code that
+ detects, if the current live channel has been changed and the
+ OsdTeletext receiver needs to switch to the new channel as well
2008-12-19: version 0.7.0
- switched completely to VDR 1.6's I18N system and removed the old crap - no
diff --git a/menu.c b/menu.c
index 8c42f75..9255503 100644
--- a/menu.c
+++ b/menu.c
@@ -628,17 +628,6 @@ void TeletextBrowser::UpdateClock() {
Display::DrawClock();
}
-
-ChannelStatus::ChannelStatus()
-{
-}
-
-
-void ChannelStatus::ChannelSwitch(const cDevice *Device, int ChannelNumber) {
- if (Device->IsPrimaryDevice() && ChannelNumber>0)
- TeletextBrowser::ChannelSwitched(ChannelNumber);
-}
-
TeletextSetup ttSetup;
TeletextSetup::TeletextSetup() {
diff --git a/menu.h b/menu.h
index a24fab5..f0c1094 100644
--- a/menu.h
+++ b/menu.h
@@ -22,14 +22,6 @@
extern int Stretch;
-class ChannelStatus : public cStatus {
-public:
- ChannelStatus();
-protected:
- virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber);
-};
-
-
class TeletextBrowser : public cOsdObject {
public:
TeletextBrowser(cTxtStatus *txtSt);
diff --git a/osdteletext.c b/osdteletext.c
index 5028f4c..7f9d4ac 100644
--- a/osdteletext.c
+++ b/osdteletext.c
@@ -33,7 +33,6 @@ class cPluginTeletextosd : public cPlugin {
private:
// Add any member variables or functions you may need here.
cTxtStatus *txtStatus;
- ChannelStatus *channelStatus;
bool startReceiver;
void initTexts();
public:
@@ -104,7 +103,6 @@ cPluginTeletextosd::cPluginTeletextosd(void)
// DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
txtStatus=0;
- channelStatus=0;
startReceiver=true;
}
@@ -113,8 +111,6 @@ cPluginTeletextosd::~cPluginTeletextosd()
// Clean up after yourself!
if (txtStatus)
delete txtStatus;
- if (channelStatus)
- delete channelStatus;
Storage::instance()->cleanUp();
}
@@ -182,7 +178,6 @@ bool cPluginTeletextosd::Start(void)
initTexts();
if (startReceiver)
txtStatus=new cTxtStatus();
- channelStatus=new ChannelStatus();
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 4395daa..403f05b 100644
--- a/txtrecv.c
+++ b/txtrecv.c
@@ -13,6 +13,7 @@
#include "txtrecv.h"
#include "tables.h"
#include "setup.h"
+#include "menu.h"
#include <vdr/channels.h>
#include <vdr/device.h>
@@ -500,6 +501,8 @@ cTxtStatus::cTxtStatus(void)
/*doNotSuspend=false;
doNotReceive=false;*/
//suspended=false;
+
+ currentLiveChannel = tChannelID::InvalidID;
}
cTxtStatus::~cTxtStatus()
@@ -515,18 +518,34 @@ cTxtStatus::~cTxtStatus()
void cTxtStatus::ChannelSwitch(const cDevice *Device, int ChannelNumber)
{
- if (Device->IsPrimaryDevice() || Device == cDevice::ActualDevice()) {
- CheckDeleteReceiver();
-
- if (ChannelNumber) {
- cChannel *channel = Channels.GetByNumber(ChannelNumber);
- if (channel && channel->Tpid()) {
- TPid=channel->Tpid();
- chan=channel->GetChannelID();
- CheckCreateReceiver();
- }
+ // ignore if channel is 0
+ if (ChannelNumber == 0) return;
+
+ // ignore if channel is invalid (highly unlikely, this will ever
+ // be the case, but defensive coding rules!)
+ cChannel* newLiveChannel = Channels.GetByNumber(ChannelNumber);
+ if (newLiveChannel == NULL) return;
+
+ // ignore if channel hasn't changed
+ if (currentLiveChannel == newLiveChannel->GetChannelID()) return;
+
+ // ignore non-live-channel-switching
+ if (!Device->IsPrimaryDevice() ||
+ ChannelNumber != cDevice::CurrentChannel()) return;
+
+ // At this point it seems to be pretty sure to me, that the live
+ // channel was changed to a new channel and OSDTeletext can
+ // now re-attach the receiver to the new live channel
+
+ CheckDeleteReceiver();
+
+ if (newLiveChannel->Tpid()) {
+ TPid=newLiveChannel->Tpid();
+ chan=newLiveChannel->GetChannelID();
+ CheckCreateReceiver();
}
- }
+
+ TeletextBrowser::ChannelSwitched(ChannelNumber);
}
void cTxtStatus::CheckCreateReceiver() {
diff --git a/txtrecv.h b/txtrecv.h
index 3ea26da..bb9edc4 100644
--- a/txtrecv.h
+++ b/txtrecv.h
@@ -185,6 +185,7 @@ private:
//cCondVar condVar;
//cMutex mutex;
//int count;
+ tChannelID currentLiveChannel;
protected:
int TPid;
tChannelID chan;