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

Fix URI for x_pmt if it's the only parameter

Fixes #52
This commit is contained in:
Martin Janser 2018-10-14 11:31:39 +02:00
parent 299296bbb1
commit 6e6cd42c84

32
tuner.c
View File

@ -486,17 +486,24 @@ bool cSatipTuner::UpdatePids(bool forceP)
cString uri = cString::sprintf("%sstream=%d", *GetBaseUrl(*streamAddrM, streamPortM), streamIdM); cString uri = cString::sprintf("%sstream=%d", *GetBaseUrl(*streamAddrM, streamPortM), streamIdM);
bool useci = (SatipConfig.GetCIExtension() && currentServerM.HasCI()); bool useci = (SatipConfig.GetCIExtension() && currentServerM.HasCI());
bool usedummy = currentServerM.IsQuirk(cSatipServer::eSatipQuirkPlayPids); bool usedummy = currentServerM.IsQuirk(cSatipServer::eSatipQuirkPlayPids);
bool paramadded = false;
if (forceP || usedummy) { if (forceP || usedummy) {
if (pidsM.Size()) if (pidsM.Size()) {
uri = cString::sprintf("%s?pids=%s", *uri, *pidsM.ListPids()); uri = cString::sprintf("%s%spids=%s", *uri, paramadded ? "&" : "?", *pidsM.ListPids());
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);
paramadded = true;
}
} }
else { else {
if (addPidsM.Size()) if (addPidsM.Size()) {
uri = cString::sprintf("%s?addpids=%s", *uri, *addPidsM.ListPids()); uri = cString::sprintf("%s%saddpids=%s", *uri, paramadded ? "&" : "?", *addPidsM.ListPids());
if (delPidsM.Size()) paramadded = true;
uri = cString::sprintf("%s%sdelpids=%s", *uri, addPidsM.Size() ? "&" : "?", *delPidsM.ListPids()); }
if (delPidsM.Size()) {
uri = cString::sprintf("%s%sdelpids=%s", *uri, paramadded ? "&" : "?", *delPidsM.ListPids());
paramadded = true;
}
} }
if (useci) { if (useci) {
if (currentServerM.IsQuirk(cSatipServer::eSatipQuirkCiXpmt)) { if (currentServerM.IsQuirk(cSatipServer::eSatipQuirkCiXpmt)) {
@ -509,9 +516,10 @@ bool cSatipTuner::UpdatePids(bool forceP)
int pid = deviceM->GetPmtPid(); int pid = deviceM->GetPmtPid();
if ((pid > 0) && (pid != pmtPidM)) { if ((pid > 0) && (pid != pmtPidM)) {
int slot = deviceM->GetCISlot(); int slot = deviceM->GetCISlot();
uri = cString::sprintf("%s&x_pmt=%d", *uri, pid); uri = cString::sprintf("%s%sx_pmt=%d", *uri, paramadded ? "&" : "?", pid);
if (slot > 0) if (slot > 0)
uri = cString::sprintf("%s&x_ci=%d", *uri, slot); uri = cString::sprintf("%s&x_ci=%d", *uri, slot);
paramadded = true;
} }
pmtPidM = pid; pmtPidM = pid;
} }
@ -519,8 +527,10 @@ bool cSatipTuner::UpdatePids(bool forceP)
// CI extension parameters: // CI extension parameters:
// - tnr : specifies a channel config entry // - tnr : specifies a channel config entry
cString param = deviceM->GetTnrParameterString(); cString param = deviceM->GetTnrParameterString();
if (!isempty(*param) && strcmp(*tnrParamM, *param) != 0) if (!isempty(*param) && strcmp(*tnrParamM, *param) != 0) {
uri = cString::sprintf("%s&tnr=%s", *uri, *param); uri = cString::sprintf("%s%stnr=%s", *uri, paramadded ? "&" : "?", *param);
paramadded = true;
}
tnrParamM = param; tnrParamM = param;
} }
} }