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

Added better logging for channel changes.

This commit is contained in:
Rolf Ahrenberg 2014-12-14 01:56:21 +02:00
parent 7c1aa732b4
commit fecbd3cbd4
3 changed files with 35 additions and 16 deletions

View File

@ -217,7 +217,7 @@ int cSatipDevice::SignalQuality(void) const
bool cSatipDevice::ProvidesSource(int sourceP) const bool cSatipDevice::ProvidesSource(int sourceP) const
{ {
debug8("%s (%c) [device %u]", __PRETTY_FUNCTION__, cSource::ToChar(sourceP), deviceIndexM); debug9("%s (%c) [device %u]", __PRETTY_FUNCTION__, cSource::ToChar(sourceP), deviceIndexM);
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) {
@ -231,7 +231,7 @@ bool cSatipDevice::ProvidesSource(int sourceP) const
bool cSatipDevice::ProvidesTransponder(const cChannel *channelP) const bool cSatipDevice::ProvidesTransponder(const cChannel *channelP) const
{ {
debug1("%s (%d) transponder=%d source=%c [device %u]", __PRETTY_FUNCTION__, channelP ? channelP->Number() : -1, channelP ? channelP->Transponder() : -1, channelP ? cSource::ToChar(channelP->Source()) : '?', deviceIndexM); debug9("%s (%d) transponder=%d source=%c [device %u]", __PRETTY_FUNCTION__, channelP ? channelP->Number() : -1, channelP ? channelP->Transponder() : -1, channelP ? cSource::ToChar(channelP->Source()) : '?', deviceIndexM);
if (!ProvidesSource(channelP->Source())) if (!ProvidesSource(channelP->Source()))
return false; return false;
return DeviceHooksProvidesTransponder(channelP); return DeviceHooksProvidesTransponder(channelP);
@ -243,7 +243,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;
debug1("%s (%d, %d, %d) [device %u]", __PRETTY_FUNCTION__, channelP ? channelP->Number() : -1, priorityP, !!needsDetachReceiversP, deviceIndexM); debug9("%s (%d, %d, %d) [device %u]", __PRETTY_FUNCTION__, channelP ? channelP->Number() : -1, priorityP, !!needsDetachReceiversP, deviceIndexM);
if (channelP && ProvidesTransponder(channelP)) { if (channelP && ProvidesTransponder(channelP)) {
result = hasPriority; result = hasPriority;
@ -315,11 +315,12 @@ bool cSatipDevice::MaySwitchTransponder(const cChannel *channelP) const
bool cSatipDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP) bool cSatipDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
{ {
debug9("%s (%d, %d) [device %u]", __PRETTY_FUNCTION__, channelP ? channelP->Number() : -1, liveViewP, deviceIndexM);
if (channelP) { if (channelP) {
cDvbTransponderParameters dtp(channelP->Parameters()); cDvbTransponderParameters dtp(channelP->Parameters());
cString params = GetTransponderUrlParameters(channelP); cString params = GetTransponderUrlParameters(channelP);
if (isempty(params)) { if (isempty(params)) {
error("Unrecognized SATIP channel parameters: %s", channelP->Parameters()); error("Unrecognized SATIP channel parameters: %s [device %u]", channelP->Parameters(), deviceIndexM);
return false; return false;
} }
cString address; cString address;
@ -344,7 +345,7 @@ bool cSatipDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
bool cSatipDevice::SetPid(cPidHandle *handleP, int typeP, bool onP) bool cSatipDevice::SetPid(cPidHandle *handleP, int typeP, bool onP)
{ {
debug8("%s (%d, %d, %d) [device %u]", __PRETTY_FUNCTION__, handleP->pid, typeP, onP, deviceIndexM); debug9("%s (%d, %d, %d) [device %u]", __PRETTY_FUNCTION__, handleP->pid, typeP, onP, deviceIndexM);
if (pTunerM && handleP && handleP->pid >= 0) { if (pTunerM && handleP && handleP->pid >= 0) {
if (onP) if (onP)
return pTunerM->SetPid(handleP->pid, typeP, true); return pTunerM->SetPid(handleP->pid, typeP, true);
@ -356,7 +357,7 @@ bool cSatipDevice::SetPid(cPidHandle *handleP, int typeP, bool onP)
int cSatipDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP) int cSatipDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP)
{ {
debug8("%s (%d, %02X, %02X) [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, deviceIndexM); debug9("%s (%d, %02X, %02X) [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, deviceIndexM);
if (pSectionFilterHandlerM) { if (pSectionFilterHandlerM) {
int handle = pSectionFilterHandlerM->Open(pidP, tidP, maskP); int handle = pSectionFilterHandlerM->Open(pidP, tidP, maskP);
if (pTunerM && (handle >= 0)) if (pTunerM && (handle >= 0))
@ -368,17 +369,18 @@ int cSatipDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP)
void cSatipDevice::CloseFilter(int handleP) void cSatipDevice::CloseFilter(int handleP)
{ {
debug8("%s (%d) [device %u]", __PRETTY_FUNCTION__, handleP, deviceIndexM);
if (pSectionFilterHandlerM) { if (pSectionFilterHandlerM) {
int pid = pSectionFilterHandlerM->GetPid(handleP);
debug9("%s (%d) [device %u]", __PRETTY_FUNCTION__, pid, deviceIndexM);
if (pTunerM) if (pTunerM)
pTunerM->SetPid(pSectionFilterHandlerM->GetPid(handleP), ptOther, false); pTunerM->SetPid(pid, ptOther, false);
pSectionFilterHandlerM->Close(handleP); pSectionFilterHandlerM->Close(handleP);
} }
} }
bool cSatipDevice::OpenDvr(void) bool cSatipDevice::OpenDvr(void)
{ {
debug1("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); debug9("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
isPacketDeliveredM = false; isPacketDeliveredM = false;
tsBufferM->Clear(); tsBufferM->Clear();
if (pTunerM) if (pTunerM)
@ -389,7 +391,7 @@ bool cSatipDevice::OpenDvr(void)
void cSatipDevice::CloseDvr(void) void cSatipDevice::CloseDvr(void)
{ {
debug1("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); debug9("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
if (pTunerM) if (pTunerM)
pTunerM->Close(); pTunerM->Close();
isOpenDvrM = false; isOpenDvrM = false;
@ -423,7 +425,6 @@ void cSatipDevice::WriteData(uchar *bufferP, int lengthP)
int cSatipDevice::GetId(void) int cSatipDevice::GetId(void)
{ {
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
return deviceIndexM; return deviceIndexM;
} }

16
tuner.c
View File

@ -374,6 +374,13 @@ bool cSatipTuner::SetPid(int pidP, int typeP, bool onP)
delPidsM.AddPid(pidP); delPidsM.AddPid(pidP);
addPidsM.RemovePid(pidP); addPidsM.RemovePid(pidP);
} }
if (pidsM.Size()) {
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();
@ -391,7 +398,8 @@ bool cSatipTuner::UpdatePids(bool forceP)
if (pidsM.Size()) { if (pidsM.Size()) {
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,", *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);
@ -400,12 +408,14 @@ bool cSatipTuner::UpdatePids(bool forceP)
if (addPidsM.Size()) { if (addPidsM.Size()) {
uri = cString::sprintf("%s?addpids=", *uri); uri = cString::sprintf("%s?addpids=", *uri);
for (int i = 0; i < addPidsM.Size(); ++i) for (int i = 0; i < addPidsM.Size(); ++i)
uri = cString::sprintf("%s%d%s", *uri, addPidsM[i], (i == (addPidsM.Size() - 1)) ? "" : ","); uri = cString::sprintf("%s%d,", *uri, addPidsM[i]);
uri = uri.Truncate(-1);
} }
if (delPidsM.Size()) { if (delPidsM.Size()) {
uri = cString::sprintf("%s%sdelpids=", *uri, addPidsM.Size() ? "&" : "?"); uri = cString::sprintf("%s%sdelpids=", *uri, addPidsM.Size() ? "&" : "?");
for (int i = 0; i < delPidsM.Size(); ++i) for (int i = 0; i < delPidsM.Size(); ++i)
uri = cString::sprintf("%s%d%s", *uri, delPidsM[i], (i == (delPidsM.Size() - 1)) ? "" : ","); uri = cString::sprintf("%s%d,", *uri, delPidsM[i]);
uri = uri.Truncate(-1);
} }
} }
if (!rtspM.Play(*uri)) if (!rtspM.Play(*uri))

12
tuner.h
View File

@ -28,19 +28,27 @@ private:
} }
return -1; return -1;
} }
static int PidCompare(const void *aPidP, const void *bPidP)
{
return (*(int*)aPidP - *(int*)bPidP);
}
public: public:
void RemovePid(const int &pidP) void RemovePid(const int &pidP)
{ {
int i = PidIndex(pidP); int i = PidIndex(pidP);
if (i >= 0) if (i >= 0) {
Remove(i); Remove(i);
Sort(PidCompare);
}
} }
void AddPid(int pidP) void AddPid(int pidP)
{ {
if (PidIndex(pidP) < 0) if (PidIndex(pidP) < 0) {
Append(pidP); Append(pidP);
Sort(PidCompare);
}
} }
}; };