diff options
-rw-r--r-- | block.c | 14 | ||||
-rw-r--r-- | config.c | 2 | ||||
-rw-r--r-- | config.h | 1 | ||||
-rw-r--r-- | control.c | 10 | ||||
-rw-r--r-- | control.h | 2 | ||||
-rw-r--r-- | status.c | 36 | ||||
-rw-r--r-- | status.h | 2 |
7 files changed, 24 insertions, 43 deletions
@@ -29,7 +29,6 @@ static char *temptitle=NULL; class cPluginBlock : public cPlugin { private: cStatusBlock *mStatus; - int mLastChannel; public: cPluginBlock(void); @@ -47,8 +46,7 @@ public: cPluginBlock::cPluginBlock(void): cPlugin(), - mStatus(NULL), - mLastChannel(0) + mStatus(NULL) { temptitle=""; } @@ -106,11 +104,8 @@ void cPluginBlock::MainThreadHook() { if (SetupBlock.DetectionMethod!=1) return;//other detection method active in setup channelnumber=cDevice::PrimaryDevice()->CurrentChannel(); - if (channelnumber==0 || mLastChannel==0) //cond#1: switch in progress - { - mLastChannel=cDevice::CurrentChannel(); - return; - } + + if (channelnumber==0) return; //switch in progress const cChannel *channel=Channels.GetByNumber(channelnumber); @@ -147,8 +142,7 @@ void cPluginBlock::MainThreadHook() if (!EventsBlock.Acceptable(title)) { isyslog("plugin-block: channel %d is not acceptable at present", channelnumber); - cControl::Launch(new cControlBlock(mLastChannel, channel, present, follow)); - mLastChannel=0; + cControl::Launch(new cControlBlock(channel, present, follow)); } } } @@ -12,6 +12,8 @@ cSetupBlock SetupBlock; +int cSetupBlock::LastChannel=0; + cSetupBlock::cSetupBlock(void): HideMenuEntry(0), MessageTimeout(2), @@ -13,6 +13,7 @@ public: int HideMenuEntry; int MessageTimeout; int DetectionMethod; + static int LastChannel; cSetupBlock(void); bool Parse(const char *Name, const char *Value); @@ -15,9 +15,8 @@ inline uint64_t BlockTimeout() { return SetupBlock.MessageTimeout * 1000; } bool cControlBlock::mRequested = false; -cControlBlock::cControlBlock(int LastChannel, const cChannel *Channel, const cEvent *Present, const cEvent *Following): +cControlBlock::cControlBlock(const cChannel *Channel, const cEvent *Present, const cEvent *Following): cControl(new cPlayer), - mLastChannel(LastChannel), mChannel(Channel), mPresent(Present), mFollowing(Following), @@ -58,12 +57,13 @@ cControlBlock::~cControlBlock() } if (mSwitch) { + int lastchannel=cSetupBlock::LastChannel; // possibly first or last available channel, fall back to old channel - int direction = mChannel->Number() - mLastChannel; + int direction = mChannel->Number() - lastchannel; if (direction == 0) direction = 1; - if (!cDevice::SwitchChannel(direction) && (mLastChannel != 0)) - Channels.SwitchTo(mLastChannel); + if (!cDevice::SwitchChannel(direction) && (lastchannel != 0)) + Channels.SwitchTo(lastchannel); } } @@ -28,7 +28,7 @@ protected: virtual void Hide(void) {} public: - cControlBlock(int Direction, const cChannel *Channel, const cEvent *Present, const cEvent *Following); + cControlBlock(const cChannel *Channel, const cEvent *Present, const cEvent *Following); ~cControlBlock(); virtual eOSState ProcessKey(eKeys Key); @@ -13,19 +13,24 @@ #include "config.h" cStatusBlock::cStatusBlock(void): - cStatus(), - mLastChannel(0) // int + cStatus() { } void cStatusBlock::ChannelSwitch(const cDevice *Device, int ChannelNumber) { - if (SetupBlock.DetectionMethod!=0) + if (cSetupBlock::LastChannel==0) { -// dsyslog("plugin-block-DEV: StatusBlock::ChannelSwitch did nothing: Detection Method didn't match"); + cSetupBlock::LastChannel=cDevice::CurrentChannel(); return; } - //printf("cStatusBlock::ChannelSwitch(%p, %d)\n", Device, ChannelNumber); + if (ChannelNumber==0) + { + cSetupBlock::LastChannel=cDevice::CurrentChannel(); + return; //Switch in progress; + } + + if (SetupBlock.DetectionMethod!=0) return; #ifdef LOGGING dsyslog("plugin-block: cStatusBlock was informed about channel switch at device %d, channel no %d",Device->DeviceNumber(),ChannelNumber); @@ -47,24 +52,6 @@ void cStatusBlock::ChannelSwitch(const cDevice *Device, int ChannelNumber) return; } - if (mLastChannel==0) - { -#ifdef LOGGING - dsyslog("plugin-block: Did nothing cause mLastChannel=0 (set to %d)",cDevice::CurrentChannel()); -#endif - mLastChannel=cDevice::CurrentChannel(); - return; - } - - if (ChannelNumber==0) - { - mLastChannel=cDevice::CurrentChannel(); -#ifdef LOGGING - dsyslog("plugin-block: Did nothing because ChannelNumber=0 (some switch is in progress)"); -#endif - return; //seems that switching is in progress - } - if (ChannelNumber!=cDevice::CurrentChannel()) { #ifdef LOGGING @@ -98,8 +85,7 @@ void cStatusBlock::ChannelSwitch(const cDevice *Device, int ChannelNumber) if (!cControlBlock::IsRequested() && !EventsBlock.Acceptable(present->Title())) { isyslog("plugin-block: channel %d is not acceptable at present", ChannelNumber); - cControl::Launch(new cControlBlock(mLastChannel, channel, present, follow)); - mLastChannel=0; + cControl::Launch(new cControlBlock(channel, present, follow)); } } } @@ -11,8 +11,6 @@ #include <vdr/status.h> class cStatusBlock : public cStatus { -private: - int mLastChannel; protected: virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber); |