diff --git a/device.c b/device.c index da68834..7722e5d 100644 --- a/device.c +++ b/device.c @@ -372,9 +372,9 @@ bool cSatipDevice::SetPid(cPidHandle *handleP, int typeP, bool onP) debug12("%s (%d, %d, %d) [device %u]", __PRETTY_FUNCTION__, handleP ? handleP->pid : -1, typeP, onP, deviceIndexM); if (pTunerM && handleP && handleP->pid >= 0) { if (onP) - return pTunerM->SetPid(handleP->pid, typeP, true); + return pTunerM->SetPid(handleP->pid, typeP, true, true); else if (!handleP->used) - return pTunerM->SetPid(handleP->pid, typeP, false); + return pTunerM->SetPid(handleP->pid, typeP, false, true); } return true; } @@ -385,7 +385,7 @@ int cSatipDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP) if (pSectionFilterHandlerM) { int handle = pSectionFilterHandlerM->Open(pidP, tidP, maskP); if (pTunerM && (handle >= 0)) - pTunerM->SetPid(pidP, ptOther, true); + pTunerM->SetPid(pidP, ptOther, true, false); return handle; } return -1; @@ -397,7 +397,7 @@ void cSatipDevice::CloseFilter(int handleP) int pid = pSectionFilterHandlerM->GetPid(handleP); debug12("%s (%d) [device %u]", __PRETTY_FUNCTION__, pid, deviceIndexM); if (pTunerM) - pTunerM->SetPid(pid, ptOther, false); + pTunerM->SetPid(pid, ptOther, false, false); pSectionFilterHandlerM->Close(handleP); } } @@ -549,6 +549,11 @@ bool cSatipDevice::GetTSPacket(uchar *&dataP) } } dataP = GetData(); + if (dataP && (dataP[4] == 0x00) && (dataP[5] == 0x02) && ((dataP[6] & 0xf0) == 0xb0)) { + int pid = ((dataP[1] & 0x1f) << 8) | dataP[2]; + debug12("%s PID %d 0x%02x%02x%02x%02x%02x%02x%02x", __PRETTY_FUNCTION__, + pid, dataP[0], dataP[1], dataP[2], dataP[3], dataP[4], dataP[5], dataP[6]); + } return true; } dataP = NULL; diff --git a/tuner.c b/tuner.c index bef87d4..bde4d1a 100644 --- a/tuner.c +++ b/tuner.c @@ -47,7 +47,8 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP) pmtPidM(-1), addPidsM(), delPidsM(), - pidsM() + pidsM(), + fixedPidsM() { debug1("%s (, %d) [device %d]", __PRETTY_FUNCTION__, packetLenP, deviceIdM); @@ -405,7 +406,7 @@ bool cSatipTuner::SetSource(cSatipServer *serverP, const int transponderP, const return true; } -bool cSatipTuner::SetPid(int pidP, int typeP, bool onP) +bool cSatipTuner::SetPid(int pidP, int typeP, bool onP, bool fixedP) { debug16("%s (%d, %d, %d) [device %d]", __PRETTY_FUNCTION__, pidP, typeP, onP, deviceIdM); cMutexLock MutexLock(&mutexM); @@ -413,11 +414,14 @@ bool cSatipTuner::SetPid(int pidP, int typeP, bool onP) pidsM.AddPid(pidP); addPidsM.AddPid(pidP); delPidsM.RemovePid(pidP); + if (fixedP) + fixedPidsM.AddPid(pidP); } - else { + else if (fixedP || fixedPidsM.IndexOf(pidP) == -1) { pidsM.RemovePid(pidP); delPidsM.AddPid(pidP); addPidsM.RemovePid(pidP); + fixedPidsM.RemovePid(pidP); } debug12("%s (%d, %d, %d) pids=%s [device %d]", __PRETTY_FUNCTION__, pidP, typeP, onP, *pidsM.ListPids(), deviceIdM); sleepM.Signal(); @@ -477,6 +481,7 @@ bool cSatipTuner::UpdatePids(bool forceP) return false; addPidsM.Clear(); delPidsM.Clear(); + fixedPidsM.Clear(); } return true; diff --git a/tuner.h b/tuner.h index b70b1ac..0475d53 100644 --- a/tuner.h +++ b/tuner.h @@ -122,6 +122,7 @@ private: cSatipPid addPidsM; cSatipPid delPidsM; cSatipPid pidsM; + cSatipPid fixedPidsM; bool Connect(void); bool Disconnect(void); @@ -143,7 +144,7 @@ public: virtual ~cSatipTuner(); bool IsTuned(void) const { return (currentStateM >= tsTuned); } bool SetSource(cSatipServer *serverP, const int transponderP, const char *parameterP, const int indexP); - bool SetPid(int pidP, int typeP, bool onP); + bool SetPid(int pidP, int typeP, bool onP, bool fixedP = true); bool Open(void); bool Close(void); int FrontendId(void);