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

Fixed SetChannelDevice() with NULL channel and EOL in ReadApplication().

This commit is contained in:
Rolf Ahrenberg 2014-11-03 21:55:54 +02:00
parent d81f700194
commit 5795bb58af
3 changed files with 24 additions and 12 deletions

View File

@ -184,7 +184,7 @@ int cSatipDevice::SignalQuality(void) const
bool cSatipDevice::ProvidesSource(int sourceP) const bool cSatipDevice::ProvidesSource(int sourceP) const
{ {
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); //debug("cSatipDevice::%s(%u): source=%c", __FUNCTION__, deviceIndexM, cSource::ToChar(sourceP));
if (!SatipConfig.IsOperatingModeOff() && !!cSatipDiscover::GetInstance()->GetServer(sourceP)) { if (!SatipConfig.IsOperatingModeOff() && !!cSatipDiscover::GetInstance()->GetServer(sourceP)) {
int numDisabledSourcesM = SatipConfig.GetDisabledSourcesCount(); int numDisabledSourcesM = SatipConfig.GetDisabledSourcesCount();
for (int i = 0; i < numDisabledSourcesM; ++i) { for (int i = 0; i < numDisabledSourcesM; ++i) {
@ -198,7 +198,7 @@ bool cSatipDevice::ProvidesSource(int sourceP) const
bool cSatipDevice::ProvidesTransponder(const cChannel *channelP) const bool cSatipDevice::ProvidesTransponder(const cChannel *channelP) const
{ {
debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); debug("cSatipDevice::%s(%u): transponder=%d source=%c", __FUNCTION__, deviceIndexM, channelP ? channelP->Transponder() : -1, channelP ? cSource::ToChar(channelP->Source()) : '?');
return (ProvidesSource(channelP->Source())); return (ProvidesSource(channelP->Source()));
} }
@ -208,7 +208,7 @@ bool cSatipDevice::ProvidesChannel(const cChannel *channelP, int priorityP, bool
bool hasPriority = (priorityP == IDLEPRIORITY) || (priorityP > this->Priority()); bool hasPriority = (priorityP == IDLEPRIORITY) || (priorityP > this->Priority());
bool needsDetachReceivers = false; bool needsDetachReceivers = false;
debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); debug("cSatipDevice::%s(%u): channel=%d priority=%d", __FUNCTION__, deviceIndexM, channelP ? channelP->Number() : -1, priorityP);
if (channelP && ProvidesTransponder(channelP)) { if (channelP && ProvidesTransponder(channelP)) {
result = hasPriority; result = hasPriority;
@ -300,6 +300,10 @@ bool cSatipDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
return true; return true;
} }
} }
else if (pTunerM) {
pTunerM->SetSource(NULL, NULL, deviceIndexM);
return true;
}
return false; return false;
} }

View File

@ -229,6 +229,7 @@ int cSatipSocket::ReadApplication(unsigned char *bufferAddrP, unsigned int buffe
if (string_length > 0) { if (string_length > 0) {
// Set argument point to payload in read buffer // Set argument point to payload in read buffer
memmove(bufferAddrP, &bufferAddrP[offset + 16], string_length); memmove(bufferAddrP, &bufferAddrP[offset + 16], string_length);
bufferAddrP[string_length] = 0;
return string_length; return string_length;
} }
} }

25
tuner.c
View File

@ -255,6 +255,11 @@ bool cSatipTuner::Connect(void)
// Start playing // Start playing
tunedM = true; tunedM = true;
if (!pidsM.Size()) {
SetPid(0, 5, true);
if (nextServerM && nextServerM->Quirk(cSatipServer::eSatipQuirkPlayPids))
SetPid(eDummyPid, 5, true);
}
UpdatePids(true); UpdatePids(true);
if (nextServerM) { if (nextServerM) {
cSatipDiscover::GetInstance()->UseServer(nextServerM, true); cSatipDiscover::GetInstance()->UseServer(nextServerM, true);
@ -394,14 +399,18 @@ bool cSatipTuner::SetSource(cSatipServer *serverP, const char *parameterP, const
{ {
debug("cSatipTuner::%s(%s, %d) [device %d]", __FUNCTION__, parameterP, indexP, deviceM->GetId()); debug("cSatipTuner::%s(%s, %d) [device %d]", __FUNCTION__, parameterP, indexP, deviceM->GetId());
cMutexLock MutexLock(&mutexM); cMutexLock MutexLock(&mutexM);
nextServerM = cSatipDiscover::GetInstance()->GetServer(serverP); if (serverP) {
if (nextServerM && !isempty(nextServerM->Address()) && !isempty(parameterP)) { nextServerM = cSatipDiscover::GetInstance()->GetServer(serverP);
// Update stream address and parameter if (nextServerM && !isempty(nextServerM->Address()) && !isempty(parameterP)) {
streamAddrM = nextServerM->Address(); // Update stream address and parameter
streamParamM = parameterP; streamAddrM = nextServerM->Address();
// Reconnect streamParamM = parameterP;
Connect(); // Reconnect
Connect();
}
} }
else
Disconnect();
return true; return true;
} }
@ -470,8 +479,6 @@ bool cSatipTuner::UpdatePids(bool forceP)
uri = cString::sprintf("%s?pids=", *uri); uri = cString::sprintf("%s?pids=", *uri);
for (int i = 0; i < pidsM.Size(); ++i) for (int i = 0; i < pidsM.Size(); ++i)
uri = cString::sprintf("%s%d%s", *uri, pidsM[i], (i == (pidsM.Size() - 1)) ? "" : ","); uri = cString::sprintf("%s%d%s", *uri, pidsM[i], (i == (pidsM.Size() - 1)) ? "" : ",");
if (currentServerM && currentServerM->Quirk(cSatipServer::eSatipQuirkPlayPids))
uri = cString::sprintf("%s,%d", *uri, eDummyPid);
} }
} }
else { else {