Removed the obsolete function cEITScanner::UsesDevice(); added new parameter LiveView to cStatus::ChannelSwitch()

This commit is contained in:
Klaus Schmidinger 2012-03-07 14:39:38 +01:00
parent 680b1b8f87
commit 57f58a1546
9 changed files with 28 additions and 23 deletions

View File

@ -6984,3 +6984,8 @@ Video Disk Recorder Revision History
- Removed the calls to EITScanner.UsesDevice(this) from dvb[hs]ddevice.c, because - 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 the code following these calls is only executed if LiveView is true, which is
never the case when the EITScanner switches to a channel. 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.

View File

@ -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 { class cMyStatusMonitor : public cStatus {
protected: protected:
virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber); virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber<div class="modified">, bool LiveView</div>);
}; };
void cMyStatusMonitor::ChannelSwitch(const cDevice *Device, int ChannelNumber) void cMyStatusMonitor::ChannelSwitch(const cDevice *Device, int ChannelNumber<div class="modified">, bool LiveView</div>)
{ {
if (ChannelNumber) if (ChannelNumber)
dsyslog("channel switched to %d on DVB %d", ChannelNumber, Device-&gt;CardIndex()); dsyslog("channel switched to %d on DVB %d", ChannelNumber, Device-&gt;CardIndex());

View File

@ -4,3 +4,7 @@ VDR Plugin 'rcu' Revision History
2012-02-27: Version 0.0.1 2012-02-27: Version 0.0.1
- Initial revision. - Initial revision.
2012-03-07: Version 0.0.2
- Added new parameter LiveView to ChannelSwitch().

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * 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 <getopt.h> #include <getopt.h>
@ -16,7 +16,7 @@
#include <vdr/thread.h> #include <vdr/thread.h>
#include <vdr/tools.h> #include <vdr/tools.h>
static const char *VERSION = "0.0.1"; static const char *VERSION = "0.0.2";
static const char *DESCRIPTION = "Remote Control Unit"; static const char *DESCRIPTION = "Remote Control Unit";
#define REPEATLIMIT 150 // ms #define REPEATLIMIT 150 // ms
@ -44,7 +44,7 @@ private:
void SetString(const char *s); void SetString(const char *s);
bool DetectCode(unsigned char *Code); bool DetectCode(unsigned char *Code);
virtual void Action(void); 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); virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On);
public: public:
cRcuRemote(const char *DeviceName); cRcuRemote(const char *DeviceName);
@ -353,9 +353,9 @@ bool cRcuRemote::DetectCode(unsigned char *Code)
return false; 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()); SetNumber(cDevice::CurrentChannel());
} }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "device.h"
@ -723,7 +723,7 @@ bool cDevice::SwitchChannel(int Direction)
eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView) eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
{ {
cStatus::MsgChannelSwitch(this, 0); cStatus::MsgChannelSwitch(this, 0, LiveView);
if (LiveView) { if (LiveView) {
StopReplay(); StopReplay();
@ -793,7 +793,7 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
EnsureAudioTrack(true); EnsureAudioTrack(true);
EnsureSubtitleTrack(); 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; return Result;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "eitscan.h"
@ -92,7 +92,6 @@ cEITScanner EITScanner;
cEITScanner::cEITScanner(void) cEITScanner::cEITScanner(void)
{ {
lastScan = lastActivity = time(NULL); lastScan = lastActivity = time(NULL);
currentDevice = NULL;
currentChannel = 0; currentChannel = 0;
scanList = NULL; scanList = NULL;
transponderList = NULL; transponderList = NULL;
@ -159,10 +158,8 @@ void cEITScanner::Process(void)
Skins.Message(mtInfo, tr("Starting EPG scan")); 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()); //dsyslog("EIT scan: device %d source %-8s tp %5d", Device->DeviceNumber() + 1, *cSource::ToString(Channel->Source()), Channel->Transponder());
Device->SwitchChannel(Channel, false); Device->SwitchChannel(Channel, false);
currentDevice = NULL;
scanList->Del(ScanData); scanList->Del(ScanData);
AnyDeviceSwitched = true; AnyDeviceSwitched = true;
break; break;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __EITSCAN_H
@ -24,7 +24,6 @@ private:
ScanTimeout = 20 ScanTimeout = 20
}; };
time_t lastScan, lastActivity; time_t lastScan, lastActivity;
cDevice *currentDevice;
int currentChannel; int currentChannel;
cScanList *scanList; cScanList *scanList;
cTransponderList *transponderList; cTransponderList *transponderList;
@ -32,7 +31,6 @@ public:
cEITScanner(void); cEITScanner(void);
~cEITScanner(); ~cEITScanner();
bool Active(void) { return currentChannel || lastActivity == 0; } bool Active(void) { return currentChannel || lastActivity == 0; }
bool UsesDevice(const cDevice *Device) { return currentDevice == Device; }
void AddTransponder(cChannel *Channel); void AddTransponder(cChannel *Channel);
void ForceScan(void); void ForceScan(void);
void Activity(void); void Activity(void);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "status.h"
@ -29,10 +29,10 @@ void cStatus::MsgTimerChange(const cTimer *Timer, eTimerChange Change)
sm->TimerChange(Timer, 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)) 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) void cStatus::MsgRecording(const cDevice *Device, const char *Name, const char *FileName, bool On)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __STATUS_H
@ -30,10 +30,11 @@ protected:
// been added or will be deleted, respectively. In case of tcMod, // been added or will be deleted, respectively. In case of tcMod,
// Timer is NULL; this indicates that some timer has been changed. // Timer is NULL; this indicates that some timer has been changed.
// Note that tcAdd and tcDel are always also followed by a tcMod. // 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. // Indicates a channel switch on the given DVB device.
// If ChannelNumber is 0, this is before the channel is being switched, // 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. // 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) {} 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. // 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 // Name is the name of the recording, without any directory path. The full file name
@ -85,7 +86,7 @@ public:
virtual ~cStatus(); virtual ~cStatus();
// These functions are called whenever the related status information changes: // These functions are called whenever the related status information changes:
static void MsgTimerChange(const cTimer *Timer, eTimerChange Change); 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 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 MsgReplaying(const cControl *Control, const char *Name, const char *FileName, bool On);
static void MsgSetVolume(int Volume, bool Absolute); static void MsgSetVolume(int Volume, bool Absolute);