From 767b1bdac78d9882d22e5ac7886186aefa3b94ca Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Fri, 10 Jan 2014 23:59:26 +0200 Subject: [PATCH] Added support for cDevice::GetCurrentlyTunedTransponder(). --- HISTORY | 3 ++- device.c | 17 +++++++++++------ device.h | 3 ++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/HISTORY b/HISTORY index d4ec042..7a23c01 100644 --- a/HISTORY +++ b/HISTORY @@ -217,5 +217,6 @@ VDR Plugin 'iptv' Revision History - Added missing CURL timeouts. - Improved section id scanner. -- Added support for cDevice::IsTunedToTransponder(). +- Added support for cDevice::IsTunedToTransponder() and + cDevice::GetCurrentlyTunedTransponder(). - Fixed a memory leak and some issues reported by scan-build. diff --git a/device.c b/device.c index 70d82c2..476de8c 100644 --- a/device.c +++ b/device.c @@ -20,7 +20,7 @@ cIptvDevice::cIptvDevice(unsigned int indexP) isOpenDvrM(false), sidScanEnabledM(false), pidScanEnabledM(false), - channelIdM(tChannelID::InvalidID) + channelM() { unsigned int bufsize = (unsigned int)MEGABYTE(IptvConfig.GetTsBufferSize()); bufsize -= (bufsize % TS_SIZE); @@ -214,7 +214,7 @@ bool cIptvDevice::ProvidesChannel(const cChannel *channelP, int priorityP, bool if (channelP && ProvidesTransponder(channelP)) { result = hasPriority; if (Receiving()) { - if (channelP->GetChannelID() == channelIdM) + if (channelP->GetChannelID() == channelM.GetChannelID()) result = true; else needsDetachReceivers = Receiving(); @@ -235,9 +235,14 @@ int cIptvDevice::NumProvidedSystems(void) const return 1; } +const cChannel *cIptvDevice::GetCurrentlyTunedTransponder(void) const +{ + return &channelM; +} + bool cIptvDevice::IsTunedToTransponder(const cChannel *channelP) const { - return channelP ? (channelP->GetChannelID() == channelIdM) : false; + return channelP ? (channelP->GetChannelID() == channelM.GetChannelID()) : false; } bool cIptvDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP) @@ -275,11 +280,11 @@ bool cIptvDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP) sidScanEnabledM = itp.SidScan() ? true : false; pidScanEnabledM = itp.PidScan() ? true : false; if (pIptvStreamerM->Set(itp.Address(), itp.Parameter(), deviceIndexM, protocol)) { - channelIdM = channelP->GetChannelID(); + channelM = *channelP; if (sidScanEnabledM && pSidScannerM && IptvConfig.GetSectionFiltering()) - pSidScannerM->SetChannel(channelIdM); + pSidScannerM->SetChannel(channelM.GetChannelID()); if (pidScanEnabledM && pPidScannerM) - pPidScannerM->SetChannel(channelIdM); + pPidScannerM->SetChannel(channelM.GetChannelID()); } return true; } diff --git a/device.h b/device.h index af3b52c..5839495 100644 --- a/device.h +++ b/device.h @@ -40,7 +40,7 @@ private: bool pidScanEnabledM; cRingBufferLinear *tsBufferM; mutable int tsBufferPrefillM; - tChannelID channelIdM; + cChannel channelM; cIptvProtocolUdp *pUdpProtocolM; cIptvProtocolCurl *pCurlProtocolM; cIptvProtocolHttp *pHttpProtocolM; @@ -87,6 +87,7 @@ public: virtual bool ProvidesChannel(const cChannel *channelP, int priorityP = -1, bool *needsDetachReceiversP = NULL) const; virtual bool ProvidesEIT(void) const; virtual int NumProvidedSystems(void) const; + virtual const cChannel *GetCurrentlyTunedTransponder(void) const; virtual bool IsTunedToTransponder(const cChannel *channelP) const; protected: virtual bool SetChannelDevice(const cChannel *channelP, bool liveViewP);