mirror of
				https://github.com/rofafor/vdr-plugin-satip.git
				synced 2023-10-10 11:37:42 +00:00 
			
		
		
		
	Fixed SetChannelDevice() with NULL channel and EOL in ReadApplication().
This commit is contained in:
		
							
								
								
									
										10
									
								
								device.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								device.c
									
									
									
									
									
								
							@@ -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;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								socket.c
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								socket.c
									
									
									
									
									
								
							@@ -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;
 | 
				
			||||||
                 }
 | 
					                 }
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								tuner.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								tuner.c
									
									
									
									
									
								
							@@ -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,6 +399,7 @@ 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);
 | 
				
			||||||
 | 
					  if (serverP) {
 | 
				
			||||||
     nextServerM = cSatipDiscover::GetInstance()->GetServer(serverP);
 | 
					     nextServerM = cSatipDiscover::GetInstance()->GetServer(serverP);
 | 
				
			||||||
     if (nextServerM && !isempty(nextServerM->Address()) && !isempty(parameterP)) {
 | 
					     if (nextServerM && !isempty(nextServerM->Address()) && !isempty(parameterP)) {
 | 
				
			||||||
        // Update stream address and parameter
 | 
					        // Update stream address and parameter
 | 
				
			||||||
@@ -402,6 +408,9 @@ bool cSatipTuner::SetSource(cSatipServer *serverP, const char *parameterP, const
 | 
				
			|||||||
        // Reconnect
 | 
					        // Reconnect
 | 
				
			||||||
        Connect();
 | 
					        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 {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user