diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 8c48c08f..36ce8bd1 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2754,6 +2754,7 @@ Winfried K regarding detaching a receiver from its device before deleting it for fixing some copy&paste errors in PLUGINS.html for fixing the size of cChannel::dtypes[] + for adding a device hook for detecting whether a device provides EIT data Hans-Werner Hilse for adding the command line option --userdump to enable core dumps in case VDR diff --git a/HISTORY b/HISTORY index f45d4520..a2f49745 100644 --- a/HISTORY +++ b/HISTORY @@ -9460,3 +9460,5 @@ Video Disk Recorder Revision History - Fixed the size of cChannel::dtypes[] (thanks to Winfried Köhler). The version numbers (both VDRVERSNUM and APIVERSNUM) have been bumped to 2.4.3 to indicate this change. +- Added a device hook for detecting whether a device provides EIT data (thanks to + Winfried Köhler). diff --git a/PLUGINS.html b/PLUGINS.html index 7e9bc286..39b5031e 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -2025,8 +2025,9 @@ operator! Device hooks

VDR has builtin facilities that select which device is able to provide a given -transponder. However, there may be situations where the setup is so special -that it requires considerations that exceed the scope of the core VDR code. +transponder, or, which device may provide EIT data. However, there may be +situations where the setup is so special that it requires considerations that +exceed the scope of the core VDR code. This is where device hooks can be used.

@@ -2034,6 +2035,7 @@ class cMyDeviceHook : public cDeviceHook {
 public:
   cMyDeviceHook(void);
   virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const;
+  virtual bool DeviceProvidesEIT(const cDevice *Device) const;
   };
 

@@ -2050,6 +2052,19 @@ bool cMyDeviceHook::DeviceProvidesTransponder(const cDevice *Device, const cChan }

+In its DeviceProvidesEIT() function the device hook can take +whatever actions are necessary to determine whether the given Device can +provide EIT data, as in + +

+bool cMyDeviceHook::DeviceProvidesEIT(const cDevice *Device) const
+{
+  if (condition where Device can't provide EIT data)
+     return false;
+  return true;
+}
+

+ A plugin that creates a derived cDeviceHook shall do so in its Initialize() function, as in diff --git a/device.c b/device.c index 147eecbf..d1bbbd07 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 4.30 2019/05/28 14:50:11 kls Exp $ + * $Id: device.c 4.31 2020/06/10 14:52:43 kls Exp $ */ #include "device.h" @@ -58,6 +58,11 @@ bool cDeviceHook::DeviceProvidesTransponder(const cDevice *Device, const cChanne return true; } +bool cDeviceHook::DeviceProvidesEIT(const cDevice *Device) const +{ + return true; +} + // --- cDevice --------------------------------------------------------------- // The minimum number of unknown PS1 packets to consider this a "pre 1.3.19 private stream": @@ -718,6 +723,17 @@ bool cDevice::DeviceHooksProvidesTransponder(const cChannel *Channel) const return true; } +bool cDevice::DeviceHooksProvidesEIT(void) const +{ + cDeviceHook *Hook = deviceHooks.First(); + while (Hook) { + if (!Hook->DeviceProvidesEIT(this)) + return false; + Hook = deviceHooks.Next(Hook); + } + return true; +} + bool cDevice::ProvidesTransponder(const cChannel *Channel) const { return false; diff --git a/device.h b/device.h index 76785f4b..bebc2d94 100644 --- a/device.h +++ b/device.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.h 4.15 2020/05/04 11:40:44 kls Exp $ + * $Id: device.h 4.16 2020/06/10 14:52:43 kls Exp $ */ #ifndef __DEVICE_H @@ -95,6 +95,8 @@ public: ///< program ends. virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const; ///< Returns true if the given Device can provide the given Channel's transponder. + virtual bool DeviceProvidesEIT(const cDevice *Device) const; + ///< Returns true if the given Device can provide EIT data. }; /// The cDevice class is the base from which actual devices can be derived. @@ -236,6 +238,7 @@ private: static cList deviceHooks; protected: bool DeviceHooksProvidesTransponder(const cChannel *Channel) const; + bool DeviceHooksProvidesEIT(void) const; // SPU facilities diff --git a/dvbdevice.c b/dvbdevice.c index 562d2697..66aedd89 100644 --- a/dvbdevice.c +++ b/dvbdevice.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.c 4.22 2020/05/04 08:50:20 kls Exp $ + * $Id: dvbdevice.c 4.23 2020/06/10 14:52:43 kls Exp $ */ #include "dvbdevice.h" @@ -2244,7 +2244,7 @@ bool cDvbDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *Ne bool cDvbDevice::ProvidesEIT(void) const { - return dvbTuner != NULL; + return dvbTuner != NULL && DeviceHooksProvidesEIT(); } int cDvbDevice::NumProvidedSystems(void) const