From 57f58a154654311fc70e478c0b36262da5c414c6 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 7 Mar 2012 14:39:38 +0100 Subject: [PATCH] Removed the obsolete function cEITScanner::UsesDevice(); added new parameter LiveView to cStatus::ChannelSwitch() --- HISTORY | 5 +++++ PLUGINS.html | 4 ++-- PLUGINS/src/rcu/HISTORY | 4 ++++ PLUGINS/src/rcu/rcu.c | 10 +++++----- device.c | 6 +++--- eitscan.c | 5 +---- eitscan.h | 4 +--- status.c | 6 +++--- status.h | 7 ++++--- 9 files changed, 28 insertions(+), 23 deletions(-) diff --git a/HISTORY b/HISTORY index fc43bdc1..a79267b0 100644 --- a/HISTORY +++ b/HISTORY @@ -6984,3 +6984,8 @@ Video Disk Recorder Revision History - Removed the calls to EITScanner.UsesDevice(this) from dvb[hs]ddevice.c, because the code following these calls is only executed if LiveView is true, which is never the case when the EITScanner switches to a channel. +- Removed the obsolete function cEITScanner::UsesDevice(). If a plugin has used this + function to find out whether a call to its cStatus::ChannelSwitch() function was + due to a live channel switch, it can use that function's new parameter LiveView. + Any plugins that implement cStatus::ChannelSwitch() need to add the parameter + 'bool LiveView' to that function. diff --git a/PLUGINS.html b/PLUGINS.html index 804d0550..5f936e56 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -1221,10 +1221,10 @@ If a plugin wants to get informed on various events in VDR, it can derive a clas class cMyStatusMonitor : public cStatus { protected: - virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber); + virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber
, bool LiveView
); }; -void cMyStatusMonitor::ChannelSwitch(const cDevice *Device, int ChannelNumber) +void cMyStatusMonitor::ChannelSwitch(const cDevice *Device, int ChannelNumber
, bool LiveView
) { if (ChannelNumber) dsyslog("channel switched to %d on DVB %d", ChannelNumber, Device->CardIndex()); diff --git a/PLUGINS/src/rcu/HISTORY b/PLUGINS/src/rcu/HISTORY index 692f6208..87b9413e 100644 --- a/PLUGINS/src/rcu/HISTORY +++ b/PLUGINS/src/rcu/HISTORY @@ -4,3 +4,7 @@ VDR Plugin 'rcu' Revision History 2012-02-27: Version 0.0.1 - Initial revision. + +2012-03-07: Version 0.0.2 + +- Added new parameter LiveView to ChannelSwitch(). diff --git a/PLUGINS/src/rcu/rcu.c b/PLUGINS/src/rcu/rcu.c index f0abedde..79f46122 100644 --- a/PLUGINS/src/rcu/rcu.c +++ b/PLUGINS/src/rcu/rcu.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: rcu.c 1.1 2012/02/27 11:49:51 kls Exp $ + * $Id: rcu.c 1.2 2012/03/07 14:22:44 kls Exp $ */ #include @@ -16,7 +16,7 @@ #include #include -static const char *VERSION = "0.0.1"; +static const char *VERSION = "0.0.2"; static const char *DESCRIPTION = "Remote Control Unit"; #define REPEATLIMIT 150 // ms @@ -44,7 +44,7 @@ private: void SetString(const char *s); bool DetectCode(unsigned char *Code); virtual void Action(void); - virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber); + virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView); virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On); public: cRcuRemote(const char *DeviceName); @@ -353,9 +353,9 @@ bool cRcuRemote::DetectCode(unsigned char *Code) return false; } -void cRcuRemote::ChannelSwitch(const cDevice *Device, int ChannelNumber) +void cRcuRemote::ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView) { - if (ChannelNumber && Device->IsPrimaryDevice()) + if (ChannelNumber && LiveView) SetNumber(cDevice::CurrentChannel()); } diff --git a/device.c b/device.c index 0452edc1..8c527aac 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 2.56 2012/03/06 12:32:38 kls Exp $ + * $Id: device.c 2.57 2012/03/07 14:17:49 kls Exp $ */ #include "device.h" @@ -723,7 +723,7 @@ bool cDevice::SwitchChannel(int Direction) eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView) { - cStatus::MsgChannelSwitch(this, 0); + cStatus::MsgChannelSwitch(this, 0, LiveView); if (LiveView) { StopReplay(); @@ -793,7 +793,7 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView) EnsureAudioTrack(true); EnsureSubtitleTrack(); } - cStatus::MsgChannelSwitch(this, Channel->Number()); // only report status if channel switch successfull + cStatus::MsgChannelSwitch(this, Channel->Number(), LiveView); // only report status if channel switch successfull } return Result; diff --git a/eitscan.c b/eitscan.c index 91d9a88c..990518ed 100644 --- a/eitscan.c +++ b/eitscan.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: eitscan.c 2.5 2011/10/16 14:10:00 kls Exp $ + * $Id: eitscan.c 2.6 2012/03/07 14:16:57 kls Exp $ */ #include "eitscan.h" @@ -92,7 +92,6 @@ cEITScanner EITScanner; cEITScanner::cEITScanner(void) { lastScan = lastActivity = time(NULL); - currentDevice = NULL; currentChannel = 0; scanList = NULL; transponderList = NULL; @@ -159,10 +158,8 @@ void cEITScanner::Process(void) Skins.Message(mtInfo, tr("Starting EPG scan")); } } - currentDevice = Device;//XXX see also dvbdevice.c!!! //dsyslog("EIT scan: device %d source %-8s tp %5d", Device->DeviceNumber() + 1, *cSource::ToString(Channel->Source()), Channel->Transponder()); Device->SwitchChannel(Channel, false); - currentDevice = NULL; scanList->Del(ScanData); AnyDeviceSwitched = true; break; diff --git a/eitscan.h b/eitscan.h index 8f6e391d..128b0b0a 100644 --- a/eitscan.h +++ b/eitscan.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: eitscan.h 1.9 2005/09/04 10:51:35 kls Exp $ + * $Id: eitscan.h 2.1 2012/03/07 14:16:57 kls Exp $ */ #ifndef __EITSCAN_H @@ -24,7 +24,6 @@ private: ScanTimeout = 20 }; time_t lastScan, lastActivity; - cDevice *currentDevice; int currentChannel; cScanList *scanList; cTransponderList *transponderList; @@ -32,7 +31,6 @@ public: cEITScanner(void); ~cEITScanner(); bool Active(void) { return currentChannel || lastActivity == 0; } - bool UsesDevice(const cDevice *Device) { return currentDevice == Device; } void AddTransponder(cChannel *Channel); void ForceScan(void); void Activity(void); diff --git a/status.c b/status.c index 1d7a8d42..b0a6aba0 100644 --- a/status.c +++ b/status.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: status.c 1.10 2008/02/16 14:46:31 kls Exp $ + * $Id: status.c 2.1 2012/03/07 14:17:24 kls Exp $ */ #include "status.h" @@ -29,10 +29,10 @@ void cStatus::MsgTimerChange(const cTimer *Timer, eTimerChange Change) sm->TimerChange(Timer, Change); } -void cStatus::MsgChannelSwitch(const cDevice *Device, int ChannelNumber) +void cStatus::MsgChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView) { for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm)) - sm->ChannelSwitch(Device, ChannelNumber); + sm->ChannelSwitch(Device, ChannelNumber, LiveView); } void cStatus::MsgRecording(const cDevice *Device, const char *Name, const char *FileName, bool On) diff --git a/status.h b/status.h index b6c4d8b4..63191657 100644 --- a/status.h +++ b/status.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: status.h 1.12 2008/02/16 15:00:33 kls Exp $ + * $Id: status.h 2.1 2012/03/07 14:16:57 kls Exp $ */ #ifndef __STATUS_H @@ -30,10 +30,11 @@ protected: // been added or will be deleted, respectively. In case of tcMod, // Timer is NULL; this indicates that some timer has been changed. // Note that tcAdd and tcDel are always also followed by a tcMod. - virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber) {} + virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView) {} // Indicates a channel switch on the given DVB device. // If ChannelNumber is 0, this is before the channel is being switched, // otherwise ChannelNumber is the number of the channel that has been switched to. + // LiveView tells whether this channel switch is for live viewing. virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On) {} // The given DVB device has started (On = true) or stopped (On = false) recording Name. // Name is the name of the recording, without any directory path. The full file name @@ -85,7 +86,7 @@ public: virtual ~cStatus(); // These functions are called whenever the related status information changes: static void MsgTimerChange(const cTimer *Timer, eTimerChange Change); - static void MsgChannelSwitch(const cDevice *Device, int ChannelNumber); + static void MsgChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView); static void MsgRecording(const cDevice *Device, const char *Name, const char *FileName, bool On); static void MsgReplaying(const cControl *Control, const char *Name, const char *FileName, bool On); static void MsgSetVolume(int Volume, bool Absolute);