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

Fixed OPTIONS url and enabled retuning.

This commit is contained in:
Rolf Ahrenberg 2014-12-03 01:42:33 +02:00
parent 98437ce57e
commit d48fe3bced

19
tuner.c
View File

@ -101,14 +101,13 @@ void cSatipTuner::Action(void)
case tsSet: case tsSet:
//debug("cSatipTuner::%s(): tsSet [device %d]", __FUNCTION__, deviceIdM); //debug("cSatipTuner::%s(): tsSet [device %d]", __FUNCTION__, deviceIdM);
reConnectM.Set(eConnectTimeoutMs); reConnectM.Set(eConnectTimeoutMs);
Disconnect();
if (Connect()) { if (Connect()) {
RequestState(tsTuned, smInternal); RequestState(tsTuned, smInternal);
UpdatePids(true); UpdatePids(true);
} }
else { else {
error("Tuning failed - re-tuning [device %d]", deviceIdM); error("Tuning failed - retuning [device %d]", deviceIdM);
RequestState(tsIdle, smInternal); Disconnect();
} }
break; break;
case tsTuned: case tsTuned:
@ -129,17 +128,17 @@ void cSatipTuner::Action(void)
case tsLocked: case tsLocked:
//debug("cSatipTuner::%s(): tsLocked [device %d]", __FUNCTION__, deviceIdM); //debug("cSatipTuner::%s(): tsLocked [device %d]", __FUNCTION__, deviceIdM);
if (!UpdatePids()) { if (!UpdatePids()) {
error("Pid update failed - re-tuning [device %d]", deviceIdM); error("Pid update failed - retuning [device %d]", deviceIdM);
RequestState(tsSet, smInternal); RequestState(tsSet, smInternal);
break; break;
} }
if (!KeepAlive()) { if (!KeepAlive()) {
error("Keep-alive failed - re-tuning [device %d]", deviceIdM); error("Keep-alive failed - retuning [device %d]", deviceIdM);
RequestState(tsSet, smInternal); RequestState(tsSet, smInternal);
break; break;
} }
if (reConnectM.TimedOut()) { if (reConnectM.TimedOut()) {
error("Connection timeout - re-tuning [device %d]", deviceIdM); error("Connection timeout - retuning [device %d]", deviceIdM);
RequestState(tsSet, smInternal); RequestState(tsSet, smInternal);
break; break;
} }
@ -182,10 +181,10 @@ bool cSatipTuner::Connect(void)
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM); debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM);
if (!isempty(*streamAddrM)) { if (!isempty(*streamAddrM)) {
cString connectionUri = cString::sprintf("rtsp://%s", *streamAddrM); cString connectionUri = cString::sprintf("rtsp://%s/", *streamAddrM);
// Just retune // Just retune
if (streamIdM >= 0) { if (streamIdM >= 0) {
cString uri = cString::sprintf("%s/stream=%d?%s", *connectionUri, streamIdM, *streamParamM); cString uri = cString::sprintf("%sstream=%d?%s", *connectionUri, streamIdM, *streamParamM);
debug("cSatipTuner::%s(): retuning [device %d]", __FUNCTION__, deviceIdM); debug("cSatipTuner::%s(): retuning [device %d]", __FUNCTION__, deviceIdM);
if (rtspM.Play(*uri)) { if (rtspM.Play(*uri)) {
keepAliveM.Set(timeoutM); keepAliveM.Set(timeoutM);
@ -193,7 +192,7 @@ bool cSatipTuner::Connect(void)
} }
} }
else if (rtspM.Options(*connectionUri)) { else if (rtspM.Options(*connectionUri)) {
cString uri = cString::sprintf("%s/?%s", *connectionUri, *streamParamM); cString uri = cString::sprintf("%s?%s", *connectionUri, *streamParamM);
// Flush any old content // Flush any old content
rtpM.Flush(); rtpM.Flush();
rtcpM.Flush(); rtcpM.Flush();
@ -334,6 +333,8 @@ bool cSatipTuner::SetSource(cSatipServer *serverP, const char *parameterP, const
// Update stream address and parameter // Update stream address and parameter
streamAddrM = rtspM.RtspUnescapeString(nextServerM->Address()); streamAddrM = rtspM.RtspUnescapeString(nextServerM->Address());
streamParamM = rtspM.RtspUnescapeString(parameterP); streamParamM = rtspM.RtspUnescapeString(parameterP);
// Reconnect
RequestState(tsSet, smExternal);
} }
} }
else { else {