summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block.c14
-rw-r--r--config.c2
-rw-r--r--config.h1
-rw-r--r--control.c10
-rw-r--r--control.h2
-rw-r--r--status.c36
-rw-r--r--status.h2
7 files changed, 24 insertions, 43 deletions
diff --git a/block.c b/block.c
index 29201f8..d74a9f8 100644
--- a/block.c
+++ b/block.c
@@ -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));
}
}
}
diff --git a/config.c b/config.c
index 9a3a4a9..a31d27c 100644
--- a/config.c
+++ b/config.c
@@ -12,6 +12,8 @@
cSetupBlock SetupBlock;
+int cSetupBlock::LastChannel=0;
+
cSetupBlock::cSetupBlock(void):
HideMenuEntry(0),
MessageTimeout(2),
diff --git a/config.h b/config.h
index 76e7903..12a3d52 100644
--- a/config.h
+++ b/config.h
@@ -13,6 +13,7 @@ public:
int HideMenuEntry;
int MessageTimeout;
int DetectionMethod;
+ static int LastChannel;
cSetupBlock(void);
bool Parse(const char *Name, const char *Value);
diff --git a/control.c b/control.c
index 4974888..c573439 100644
--- a/control.c
+++ b/control.c
@@ -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);
}
}
diff --git a/control.h b/control.h
index 8029c52..3dfdc54 100644
--- a/control.h
+++ b/control.h
@@ -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);
diff --git a/status.c b/status.c
index 9ec44d1..70258cc 100644
--- a/status.c
+++ b/status.c
@@ -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));
}
}
}
diff --git a/status.h b/status.h
index 6525c3a..0051c28 100644
--- a/status.h
+++ b/status.h
@@ -11,8 +11,6 @@
#include <vdr/status.h>
class cStatusBlock : public cStatus {
-private:
- int mLastChannel;
protected:
virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber);