diff --git a/device.c b/device.c index fb58d7f..ee8c1c5 100644 --- a/device.c +++ b/device.c @@ -373,7 +373,7 @@ bool cSatipDevice::SetPid(cPidHandle *handleP, int typeP, bool onP) if (pTunerM && handleP && handleP->pid >= 0) { if (onP) return pTunerM->SetPid(handleP->pid, typeP, true); - else if (!handleP->used) + else if (!handleP->used && pSectionFilterHandlerM && !pSectionFilterHandlerM->Exists(handleP->pid)) return pTunerM->SetPid(handleP->pid, typeP, false); } return true; diff --git a/sectionfilter.c b/sectionfilter.c index edf0382..10f655b 100644 --- a/sectionfilter.c +++ b/sectionfilter.c @@ -338,6 +338,19 @@ cString cSatipSectionFilterHandler::GetInformation(void) return s; } +bool cSatipSectionFilterHandler::Exists(u_short pidP) +{ + debug16("%s (%d) [device %d]", __PRETTY_FUNCTION__, pidP, deviceIndexM); + cMutexLock MutexLock(&mutexM); + for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { + if (filtersM[i] && (pidP == filtersM[i]->GetPid())) { + debug12("%s (%d) Found [device %d]", __PRETTY_FUNCTION__, pidP, deviceIndexM); + return true; + } + } + return false; +} + bool cSatipSectionFilterHandler::Delete(unsigned int indexP) { debug16("%s (%d) [device %d]", __PRETTY_FUNCTION__, indexP, deviceIndexM); diff --git a/sectionfilter.h b/sectionfilter.h index e25c897..833511c 100644 --- a/sectionfilter.h +++ b/sectionfilter.h @@ -80,6 +80,7 @@ public: cSatipSectionFilterHandler(int deviceIndexP, unsigned int bufferLenP); virtual ~cSatipSectionFilterHandler(); cString GetInformation(void); + bool Exists(u_short pidP); int Open(u_short pidP, u_char tidP, u_char maskP); void Close(int handleP); int GetPid(int handleP);