diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2020-06-10 14:52:43 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2020-06-10 14:52:43 +0200 |
commit | 8a282ef267b73c4d4a6f03e174946fd23692f58e (patch) | |
tree | a8b68b301ac4f8a01faa4a39b954dcdc7f6364c6 | |
parent | 709055980e6f6ed76399cdba032eb5094ec117f5 (diff) | |
download | vdr-8a282ef267b73c4d4a6f03e174946fd23692f58e.tar.gz vdr-8a282ef267b73c4d4a6f03e174946fd23692f58e.tar.bz2 |
Added a device hook for detecting whether a device provides EIT data
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | PLUGINS.html | 19 | ||||
-rw-r--r-- | device.c | 18 | ||||
-rw-r--r-- | device.h | 5 | ||||
-rw-r--r-- | dvbdevice.c | 4 |
6 files changed, 43 insertions, 6 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 8c48c08f..36ce8bd1 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2754,6 +2754,7 @@ Winfried Köhler <w_koehl@gmx.de> 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 <hilse@web.de> for adding the command line option --userdump to enable core dumps in case VDR @@ -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! <b>Device hooks</b> <p> 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 <i>device hooks</i> can be used. <p><table><tr><td class="code"><pre> @@ -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; }; </pre></td></tr></table><p> @@ -2050,6 +2052,19 @@ bool cMyDeviceHook::DeviceProvidesTransponder(const cDevice *Device, const cChan } </pre></td></tr></table><p> +In its <tt>DeviceProvidesEIT()</tt> function the device hook can take +whatever actions are necessary to determine whether the given Device can +provide EIT data, as in + +<p><table><tr><td class="code"><pre> +bool cMyDeviceHook::DeviceProvidesEIT(const cDevice *Device) const +{ + if (<i>condition where Device can't provide EIT data</i>) + return false; + return true; +} +</pre></td></tr></table><p> + A plugin that creates a derived cDeviceHook shall do so in its <tt>Initialize()</tt> function, as in @@ -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; @@ -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<cDeviceHook> 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 |