mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Deduplicated pid listings.
This commit is contained in:
parent
778f3bd84a
commit
7f9d016b52
32
tuner.c
32
tuner.c
@ -374,13 +374,7 @@ bool cSatipTuner::SetPid(int pidP, int typeP, bool onP)
|
|||||||
delPidsM.AddPid(pidP);
|
delPidsM.AddPid(pidP);
|
||||||
addPidsM.RemovePid(pidP);
|
addPidsM.RemovePid(pidP);
|
||||||
}
|
}
|
||||||
if (pidsM.Size()) {
|
debug9("%s (%d, %d, %d) pids=%s [device %d]", __PRETTY_FUNCTION__, pidP, typeP, onP, *pidsM.ListPids(), deviceIdM);
|
||||||
cString s = "";
|
|
||||||
for (int i = 0; i < pidsM.Size(); ++i)
|
|
||||||
s = cString::sprintf("%s%d,", *s, pidsM[i]);
|
|
||||||
s = s.Truncate(-1);
|
|
||||||
debug9("%s (%d, %d, %d) pids=%s [device %d]", __PRETTY_FUNCTION__, pidP, typeP, onP, *s, deviceIdM);
|
|
||||||
}
|
|
||||||
pidUpdateCacheM.Set(ePidUpdateIntervalMs);
|
pidUpdateCacheM.Set(ePidUpdateIntervalMs);
|
||||||
sleepM.Signal();
|
sleepM.Signal();
|
||||||
|
|
||||||
@ -395,28 +389,16 @@ bool cSatipTuner::UpdatePids(bool forceP)
|
|||||||
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
||||||
bool usedummy = !!(currentServerM && currentServerM->Quirk(cSatipServer::eSatipQuirkPlayPids));
|
bool usedummy = !!(currentServerM && currentServerM->Quirk(cSatipServer::eSatipQuirkPlayPids));
|
||||||
if (forceP || usedummy) {
|
if (forceP || usedummy) {
|
||||||
if (pidsM.Size()) {
|
if (pidsM.Size())
|
||||||
uri = cString::sprintf("%s?pids=", *uri);
|
uri = cString::sprintf("%s?pids=%s", *uri, *pidsM.ListPids());
|
||||||
for (int i = 0; i < pidsM.Size(); ++i)
|
|
||||||
uri = cString::sprintf("%s%d,", *uri, pidsM[i]);
|
|
||||||
uri = uri.Truncate(-1);
|
|
||||||
}
|
|
||||||
if (usedummy && (pidsM.Size() == 1) && (pidsM[0] < 0x20))
|
if (usedummy && (pidsM.Size() == 1) && (pidsM[0] < 0x20))
|
||||||
uri = cString::sprintf("%s,%d", *uri, eDummyPid);
|
uri = cString::sprintf("%s,%d", *uri, eDummyPid);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (addPidsM.Size()) {
|
if (addPidsM.Size())
|
||||||
uri = cString::sprintf("%s?addpids=", *uri);
|
uri = cString::sprintf("%s?addpids=%s", *uri, *addPidsM.ListPids());
|
||||||
for (int i = 0; i < addPidsM.Size(); ++i)
|
if (delPidsM.Size())
|
||||||
uri = cString::sprintf("%s%d,", *uri, addPidsM[i]);
|
uri = cString::sprintf("%s%sdelpids=%s", *uri, addPidsM.Size() ? "&" : "?", *delPidsM.ListPids());
|
||||||
uri = uri.Truncate(-1);
|
|
||||||
}
|
|
||||||
if (delPidsM.Size()) {
|
|
||||||
uri = cString::sprintf("%s%sdelpids=", *uri, addPidsM.Size() ? "&" : "?");
|
|
||||||
for (int i = 0; i < delPidsM.Size(); ++i)
|
|
||||||
uri = cString::sprintf("%s%d,", *uri, delPidsM[i]);
|
|
||||||
uri = uri.Truncate(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!rtspM.Play(*uri))
|
if (!rtspM.Play(*uri))
|
||||||
return false;
|
return false;
|
||||||
|
11
tuner.h
11
tuner.h
@ -42,7 +42,6 @@ public:
|
|||||||
Sort(PidCompare);
|
Sort(PidCompare);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddPid(int pidP)
|
void AddPid(int pidP)
|
||||||
{
|
{
|
||||||
if (PidIndex(pidP) < 0) {
|
if (PidIndex(pidP) < 0) {
|
||||||
@ -50,6 +49,16 @@ public:
|
|||||||
Sort(PidCompare);
|
Sort(PidCompare);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cString ListPids(void)
|
||||||
|
{
|
||||||
|
cString list = "";
|
||||||
|
if (Size()) {
|
||||||
|
for (int i = 0; i < Size(); ++i)
|
||||||
|
list = cString::sprintf("%s%d,", *list, At(i));
|
||||||
|
list = list.Truncate(-1);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class cSatipTuner : public cThread, public cSatipTunerStatistics, public cSatipTunerIf
|
class cSatipTuner : public cThread, public cSatipTunerStatistics, public cSatipTunerIf
|
||||||
|
Loading…
Reference in New Issue
Block a user