diff options
-rw-r--r-- | HISTORY | 3 | ||||
-rw-r--r-- | menu.c | 11 | ||||
-rw-r--r-- | menu.h | 8 | ||||
-rw-r--r-- | osdteletext.c | 5 | ||||
-rw-r--r-- | txtrecv.c | 41 | ||||
-rw-r--r-- | txtrecv.h | 1 |
6 files changed, 34 insertions, 35 deletions
@@ -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 @@ -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() { @@ -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; @@ -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() { @@ -185,6 +185,7 @@ private: //cCondVar condVar; //cMutex mutex; //int count; + tChannelID currentLiveChannel; protected: int TPid; tChannelID chan; |