1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Added a device hook for detecting whether a device provides EIT data

This commit is contained in:
Klaus Schmidinger 2020-06-10 14:52:43 +02:00
parent 709055980e
commit 8a282ef267
6 changed files with 43 additions and 6 deletions

View File

@ -2754,6 +2754,7 @@ Winfried K
regarding detaching a receiver from its device before deleting it regarding detaching a receiver from its device before deleting it
for fixing some copy&paste errors in PLUGINS.html for fixing some copy&paste errors in PLUGINS.html
for fixing the size of cChannel::dtypes[] 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> Hans-Werner Hilse <hilse@web.de>
for adding the command line option --userdump to enable core dumps in case VDR for adding the command line option --userdump to enable core dumps in case VDR

View File

@ -9460,3 +9460,5 @@ Video Disk Recorder Revision History
- Fixed the size of cChannel::dtypes[] (thanks to Winfried Köhler). - 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 The version numbers (both VDRVERSNUM and APIVERSNUM) have been bumped to 2.4.3 to
indicate this change. indicate this change.
- Added a device hook for detecting whether a device provides EIT data (thanks to
Winfried Köhler).

View File

@ -2025,8 +2025,9 @@ operator!
<b>Device hooks</b> <b>Device hooks</b>
<p> <p>
VDR has builtin facilities that select which device is able to provide a given 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 transponder, or, which device may provide EIT data. However, there may be
that it requires considerations that exceed the scope of the core VDR code. 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. This is where <i>device hooks</i> can be used.
<p><table><tr><td class="code"><pre> <p><table><tr><td class="code"><pre>
@ -2034,6 +2035,7 @@ class cMyDeviceHook : public cDeviceHook {
public: public:
cMyDeviceHook(void); cMyDeviceHook(void);
virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const; virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const;
virtual bool DeviceProvidesEIT(const cDevice *Device) const;
}; };
</pre></td></tr></table><p> </pre></td></tr></table><p>
@ -2050,6 +2052,19 @@ bool cMyDeviceHook::DeviceProvidesTransponder(const cDevice *Device, const cChan
} }
</pre></td></tr></table><p> </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> A plugin that creates a derived cDeviceHook shall do so in its <tt>Initialize()</tt>
function, as in function, as in

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 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" #include "device.h"
@ -58,6 +58,11 @@ bool cDeviceHook::DeviceProvidesTransponder(const cDevice *Device, const cChanne
return true; return true;
} }
bool cDeviceHook::DeviceProvidesEIT(const cDevice *Device) const
{
return true;
}
// --- cDevice --------------------------------------------------------------- // --- cDevice ---------------------------------------------------------------
// The minimum number of unknown PS1 packets to consider this a "pre 1.3.19 private stream": // 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; 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 bool cDevice::ProvidesTransponder(const cChannel *Channel) const
{ {
return false; return false;

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.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 #ifndef __DEVICE_H
@ -95,6 +95,8 @@ public:
///< program ends. ///< program ends.
virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const; virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const;
///< Returns true if the given Device can provide the given Channel's transponder. ///< 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. /// The cDevice class is the base from which actual devices can be derived.
@ -236,6 +238,7 @@ private:
static cList<cDeviceHook> deviceHooks; static cList<cDeviceHook> deviceHooks;
protected: protected:
bool DeviceHooksProvidesTransponder(const cChannel *Channel) const; bool DeviceHooksProvidesTransponder(const cChannel *Channel) const;
bool DeviceHooksProvidesEIT(void) const;
// SPU facilities // SPU facilities

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: 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" #include "dvbdevice.h"
@ -2244,7 +2244,7 @@ bool cDvbDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *Ne
bool cDvbDevice::ProvidesEIT(void) const bool cDvbDevice::ProvidesEIT(void) const
{ {
return dvbTuner != NULL; return dvbTuner != NULL && DeviceHooksProvidesEIT();
} }
int cDvbDevice::NumProvidedSystems(void) const int cDvbDevice::NumProvidedSystems(void) const