diff options
| author | Midas <vdrportal_midas@gmx.de> | 2010-04-22 01:06:40 +0200 |
|---|---|---|
| committer | Midas <vdrportal_midas@gmx.de> | 2010-04-22 01:06:40 +0200 |
| commit | 4921cf32c8bda089a21dc4a14ce191ed477f80ff (patch) | |
| tree | ff9debb648949a2ad43ee7759fb667fb03a78b73 /block/status.c | |
| download | vdr-plugin-block-4921cf32c8bda089a21dc4a14ce191ed477f80ff.tar.gz vdr-plugin-block-4921cf32c8bda089a21dc4a14ce191ed477f80ff.tar.bz2 | |
Initial release. Version 0.0.1b. Fork of the taste plugin 0.0.2d by LordJaxom.
Patches for the taste plugin by tomg and mapovi were added permanently to the
source of the block plugin. For more information, feature list und bugfixes
read HISTORY and README please.
Diffstat (limited to 'block/status.c')
| -rw-r--r-- | block/status.c | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/block/status.c b/block/status.c new file mode 100644 index 0000000..64b9d85 --- /dev/null +++ b/block/status.c @@ -0,0 +1,103 @@ +/** + * based on status.c,v 1.2 2007/05/08 10:16:23 thomas + * + * version by Midas + * + */ + +#include <vdr/channels.h> + +#include "status.h" +#include "control.h" +#include "event.h" + +cStatusBlock::cStatusBlock(void): + cStatus(), + mLastChannel(0) // int +{ +} + +void cStatusBlock::ChannelSwitch(const cDevice *Device, int ChannelNumber) +{ + printf("cStatusBlock::ChannelSwitch(%p, %d)\n", Device, ChannelNumber); + +#ifdef LOGGING + dsyslog("plugin-block: cStatusBlock was informed about channel switch at device %d, channel no %d",Device->DeviceNumber(),ChannelNumber); + dsyslog("plugin-block: cDevice::CurrentChannel %d",cDevice::CurrentChannel()); + dsyslog("plugin-block: Device %d, ActualDevice %d, primary Device %d",Device->DeviceNumber(),cDevice::ActualDevice()->DeviceNumber(),cDevice::PrimaryDevice()->DeviceNumber()); + for (int ii=0;ii<cDevice::NumDevices();ii++) + { + cDevice* tmpdev=cDevice::GetDevice(ii); + dsyslog("plugin-block: cDevice %d replaying: %d, transferring %d",ii,tmpdev->Replaying(),tmpdev->Transferring()); + } +#endif + + + if (Device->DeviceNumber()!=cDevice::PrimaryDevice()->DeviceNumber()) + { +#ifdef LOGGING + dsyslog("plugin-block: Did nothing cause ChannelSwitch not on active livedevice."); +#endif + 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 + dsyslog("plugin-block: Did nothing because ChannelNumber!=CurrentChannel (switch still in progress)"); +#endif + return; + } + + if (Device->Replaying()) + { +#ifdef LOGGING + dsyslog("plugin-block: Did nothing because Device is Replaying"); +#endif + return; + } + + const cChannel *channel = Channels.GetByNumber(ChannelNumber); + if (channel != NULL && !channel->GroupSep()) { + cSchedulesLock schedLock; + const cSchedules *scheds = cSchedules::Schedules(schedLock); + if (scheds == NULL) + return; + + const cSchedule *sched = scheds->GetSchedule(channel->GetChannelID()); + if (sched == NULL) + return; + + const cEvent *present = sched->GetPresentEvent(); + const cEvent *follow = sched->GetFollowingEvent(); + if (present == NULL) + return; + + 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; + } + } + + +} + |
