From 18840de21708c44fb93c7b3bc461cca474433872 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Thu, 29 Mar 2012 21:48:52 +0300 Subject: [PATCH] Added the dynamite compatibility patch (Thanks to Lars Hanisch). --- HISTORY | 4 ++++ femon.c | 6 +++--- femonosd.c | 4 ++-- femontools.c | 10 ++++++++++ femontools.h | 2 ++ 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/HISTORY b/HISTORY index b531b39..bc8402f 100644 --- a/HISTORY +++ b/HISTORY @@ -446,3 +446,7 @@ VDR Plugin 'femon' Revision History - Updated for vdr-1.7.27. - Cleaned up compilation warnings again. + +2012-xx-xx: Version 1.7.17 + +- Added the dynamite compatibility patch (Thanks to Lars Hanisch). diff --git a/femon.c b/femon.c index 2e24160..018519e 100644 --- a/femon.c +++ b/femon.c @@ -22,7 +22,7 @@ #define GITVERSION "" #endif -static const char VERSION[] = "1.7.16" GITVERSION; +static const char VERSION[] = "1.7.17" GITVERSION; static const char DESCRIPTION[] = trNOOP("DVB Signal Information Monitor (OSD)"); static const char MAINMENUENTRY[] = trNOOP("Signal Information"); @@ -139,7 +139,7 @@ bool cPluginFemon::Service(const char *Id, void *Data) FemonService_v1_0 *data = (FemonService_v1_0*)Data; if (!cDevice::ActualDevice()) return false; - cDvbDevice *dev = dynamic_cast(cDevice::ActualDevice()); + cDvbDevice *dev = getDvbDevice(cDevice::ActualDevice()); data->fe_name = getFrontendName(dev); data->fe_status = getFrontendStatus(dev); data->fe_snr = getSNR(dev); @@ -198,7 +198,7 @@ const char **cPluginFemon::SVDRPHelpPages(void) cString cPluginFemon::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode) { - cDvbDevice *dev = dynamic_cast(cDevice::ActualDevice()); + cDvbDevice *dev = getDvbDevice(cDevice::ActualDevice()); if (*Option && isnumber(Option)) { cDvbDevice *dev2 = dynamic_cast(cDevice::GetDevice(int(strtol(Option, NULL, 10)))); if (dev2) diff --git a/femonosd.c b/femonosd.c index bad8b37..ddd0f87 100644 --- a/femonosd.c +++ b/femonosd.c @@ -678,7 +678,7 @@ void cFemonOsd::Show(void) } if (m_DeviceSource == DEVICESOURCE_DVBAPI) { - cDvbDevice *dev = dynamic_cast(cDevice::ActualDevice()); + cDvbDevice *dev = getDvbDevice(cDevice::ActualDevice()); m_Frontend = dev ? open(*cString::sprintf(FRONTEND_DEVICE, dev->Adapter(), dev->Frontend()), O_RDONLY | O_NONBLOCK) : -1; if (m_Frontend >= 0) { if (ioctl(m_Frontend, FE_GET_INFO, &m_FrontendInfo) < 0) { @@ -752,7 +752,7 @@ void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber, bool li } if (m_DeviceSource == DEVICESOURCE_DVBAPI) { - cDvbDevice *dev = dynamic_cast(cDevice::ActualDevice()); + cDvbDevice *dev = getDvbDevice(cDevice::ActualDevice()); m_Frontend = dev ? open(*cString::sprintf(FRONTEND_DEVICE, dev->Adapter(), dev->Frontend()), O_RDONLY | O_NONBLOCK) : -1; if (m_Frontend >= 0) { if (ioctl(m_Frontend, FE_GET_INFO, &m_FrontendInfo) < 0) { diff --git a/femontools.c b/femontools.c index c0413cc..08d5b5f 100644 --- a/femontools.c +++ b/femontools.c @@ -76,6 +76,16 @@ static const char *getUserString(int Value, const tDvbParameterMap *Map) return "---"; } +cDvbDevice *getDvbDevice(cDevice* device) +{ + cDvbDevice *dev = dynamic_cast(device); +#ifdef __DYNAMIC_DEVICE_PROBE + if (!dev && device && device->HasSubDevice()) + dev = dynamic_cast(device->SubDevice()); +#endif + return dev; +} + cString getFrontendInfo(cDvbDevice *device) { cString info; diff --git a/femontools.h b/femontools.h index fb70d05..660d71c 100644 --- a/femontools.h +++ b/femontools.h @@ -26,6 +26,8 @@ #define FRONTEND_DEVICE "/dev/dvb/adapter%d/frontend%d" +cDvbDevice *getDvbDevice(cDevice* device); + cString getFrontendInfo(cDvbDevice *device); cString getFrontendName(cDvbDevice *device); cString getFrontendStatus(cDvbDevice *device);