1
0
mirror of https://github.com/rofafor/vdr-plugin-satip.git synced 2023-10-10 13:37:42 +02:00

Changed PID handling for section handler PIDs

This commit is contained in:
REELcoder 2016-11-06 13:46:59 +01:00
parent cf35c4b381
commit 74640e0a63
4 changed files with 29 additions and 23 deletions

View File

@ -22,7 +22,8 @@ cSatipDevice::cSatipDevice(unsigned int indexP)
deviceNameM(*cString::sprintf("%s %d", *DeviceType(), deviceIndexM)), deviceNameM(*cString::sprintf("%s %d", *DeviceType(), deviceIndexM)),
channelM(), channelM(),
createdM(0), createdM(0),
mutexM() mutexM(),
fixedPidsM()
{ {
unsigned int bufsize = (unsigned int)SATIP_BUFFER_SIZE; unsigned int bufsize = (unsigned int)SATIP_BUFFER_SIZE;
bufsize -= (bufsize % TS_SIZE); bufsize -= (bufsize % TS_SIZE);
@ -371,10 +372,16 @@ 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); debug12("%s (%d, %d, %d) [device %u]", __PRETTY_FUNCTION__, handleP ? handleP->pid : -1, typeP, onP, deviceIndexM);
if (pTunerM && handleP && handleP->pid >= 0) { if (pTunerM && handleP && handleP->pid >= 0) {
if (onP) if (onP) {
return pTunerM->SetPid(handleP->pid, typeP, true, true); fixedPidsM.AddPid(handleP->pid);
else if (!handleP->used) debug12("%s A%d fixedPidsM=%s [device %d]", __PRETTY_FUNCTION__, handleP->pid, *fixedPidsM.ListPids(), deviceIndexM);
return pTunerM->SetPid(handleP->pid, typeP, false, true); return pTunerM->SetPid(handleP->pid, typeP, true);
}
else if (!handleP->used) {
fixedPidsM.RemovePid(handleP->pid);
debug12("%s R%d fixedPidsM=%s [device %d]", __PRETTY_FUNCTION__, handleP->pid, *fixedPidsM.ListPids(), deviceIndexM);
return pTunerM->SetPid(handleP->pid, typeP, false);
}
} }
return true; return true;
} }
@ -385,7 +392,7 @@ int cSatipDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP)
if (pSectionFilterHandlerM) { if (pSectionFilterHandlerM) {
int handle = pSectionFilterHandlerM->Open(pidP, tidP, maskP); int handle = pSectionFilterHandlerM->Open(pidP, tidP, maskP);
if (pTunerM && (handle >= 0)) if (pTunerM && (handle >= 0))
pTunerM->SetPid(pidP, ptOther, true, false); pTunerM->SetPid(pidP, ptOther, true);
return handle; return handle;
} }
return -1; return -1;
@ -396,8 +403,8 @@ void cSatipDevice::CloseFilter(int handleP)
if (pSectionFilterHandlerM) { if (pSectionFilterHandlerM) {
int pid = pSectionFilterHandlerM->GetPid(handleP); int pid = pSectionFilterHandlerM->GetPid(handleP);
debug12("%s (%d) [device %u]", __PRETTY_FUNCTION__, pid, deviceIndexM); debug12("%s (%d) [device %u]", __PRETTY_FUNCTION__, pid, deviceIndexM);
if (pTunerM) if (pTunerM && fixedPidsM.IndexOf(pid) == -1)
pTunerM->SetPid(pid, ptOther, false, false); pTunerM->SetPid(pid, ptOther, false);
pSectionFilterHandlerM->Close(handleP); pSectionFilterHandlerM->Close(handleP);
} }
} }
@ -545,15 +552,19 @@ bool cSatipDevice::GetTSPacket(uchar *&dataP)
dataP = cs->Decrypt(dataP, available); dataP = cs->Decrypt(dataP, available);
SkipData(available); SkipData(available);
} }
return true; //return true;
} }
} }
else
dataP = GetData(); dataP = GetData();
if (dataP && (dataP[4] == 0x00) && (dataP[5] == 0x02) && ((dataP[6] & 0xf0) == 0xb0)) { if (dataP && (dataP[4] == 0x00) && (dataP[5] == 0x02) && ((dataP[6] & 0xf0) == 0xb0)) {
int pid = ((dataP[1] & 0x1f) << 8) | dataP[2]; int pidA = ((dataP[1] & 0x1f) << 8) | dataP[2];
debug12("%s PID %d 0x%02x%02x%02x%02x%02x%02x%02x", __PRETTY_FUNCTION__, int pidB = GetPmtPid();
pid, dataP[0], dataP[1], dataP[2], dataP[3], dataP[4], dataP[5], dataP[6]); debug12("%s PID %d/%d 0x%02x%02x%02x%02x%02x%02x%02x", __PRETTY_FUNCTION__,
pidA, pidB, dataP[0], dataP[1], dataP[2], dataP[3], dataP[4], dataP[5], dataP[6]);
} }
return true; return true;
} }
dataP = NULL; dataP = NULL;

