mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Improved debug messages.
This commit is contained in:
parent
5ff54d27a3
commit
1a304e9dc2
50
tuner.c
50
tuner.c
@ -37,20 +37,20 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
|
||||
pidUpdatedM(false),
|
||||
pidsM()
|
||||
{
|
||||
debug("cSatipTuner::%s(%d)", __FUNCTION__, packetBufferLenM);
|
||||
debug("cSatipTuner::%s(%d) [device %d]", __FUNCTION__, packetBufferLenM, deviceM->GetId());
|
||||
// Allocate packet buffer
|
||||
packetBufferM = MALLOC(unsigned char, packetBufferLenM);
|
||||
if (packetBufferM)
|
||||
memset(packetBufferM, 0, packetBufferLenM);
|
||||
else
|
||||
error("MALLOC() failed for packet buffer");
|
||||
error("MALLOC() failed for packet buffer [device %d]", deviceM->GetId());
|
||||
// Start thread
|
||||
Start();
|
||||
}
|
||||
|
||||
cSatipTuner::~cSatipTuner()
|
||||
{
|
||||
debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
// Stop thread
|
||||
sleepM.Signal();
|
||||
if (Running())
|
||||
@ -96,7 +96,7 @@ size_t cSatipTuner::HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP, void
|
||||
|
||||
void cSatipTuner::Action(void)
|
||||
{
|
||||
debug("cSatipTuner::%s(): entering", __FUNCTION__);
|
||||
debug("cSatipTuner::%s(): entering [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
cTimeMs timeout(eReConnectTimeoutMs);
|
||||
// Increase priority
|
||||
SetPriority(-1);
|
||||
@ -137,12 +137,12 @@ void cSatipTuner::Action(void)
|
||||
sleepM.Wait(10); // to avoid busy loop and reduce cpu load
|
||||
}
|
||||
}
|
||||
debug("cSatipTuner::%s(): exiting", __FUNCTION__);
|
||||
debug("cSatipTuner::%s(): exiting [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
}
|
||||
|
||||
bool cSatipTuner::Open(void)
|
||||
{
|
||||
debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
if (Connect()) {
|
||||
openedM = true;
|
||||
return true;
|
||||
@ -152,7 +152,7 @@ bool cSatipTuner::Open(void)
|
||||
|
||||
bool cSatipTuner::Close(void)
|
||||
{
|
||||
debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
openedM = false;
|
||||
Disconnect();
|
||||
return true;
|
||||
@ -161,7 +161,7 @@ bool cSatipTuner::Close(void)
|
||||
bool cSatipTuner::Connect(void)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
|
||||
// Initialize the curl session
|
||||
if (!handleM)
|
||||
@ -173,7 +173,7 @@ bool cSatipTuner::Connect(void)
|
||||
|
||||
// Just retune
|
||||
if (tunedM && (streamIdM >= 0)) {
|
||||
debug("cSatipTuner::%s(): retune", __FUNCTION__);
|
||||
debug("cSatipTuner::%s(): retune [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_PLAY);
|
||||
@ -218,7 +218,7 @@ bool cSatipTuner::Connect(void)
|
||||
rtcpSocketM->Close();
|
||||
}
|
||||
if ((rtpSocketM->Port() <= 0) || (rtcpSocketM->Port() <= 0)) {
|
||||
error("Cannot open required ports!");
|
||||
error("Cannot open required RTP/RTCP ports [device %d]", deviceM->GetId());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ bool cSatipTuner::Connect(void)
|
||||
bool cSatipTuner::Disconnect(void)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
|
||||
// Terminate curl session
|
||||
if (handleM) {
|
||||
@ -318,7 +318,7 @@ bool cSatipTuner::Disconnect(void)
|
||||
|
||||
bool cSatipTuner::ValidateLatestResponse(void)
|
||||
{
|
||||
//debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
if (handleM) {
|
||||
long rc = 0;
|
||||
CURLcode res = CURLE_OK;
|
||||
@ -326,7 +326,7 @@ bool cSatipTuner::ValidateLatestResponse(void)
|
||||
if (rc == 200)
|
||||
return true;
|
||||
else if (rc != 0)
|
||||
error("Tuner detected invalid status code: %ld", rc);
|
||||
error("Tuner detected invalid status code %ld [device %d]", rc, deviceM->GetId());
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -334,7 +334,7 @@ bool cSatipTuner::ValidateLatestResponse(void)
|
||||
|
||||
void cSatipTuner::ParseReceptionParameters(const char *paramP)
|
||||
{
|
||||
//debug("cSatipTuner::%s(%s)", __FUNCTION__, paramP);
|
||||
//debug("cSatipTuner::%s(%s) [device %d]", __FUNCTION__, paramP, deviceM->GetId());
|
||||
// DVB-S2:
|
||||
// ver=<major>.<minor>;src=<srcID>;tuner=<feID>,<level>,<lock>,<quality>,<frequency>,<polarisation>,<system>,<type>,<pilots>,<roll_off>,<symbol_rate>,<fec_inner>;pids=<pid0>,...,<pidn>
|
||||
// DVB-T2:
|
||||
@ -381,21 +381,21 @@ void cSatipTuner::ParseReceptionParameters(const char *paramP)
|
||||
void cSatipTuner::SetStreamId(int streamIdP)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("cSatipTuner::%s(%d)", __FUNCTION__, streamIdP);
|
||||
debug("cSatipTuner::%s(%d) [device %d]", __FUNCTION__, streamIdP, deviceM->GetId());
|
||||
streamIdM = streamIdP;
|
||||
}
|
||||
|
||||
void cSatipTuner::SetSessionTimeout(const char *sessionP, int timeoutP)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("cSatipTuner::%s(%s, %d)", __FUNCTION__, sessionP, timeoutP);
|
||||
debug("cSatipTuner::%s(%s, %d) [device %d]", __FUNCTION__, sessionP, timeoutP, deviceM->GetId());
|
||||
sessionM = sessionP;
|
||||
timeoutM = (timeoutP > eMinKeepAliveIntervalMs) ? timeoutP : eMinKeepAliveIntervalMs;
|
||||
}
|
||||
|
||||
bool cSatipTuner::SetSource(cSatipServer *serverP, const char *parameterP, const int indexP)
|
||||
{
|
||||
debug("cSatipTuner::%s(%s, %d)", __FUNCTION__, parameterP, indexP);
|
||||
debug("cSatipTuner::%s(%s, %d) [device %d]", __FUNCTION__, parameterP, indexP, deviceM->GetId());
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
nextServerM = cSatipDiscover::GetInstance()->GetServer(serverP);
|
||||
if (nextServerM && !isempty(nextServerM->Address()) && !isempty(parameterP)) {
|
||||
@ -410,7 +410,7 @@ bool cSatipTuner::SetSource(cSatipServer *serverP, const char *parameterP, const
|
||||
|
||||
bool cSatipTuner::SetPid(int pidP, int typeP, bool onP)
|
||||
{
|
||||
//debug("cSatipTuner::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
|
||||
//debug("cSatipTuner::%s(%d, %d, %d) [device %d]", __FUNCTION__, pidP, typeP, onP, deviceM->GetId());
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
bool found = false;
|
||||
for (int i = 0; i < pidsM.Size(); ++i) {
|
||||
@ -435,7 +435,7 @@ bool cSatipTuner::UpdatePids(void)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
if (pidUpdateCacheM.TimedOut() && pidUpdatedM && pidsM.Size() && tunedM && handleM && !isempty(*streamAddrM) && (streamIdM > 0)) {
|
||||
//debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
CURLcode res = CURLE_OK;
|
||||
//cString uri = cString::sprintf("rtsp://%s/stream=%d?%spids=%d", *streamAddrM, streamIdM, onP ? "add" : "del", pidP);
|
||||
cString uri = cString::sprintf("rtsp://%s/stream=%d?pids=", *streamAddrM, streamIdM);
|
||||
@ -461,7 +461,7 @@ bool cSatipTuner::KeepAlive(void)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
if (tunedM && handleM && keepAliveM.TimedOut()) {
|
||||
debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
CURLcode res = CURLE_OK;
|
||||
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
||||
|
||||
@ -481,30 +481,30 @@ bool cSatipTuner::KeepAlive(void)
|
||||
|
||||
int cSatipTuner::SignalStrength(void)
|
||||
{
|
||||
//debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
return signalStrengthM;
|
||||
}
|
||||
|
||||
int cSatipTuner::SignalQuality(void)
|
||||
{
|
||||
//debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
return signalQualityM;
|
||||
}
|
||||
|
||||
bool cSatipTuner::HasLock(void)
|
||||
{
|
||||
//debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
return tunedM && hasLockM;
|
||||
}
|
||||
|
||||
cString cSatipTuner::GetSignalStatus(void)
|
||||
{
|
||||
//debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
return cString::sprintf("lock=%d strength=%d quality=%d", HasLock(), SignalStrength(), SignalQuality());
|
||||
}
|
||||
|
||||
cString cSatipTuner::GetInformation(void)
|
||||
{
|
||||
//debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
return tunedM ? cString::sprintf("rtsp://%s/?%s [stream=%d]", *streamAddrM, *streamParamM, streamIdM) : "connection failed";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user