View File

@ -40,6 +40,7 @@ private:
cSatipSectionFilterHandler *pSectionFilterHandlerM; cSatipSectionFilterHandler *pSectionFilterHandlerM;
cTimeMs createdM; cTimeMs createdM;
cMutex mutexM; cMutex mutexM;
cSatipPid fixedPidsM;
// constructor & destructor // constructor & destructor
public: public:

11
tuner.c
View File

@ -47,8 +47,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
pmtPidM(-1), pmtPidM(-1),
addPidsM(), addPidsM(),
delPidsM(), delPidsM(),
pidsM(), pidsM()
fixedPidsM()
{ {
debug1("%s (, %d) [device %d]", __PRETTY_FUNCTION__, packetLenP, deviceIdM); debug1("%s (, %d) [device %d]", __PRETTY_FUNCTION__, packetLenP, deviceIdM);
@ -406,7 +405,7 @@ bool cSatipTuner::SetSource(cSatipServer *serverP, const int transponderP, const
return true; return true;
} }
bool cSatipTuner::SetPid(int pidP, int typeP, bool onP, bool fixedP) bool cSatipTuner::SetPid(int pidP, int typeP, bool onP)
{ {
debug16("%s (%d, %d, %d) [device %d]", __PRETTY_FUNCTION__, pidP, typeP, onP, deviceIdM); debug16("%s (%d, %d, %d) [device %d]", __PRETTY_FUNCTION__, pidP, typeP, onP, deviceIdM);
cMutexLock MutexLock(&mutexM); cMutexLock MutexLock(&mutexM);
@ -414,14 +413,11 @@ bool cSatipTuner::SetPid(int pidP, int typeP, bool onP, bool fixedP)
pidsM.AddPid(pidP); pidsM.AddPid(pidP);
addPidsM.AddPid(pidP); addPidsM.AddPid(pidP);
delPidsM.RemovePid(pidP); delPidsM.RemovePid(pidP);
if (fixedP)
fixedPidsM.AddPid(pidP);
} }
else if (fixedP || fixedPidsM.IndexOf(pidP) == -1) { else {
pidsM.RemovePid(pidP); pidsM.RemovePid(pidP);
delPidsM.AddPid(pidP); delPidsM.AddPid(pidP);
addPidsM.RemovePid(pidP); addPidsM.RemovePid(pidP);
fixedPidsM.RemovePid(pidP);
} }
debug12("%s (%d, %d, %d) pids=%s [device %d]", __PRETTY_FUNCTION__, pidP, typeP, onP, *pidsM.ListPids(), deviceIdM); debug12("%s (%d, %d, %d) pids=%s [device %d]", __PRETTY_FUNCTION__, pidP, typeP, onP, *pidsM.ListPids(), deviceIdM);
sleepM.Signal(); sleepM.Signal();
@ -481,7 +477,6 @@ bool cSatipTuner::UpdatePids(bool forceP)
return false; return false;
addPidsM.Clear(); addPidsM.Clear();
delPidsM.Clear(); delPidsM.Clear();
fixedPidsM.Clear();
} }
return true; return true;

View File

@ -122,7 +122,6 @@ private:
cSatipPid addPidsM; cSatipPid addPidsM;
cSatipPid delPidsM; cSatipPid delPidsM;
cSatipPid pidsM; cSatipPid pidsM;
cSatipPid fixedPidsM;
bool Connect(void); bool Connect(void);
bool Disconnect(void); bool Disconnect(void);
@ -144,7 +143,7 @@ public:
virtual ~cSatipTuner(); virtual ~cSatipTuner();
bool IsTuned(void) const { return (currentStateM >= tsTuned); } bool IsTuned(void) const { return (currentStateM >= tsTuned); }
bool SetSource(cSatipServer *serverP, const int transponderP, const char *parameterP, const int indexP); bool SetSource(cSatipServer *serverP, const int transponderP, const char *parameterP, const int indexP);
bool SetPid(int pidP, int typeP, bool onP, bool fixedP = true); bool SetPid(int pidP, int typeP, bool onP);
bool Open(void); bool Open(void);
bool Close(void); bool Close(void);
int FrontendId(void); int FrontendId(void);