From 81f6af3bdfd71dd4696da916088f4234536d5211 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Fri, 5 Dec 2014 23:02:57 +0200 Subject: [PATCH] Reformat debug messages. --- config.c | 2 +- device.c | 64 +++++++++++++++++++++++----------------------- discover.c | 50 ++++++++++++++++++------------------ msearch.c | 12 ++++----- poller.c | 24 ++++++++--------- rtcp.c | 10 ++++---- rtp.c | 18 ++++++------- rtsp.c | 38 +++++++++++++-------------- satip.c | 50 ++++++++++++++++++------------------ sectionfilter.c | 34 ++++++++++++------------- setup.c | 14 +++++----- socket.c | 18 ++++++------- statistics.c | 34 ++++++++++++------------- tuner.c | 68 ++++++++++++++++++++++++------------------------- 14 files changed, 218 insertions(+), 218 deletions(-) diff --git a/config.c b/config.c index fd1a4b9..ce3ae6b 100644 --- a/config.c +++ b/config.c @@ -67,6 +67,6 @@ void cSatipConfig::SetDisabledFilters(unsigned int indexP, int numberP) void cSatipConfig::SetConfigDirectory(const char *directoryP) { - debug("cSatipConfig::%s(%s)", __FUNCTION__, directoryP); + debug("%s(%s)", __PRETTY_FUNCTION__, directoryP); ERROR_IF(!realpath(directoryP, configDirectoryM), "Cannot canonicalize configuration directory"); } diff --git a/device.c b/device.c index c02b303..da3bbdb 100644 --- a/device.c +++ b/device.c @@ -25,7 +25,7 @@ cSatipDevice::cSatipDevice(unsigned int indexP) { unsigned int bufsize = (unsigned int)SATIP_BUFFER_SIZE; bufsize -= (bufsize % TS_SIZE); - isyslog("creating SAT>IP device %d (CardIndex=%d)", deviceIndexM, CardIndex()); + info("Creating SAT>IP CardIndex=%d [device %u]", CardIndex(), deviceIndexM); tsBufferM = new cRingBufferLinear(bufsize + 1, TS_SIZE, false, *cString::sprintf("SAT>IP TS %d", deviceIndexM)); if (tsBufferM) { @@ -40,7 +40,7 @@ cSatipDevice::cSatipDevice(unsigned int indexP) cSatipDevice::~cSatipDevice() { - debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); // Stop section handler StopSectionHandler(); DELETE_POINTER(pSectionFilterHandlerM); @@ -50,7 +50,7 @@ cSatipDevice::~cSatipDevice() bool cSatipDevice::Initialize(unsigned int deviceCountP) { - debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceCountP); + debug("%s(%u)", __PRETTY_FUNCTION__, deviceCountP); if (deviceCountP > SATIP_MAX_DEVICES) deviceCountP = SATIP_MAX_DEVICES; for (unsigned int i = 0; i < deviceCountP; ++i) @@ -62,7 +62,7 @@ bool cSatipDevice::Initialize(unsigned int deviceCountP) void cSatipDevice::Shutdown(void) { - debug("cSatipDevice::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); for (int i = 0; i < SATIP_MAX_DEVICES; ++i) { if (SatipDevicesS[i]) SatipDevicesS[i]->CloseDvr(); @@ -72,7 +72,7 @@ void cSatipDevice::Shutdown(void) unsigned int cSatipDevice::Count(void) { unsigned int count = 0; - debug("cSatipDevice::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); for (unsigned int i = 0; i < SATIP_MAX_DEVICES; ++i) { if (SatipDevicesS[i] != NULL) count++; @@ -82,10 +82,10 @@ unsigned int cSatipDevice::Count(void) cSatipDevice *cSatipDevice::GetSatipDevice(int cardIndexP) { - //debug("cSatipDevice::%s(%d)", __FUNCTION__, cardIndexP); + //debug("%s(%d)", __PRETTY_FUNCTION__, cardIndexP); for (unsigned int i = 0; i < SATIP_MAX_DEVICES; ++i) { if (SatipDevicesS[i] && (SatipDevicesS[i]->CardIndex() == cardIndexP)) { - //debug("cSatipDevice::%s(%d): found!", __FUNCTION__, cardIndexP); + //debug("%s(%d): Found!", __PRETTY_FUNCTION__, cardIndexP); return SatipDevicesS[i]; } } @@ -126,7 +126,7 @@ cString cSatipDevice::GetSatipStatus(void) cString cSatipDevice::GetGeneralInformation(void) { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return cString::sprintf("SAT>IP device: %d\nCardIndex: %d\nStream: %s\nSignal: %s\nStream bitrate: %s\n%sChannel: %s", deviceIndexM, CardIndex(), pTunerM ? *pTunerM->GetInformation() : "", @@ -138,13 +138,13 @@ cString cSatipDevice::GetGeneralInformation(void) cString cSatipDevice::GetPidsInformation(void) { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return GetPidStatistic(); } cString cSatipDevice::GetFiltersInformation(void) { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return cString::sprintf("Active section filters:\n%s", pSectionFilterHandlerM ? *pSectionFilterHandlerM->GetInformation() : ""); } @@ -180,43 +180,43 @@ cString cSatipDevice::GetInformation(unsigned int pageP) bool cSatipDevice::Ready(void) { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return ((cSatipDiscover::GetInstance()->GetServerCount() > 0) || (createdM.Elapsed() > eReadyTimeoutMs)); } cString cSatipDevice::DeviceType(void) const { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return "SAT>IP"; } cString cSatipDevice::DeviceName(void) const { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return deviceNameM; } bool cSatipDevice::AvoidRecording(void) const { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return SatipConfig.IsOperatingModeLow(); } int cSatipDevice::SignalStrength(void) const { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return (pTunerM ? pTunerM->SignalStrength() : -1); } int cSatipDevice::SignalQuality(void) const { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return (pTunerM ? pTunerM->SignalQuality() : -1); } bool cSatipDevice::ProvidesSource(int sourceP) const { - //debug("cSatipDevice::%s(%u): source=%c", __FUNCTION__, deviceIndexM, cSource::ToChar(sourceP)); + //debug("%s(%c) [device %u]", __PRETTY_FUNCTION__, cSource::ToChar(sourceP), deviceIndexM); if (!SatipConfig.IsOperatingModeOff() && !!cSatipDiscover::GetInstance()->GetServer(sourceP)) { int numDisabledSourcesM = SatipConfig.GetDisabledSourcesCount(); for (int i = 0; i < numDisabledSourcesM; ++i) { @@ -230,7 +230,7 @@ bool cSatipDevice::ProvidesSource(int sourceP) const bool cSatipDevice::ProvidesTransponder(const cChannel *channelP) const { - debug("cSatipDevice::%s(%u): transponder=%d source=%c", __FUNCTION__, deviceIndexM, channelP ? channelP->Transponder() : -1, channelP ? cSource::ToChar(channelP->Source()) : '?'); + debug("%s(%d) transponder=%d source=%c [device %u]", __PRETTY_FUNCTION__, channelP ? channelP->Number() : -1, channelP ? channelP->Transponder() : -1, channelP ? cSource::ToChar(channelP->Source()) : '?', deviceIndexM); return (ProvidesSource(channelP->Source())); } @@ -240,7 +240,7 @@ bool cSatipDevice::ProvidesChannel(const cChannel *channelP, int priorityP, bool bool hasPriority = (priorityP == IDLEPRIORITY) || (priorityP > this->Priority()); bool needsDetachReceivers = false; - debug("cSatipDevice::%s(%u): channel=%d priority=%d", __FUNCTION__, deviceIndexM, channelP ? channelP->Number() : -1, priorityP); + debug("%s(%d, %d, %d) [device %u]", __PRETTY_FUNCTION__, channelP ? channelP->Number() : -1, priorityP, !!needsDetachReceiversP, deviceIndexM); if (channelP && ProvidesTransponder(channelP)) { result = hasPriority; @@ -322,7 +322,7 @@ bool cSatipDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP) cString address; cSatipServer *server = cSatipDiscover::GetInstance()->GetServer(channelP->Source(), channelP->Transponder(), dtp.System()); if (!server) { - debug("cSatipDevice::%s(%u): no suitable server found", __FUNCTION__, deviceIndexM); + debug("%s No suitable server found [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return false; } cSatipDiscover::GetInstance()->SetTransponder(server, channelP->Transponder()); @@ -341,7 +341,7 @@ bool cSatipDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP) bool cSatipDevice::SetPid(cPidHandle *handleP, int typeP, bool onP) { - //debug("cSatipDevice::%s(%u): pid=%d type=%d on=%d", __FUNCTION__, deviceIndexM, handleP->pid, typeP, onP); + //debug("%s(%d, %d, %d) [device %u]", __PRETTY_FUNCTION__, deviceIndexM, handleP->pid, typeP, onP, deviceIndexM); if (pTunerM && handleP && handleP->pid >= 0) { if (onP) return pTunerM->SetPid(handleP->pid, typeP, true); @@ -353,7 +353,7 @@ bool cSatipDevice::SetPid(cPidHandle *handleP, int typeP, bool onP) int cSatipDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP) { - //debug("cSatipDevice::%s(%u): pid=%d tid=%d mask=%d", __FUNCTION__, deviceIndexM, pidP, tidP, maskP); + //debug("%s(%d, %02X, %02X) [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, deviceIndexM); if (pSectionFilterHandlerM) { int handle = pSectionFilterHandlerM->Open(pidP, tidP, maskP); if (pTunerM && (handle >= 0)) @@ -365,7 +365,7 @@ int cSatipDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP) void cSatipDevice::CloseFilter(int handleP) { - //debug("cSatipDevice::%s(%u): handle=%d", __FUNCTION__, deviceIndexM, handleP); + //debug("%s(%d) [device %u]", __PRETTY_FUNCTION__, handleP, deviceIndexM); if (pSectionFilterHandlerM) { if (pTunerM) pTunerM->SetPid(pSectionFilterHandlerM->GetPid(handleP), ptOther, false); @@ -375,7 +375,7 @@ void cSatipDevice::CloseFilter(int handleP) bool cSatipDevice::OpenDvr(void) { - debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); isPacketDeliveredM = false; tsBufferM->Clear(); if (pTunerM) @@ -386,7 +386,7 @@ bool cSatipDevice::OpenDvr(void) void cSatipDevice::CloseDvr(void) { - debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); if (pTunerM) pTunerM->Close(); isOpenDvrM = false; @@ -394,19 +394,19 @@ void cSatipDevice::CloseDvr(void) bool cSatipDevice::HasLock(int timeoutMsP) const { - //debug("cSatipDevice::%s(%u): timeoutMs=%d", __FUNCTION__, deviceIndexM, timeoutMsP); + //debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, timeoutMsP, deviceIndexM); return (pTunerM && pTunerM->HasLock()); } bool cSatipDevice::HasInternalCam(void) { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return false; } void cSatipDevice::WriteData(uchar *bufferP, int lengthP) { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); // Fill up TS buffer if (isOpenDvrM && tsBufferM) { int len = tsBufferM->Put(bufferP, lengthP); @@ -420,13 +420,13 @@ void cSatipDevice::WriteData(uchar *bufferP, int lengthP) int cSatipDevice::GetId(void) { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return deviceIndexM; } uchar *cSatipDevice::GetData(int *availableP) { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); if (isOpenDvrM && tsBufferM) { int count = 0; if (isPacketDeliveredM) @@ -457,7 +457,7 @@ uchar *cSatipDevice::GetData(int *availableP) void cSatipDevice::SkipData(int countP) { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); tsBufferM->Del(countP); isPacketDeliveredM = false; // Update buffer statistics @@ -466,7 +466,7 @@ void cSatipDevice::SkipData(int countP) bool cSatipDevice::GetTSPacket(uchar *&dataP) { - //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + //debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); if (tsBufferM) { #if defined(APIVERSNUM) && APIVERSNUM >= 20104 if (cCamSlot *cs = CamSlot()) { diff --git a/discover.c b/discover.c index b13a1e5..b3ac667 100644 --- a/discover.c +++ b/discover.c @@ -27,7 +27,7 @@ cSatipDiscover *cSatipDiscover::GetInstance(void) bool cSatipDiscover::Initialize(cSatipDiscoverServers *serversP) { - debug("cSatipDiscover::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); if (instanceS) { if (serversP) { for (cSatipDiscoverServer *s = serversP->First(); s; s = serversP->Next(s)) @@ -41,7 +41,7 @@ bool cSatipDiscover::Initialize(cSatipDiscoverServers *serversP) void cSatipDiscover::Destroy(void) { - debug("cSatipDiscover::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); if (instanceS) instanceS->Deactivate(); } @@ -50,7 +50,7 @@ size_t cSatipDiscover::WriteCallback(char *ptrP, size_t sizeP, size_t nmembP, vo { cSatipDiscover *obj = reinterpret_cast(dataP); size_t len = sizeP * nmembP; - //debug("cSatipDiscover::%s(%zu)", __FUNCTION__, len); + //debug("%s len=%zu", __PRETTY_FUNCTION__, len); if (obj) { CURLcode res = CURLE_OK; @@ -94,19 +94,19 @@ int cSatipDiscover::DebugCallback(CURL *handleP, curl_infotype typeP, char *data if (obj) { switch (typeP) { case CURLINFO_TEXT: - extra("cSatipDiscover::%s(): HTTP INFO %.*s", __FUNCTION__, (int)sizeP, dataP); + extra("%s HTTP INFO %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP); break; case CURLINFO_HEADER_IN: - extra("cSatipDiscover::%s(): HTTP HEAD <<< %.*s", __FUNCTION__, (int)sizeP, dataP); + extra("%s HTTP HEAD <<< %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP); break; case CURLINFO_HEADER_OUT: - extra("cSatipDiscover::%s(): HTTP HEAD >>>\n%.*s", __FUNCTION__, (int)sizeP, dataP); + extra("%s HTTP HEAD >>>\n%.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP); break; case CURLINFO_DATA_IN: - extra("cSatipDiscover::%s(): HTTP DATA <<< %.*s", __FUNCTION__, (int)sizeP, dataP); + extra("%s HTTP DATA <<< %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP); break; case CURLINFO_DATA_OUT: - extra("cSatipDiscover::%s(): HTTP DATA >>>\n%.*s", __FUNCTION__, (int)sizeP, dataP); + extra("%s HTTP DATA >>>\n%.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP); break; default: break; @@ -126,12 +126,12 @@ cSatipDiscover::cSatipDiscover() probeIntervalM(0), serversM() { - debug("cSatipDiscover::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); } cSatipDiscover::~cSatipDiscover() { - debug("cSatipDiscover::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); Deactivate(); cMutexLock MutexLock(&mutexM); // Free allocated memory @@ -149,7 +149,7 @@ void cSatipDiscover::Activate(void) void cSatipDiscover::Deactivate(void) { - debug("cSatipDiscover::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); sleepM.Signal(); if (Running()) @@ -158,7 +158,7 @@ void cSatipDiscover::Deactivate(void) void cSatipDiscover::Action(void) { - debug("cSatipDiscover::%s(): entering", __FUNCTION__); + debug("%s Entering", __PRETTY_FUNCTION__); probeIntervalM.Set(eProbeIntervalMs); msearchM.Probe(); // Do the thread loop @@ -187,12 +187,12 @@ void cSatipDiscover::Action(void) // to avoid busy loop and reduce cpu load sleepM.Wait(eSleepTimeoutMs); } - debug("cSatipDiscover::%s(): exiting", __FUNCTION__); + debug("%s Exiting", __PRETTY_FUNCTION__); } void cSatipDiscover::Fetch(const char *urlP) { - debug("cSatipDiscover::%s(%s)", __FUNCTION__, urlP); + debug("%s(%s)", __PRETTY_FUNCTION__, urlP); if (handleM && !isempty(urlP)) { long rc = 0; CURLcode res = CURLE_OK; @@ -232,7 +232,7 @@ void cSatipDiscover::Fetch(const char *urlP) void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char * descP) { - debug("cSatipDiscover::%s(%s, %s, %s)", __FUNCTION__, addrP, modelP, descP); + debug("%s(%s, %s, %s)", __PRETTY_FUNCTION__, addrP, modelP, descP); cMutexLock MutexLock(&mutexM); cSatipServer *tmp = new cSatipServer(addrP, modelP, descP); // Validate against existing servers @@ -246,70 +246,70 @@ void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char int cSatipDiscover::GetServerCount(void) { - //debug("cSatipDiscover::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); return serversM.Count(); } cSatipServer *cSatipDiscover::GetServer(int sourceP, int transponderP, int systemP) { - //debug("cSatipDiscover::%s(%d, %d, %d)", __FUNCTION__, sourceP, transponderP, systemP); + //debug("%s(%d, %d, %d)", __PRETTY_FUNCTION__, sourceP, transponderP, systemP); cMutexLock MutexLock(&mutexM); return serversM.Find(sourceP, transponderP, systemP); } cSatipServer *cSatipDiscover::GetServer(cSatipServer *serverP) { - //debug("cSatipDiscover::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); return serversM.Find(serverP); } cSatipServers *cSatipDiscover::GetServers(void) { - //debug("cSatipDiscover::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); return &serversM; } cString cSatipDiscover::GetServerString(cSatipServer *serverP) { - //debug("cSatipDiscover::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); return serversM.GetString(serverP); } cString cSatipDiscover::GetServerList(void) { - //debug("cSatipDiscover::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); return serversM.List(); } void cSatipDiscover::SetTransponder(cSatipServer *serverP, int transponderP) { - //debug("cSatipDiscover::%s(%d)", __FUNCTION__, transponderP); + //debug("%s(, %d)", __PRETTY_FUNCTION__, transponderP); cMutexLock MutexLock(&mutexM); serversM.SetTransponder(serverP, transponderP); } void cSatipDiscover::UseServer(cSatipServer *serverP, bool onOffP) { - //debug("cSatipDiscover::%s(%d)", __FUNCTION__, onOffP); + //debug("%s(, %d)", __PRETTY_FUNCTION__, onOffP); cMutexLock MutexLock(&mutexM); serversM.Use(serverP, onOffP); } int cSatipDiscover::NumProvidedSystems(void) { - //debug("cSatipDiscover::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); return serversM.NumProvidedSystems(); } void cSatipDiscover::SetUrl(const char *urlP) { - //debug("cSatipDiscover::%s(%s)", __FUNCTION__, urlP); + //debug("%s(%s)", __PRETTY_FUNCTION__, urlP); mutexM.Lock(); probeUrlListM.Insert(strdup(urlP)); mutexM.Unlock(); diff --git a/msearch.c b/msearch.c index 047d52c..d4d8461 100644 --- a/msearch.c +++ b/msearch.c @@ -38,7 +38,7 @@ cSatipMsearch::~cSatipMsearch() void cSatipMsearch::Probe(void) { - debug("cSatipMsearch::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); if (!registeredM) { cSatipPoller::GetInstance()->Register(*this); registeredM = true; @@ -53,17 +53,17 @@ int cSatipMsearch::GetFd(void) void cSatipMsearch::Process(void) { - //debug("cSatipMsearch::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); if (bufferM) { int length; while ((length = Read(bufferM, bufferLenM)) > 0) { bufferM[min(length, int(bufferLenM - 1))] = 0; - //debug("cSatipMsearch::%s(): len=%d buf=%s", __FUNCTION__, length, bufferM); + //debug("%s len=%d buf=%s", __PRETTY_FUNCTION__, length, bufferM); bool status = false, valid = false; char *s, *p = reinterpret_cast(bufferM), *location = NULL; char *r = strtok_r(p, "\r\n", &s); while (r) { - //debug("cSatipMsearch::%s(): %s", __FUNCTION__, r); + //debug("%s r=%s", __PRETTY_FUNCTION__, r); // Check the status code // HTTP/1.1 200 OK if (!status && startswith(r, "HTTP/1.1 200 OK")) @@ -73,7 +73,7 @@ void cSatipMsearch::Process(void) // LOCATION: http://192.168.0.115:8888/octonet.xml if (startswith(r, "LOCATION:")) { location = compactspace(r + 9); - debug("cSatipMsearch::%s(): location='%s'", __FUNCTION__, location); + debug("%s location='%s'", __PRETTY_FUNCTION__, location); } // Check the source type // ST: urn:ses-com:device:SatIPServer:1 @@ -81,7 +81,7 @@ void cSatipMsearch::Process(void) char *st = compactspace(r + 3); if (strstr(st, "urn:ses-com:device:SatIPServer:1")) valid = true; - debug("cSatipMsearch::%s(): st='%s'", __FUNCTION__, st); + debug("%s st='%s'", __PRETTY_FUNCTION__, st); } // Check whether all the required data is found if (valid && !isempty(location)) { diff --git a/poller.c b/poller.c index 15b0178..1b92409 100644 --- a/poller.c +++ b/poller.c @@ -24,7 +24,7 @@ cSatipPoller *cSatipPoller::GetInstance(void) bool cSatipPoller::Initialize(void) { - debug("cSatipPoller::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); if (instanceS) instanceS->Activate(); return true; @@ -32,7 +32,7 @@ bool cSatipPoller::Initialize(void) void cSatipPoller::Destroy(void) { - debug("cSatipPoller::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); if (instanceS) instanceS->Deactivate(); } @@ -42,12 +42,12 @@ cSatipPoller::cSatipPoller() mutexM(), fdM(epoll_create(eMaxFileDescriptors)) { - debug("cSatipPoller::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); } cSatipPoller::~cSatipPoller() { - debug("cSatipPoller::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); Deactivate(); cMutexLock MutexLock(&mutexM); close(fdM); @@ -62,7 +62,7 @@ void cSatipPoller::Activate(void) void cSatipPoller::Deactivate(void) { - debug("cSatipPoller::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); if (Running()) Cancel(3); @@ -70,7 +70,7 @@ void cSatipPoller::Deactivate(void) void cSatipPoller::Action(void) { - debug("cSatipPoller::%s(): entering", __FUNCTION__); + debug("%s Entering", __PRETTY_FUNCTION__); struct epoll_event events[eMaxFileDescriptors]; uint64_t maxElapsed = 0; // Increase priority @@ -88,34 +88,34 @@ void cSatipPoller::Action(void) elapsed = processing.Elapsed(); if (elapsed > maxElapsed) { maxElapsed = elapsed; - debug("cSatipPoller::%s(): Processing %s took %" PRIu64 " ms", __FUNCTION__, *(poll->ToString()), maxElapsed); + debug("%s Processing %s took %" PRIu64 " ms", __PRETTY_FUNCTION__, *(poll->ToString()), maxElapsed); } } } } - debug("cSatipPoller::%s(): exiting", __FUNCTION__); + debug("%s Exiting", __PRETTY_FUNCTION__); } bool cSatipPoller::Register(cSatipPollerIf &pollerP) { - debug("cSatipPoller::%s(%d)", __FUNCTION__, pollerP.GetFd()); + debug("%s fd=%d", __PRETTY_FUNCTION__, pollerP.GetFd()); cMutexLock MutexLock(&mutexM); struct epoll_event ev; ev.events = EPOLLIN | EPOLLET; ev.data.ptr = &pollerP; ERROR_IF_RET(epoll_ctl(fdM, EPOLL_CTL_ADD, pollerP.GetFd(), &ev) == -1, "epoll_ctl(EPOLL_CTL_ADD) failed", return false); - debug("cSatipPoller::%s(%d): Added interface", __FUNCTION__, pollerP.GetFd()); + debug("%s Added interface fd=%d", __PRETTY_FUNCTION__, pollerP.GetFd()); return true; } bool cSatipPoller::Unregister(cSatipPollerIf &pollerP) { - debug("cSatipPoller::%s(%d)", __FUNCTION__, pollerP.GetFd()); + debug("%s fd=%d", __PRETTY_FUNCTION__, pollerP.GetFd()); cMutexLock MutexLock(&mutexM); ERROR_IF_RET((epoll_ctl(fdM, EPOLL_CTL_DEL, pollerP.GetFd(), NULL) == -1), "epoll_ctl(EPOLL_CTL_DEL) failed", return false); - debug("cSatipPoller::%s(%d): Removed interface", __FUNCTION__, pollerP.GetFd()); + debug("%s Removed interface fd=%d", __PRETTY_FUNCTION__, pollerP.GetFd()); return true; } diff --git a/rtcp.c b/rtcp.c index 6105c87..fb58212 100644 --- a/rtcp.c +++ b/rtcp.c @@ -14,7 +14,7 @@ cSatipRtcp::cSatipRtcp(cSatipTunerIf &tunerP, unsigned int bufferLenP) bufferLenM(bufferLenP), bufferM(MALLOC(unsigned char, bufferLenM)) { - debug("cSatipRtcp::%s(%u) [device %d]", __FUNCTION__, bufferLenP, tunerM.GetId()); + debug("%s(, %u) [device %d]", __PRETTY_FUNCTION__, bufferLenP, tunerM.GetId()); if (bufferM) memset(bufferM, 0, bufferLenM); else @@ -23,19 +23,19 @@ cSatipRtcp::cSatipRtcp(cSatipTunerIf &tunerP, unsigned int bufferLenP) cSatipRtcp::~cSatipRtcp() { - debug("cSatipRtcp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); + debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId()); DELETE_POINTER(bufferM); } int cSatipRtcp::GetFd(void) { - //debug("cSatipRtcp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); + //debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId()); return Fd(); } int cSatipRtcp::GetApplicationOffset(int *lengthP) { - //debug("cSatipRtcp::%s(%d) [device %d]", __FUNCTION__, *lengthP, tunerM.GetId()); + //debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, *lengthP, tunerM.GetId()); if (!lengthP) return -1; int offset = 0; @@ -80,7 +80,7 @@ int cSatipRtcp::GetApplicationOffset(int *lengthP) void cSatipRtcp::Process(void) { - //debug("cSatipRtcp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); + //debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId()); if (bufferM) { int length; while ((length = Read(bufferM, bufferLenM)) > 0) { diff --git a/rtp.c b/rtp.c index b628ec9..85437de 100644 --- a/rtp.c +++ b/rtp.c @@ -17,7 +17,7 @@ cSatipRtp::cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP) packetErrorsM(0), sequenceNumberM(-1) { - debug("cSatipRtp::%s(%u) [device %d]", __FUNCTION__, bufferLenP, tunerM.GetId()); + debug("%s(, %u) [device %d]", __PRETTY_FUNCTION__, bufferLenP, tunerM.GetId()); if (bufferM) memset(bufferM, 0, bufferLenM); else @@ -26,7 +26,7 @@ cSatipRtp::cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP) cSatipRtp::~cSatipRtp() { - debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); + debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId()); DELETE_POINTER(bufferM); } @@ -37,13 +37,13 @@ int cSatipRtp::GetFd(void) void cSatipRtp::Close(void) { - debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); + debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId()); cSatipSocket::Close(); sequenceNumberM = -1; if (packetErrorsM) { - info("Detected %d RTP packet errors", packetErrorsM); + info("Detected %d RTP packet errors [device %d]", packetErrorsM, tunerM.GetId()); packetErrorsM = 0; lastErrorReportM = time(NULL); } @@ -51,7 +51,7 @@ void cSatipRtp::Close(void) int cSatipRtp::GetHeaderLenght(unsigned int lengthP) { - //debug("cSatipRtp::%s(%d) [device %d]", __FUNCTION__, lengthP, tunerM.GetId()); + //debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, lengthP, tunerM.GetId()); unsigned int headerlen = 0; if (lengthP > 0) { @@ -94,12 +94,12 @@ int cSatipRtp::GetHeaderLenght(unsigned int lengthP) } // Check for empty payload if (lengthP == headerlen) { - debug("cSatipRtp::%s(%d): Received empty RTP packet #%d [device %d]", __FUNCTION__, lengthP, seq, tunerM.GetId()); + debug("%s(%d) Received empty RTP packet #%d [device %d]", __PRETTY_FUNCTION__, lengthP, seq, tunerM.GetId()); headerlen = -1; } // Check that rtp is version 2 and payload contains multiple of TS packet data else if ((v != 2) || (((lengthP - headerlen) % TS_SIZE) != 0) || (bufferM[headerlen] != TS_SYNC_BYTE)) { - debug("cSatipRtp::%s(%d): Received incorrect RTP packet #%d v=%d len=%d sync=0x%02X [device %d]", __FUNCTION__, lengthP, seq, v, headerlen, bufferM[headerlen], tunerM.GetId()); + debug("%s(%d) Received incorrect RTP packet #%d v=%d len=%d sync=0x%02X [device %d]", __PRETTY_FUNCTION__, lengthP, seq, v, headerlen, bufferM[headerlen], tunerM.GetId()); headerlen = -1; } } @@ -110,7 +110,7 @@ int cSatipRtp::GetHeaderLenght(unsigned int lengthP) void cSatipRtp::Process(void) { - //debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); + //debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId()); if (bufferM) { int length; while ((length = Read(bufferM, bufferLenM)) > 0) { @@ -119,7 +119,7 @@ void cSatipRtp::Process(void) tunerM.ProcessVideoData(bufferM + headerlen, length - headerlen); } if (errno != EAGAIN && errno != EWOULDBLOCK) - error("Error %d reading in %s", errno, *ToString()); + error("Error %d reading in %s [device %d]", errno, *ToString(), tunerM.GetId()); } } diff --git a/rtsp.c b/rtsp.c index e59468b..a1ead50 100644 --- a/rtsp.c +++ b/rtsp.c @@ -14,7 +14,7 @@ cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP) handleM(curl_easy_init()), headerListM(NULL) { - debug("cSatipRtsp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); + debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId()); if (handleM) { CURLcode res = CURLE_OK; @@ -41,7 +41,7 @@ cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP) cSatipRtsp::~cSatipRtsp() { - debug("cSatipRtsp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); + debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId()); if (handleM) { // Cleanup curl stuff @@ -58,13 +58,13 @@ size_t cSatipRtsp::HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP, void { cSatipRtsp *obj = reinterpret_cast(dataP); size_t len = sizeP * nmembP; - //debug("cSatipRtsp::%s(%zu)", __FUNCTION__, len); + //debug("%s len=%zu", __PRETTY_FUNCTION__, len); char *s, *p = (char *)ptrP; char *r = strtok_r(p, "\r\n", &s); while (obj && r) { - //debug("cSatipRtsp::%s(%zu): %s", __FUNCTION__, len, r); + //debug("%s(%zu): %s", __PRETTY_FUNCTION__, len, r); r = skipspace(r); if (strstr(r, "com.ses.streamID")) { int streamid = -1; @@ -90,7 +90,7 @@ size_t cSatipRtsp::WriteCallback(void *ptrP, size_t sizeP, size_t nmembP, void * { cSatipRtsp *obj = reinterpret_cast(dataP); size_t len = sizeP * nmembP; - //debug("cSatipRtsp::%s(%zu)", __FUNCTION__, len); + //debug("%s len=%zu", __PRETTY_FUNCTION__, len); if (obj && (len > 0)) obj->tunerM.ProcessApplicationData((u_char*)ptrP, len); @@ -105,19 +105,19 @@ int cSatipRtsp::DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, s if (obj) { switch (typeP) { case CURLINFO_TEXT: - extra("cSatipRtsp::%s(): [device %d] RTSP INFO %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); + extra("%s [device %d] RTSP INFO %.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); break; case CURLINFO_HEADER_IN: - extra("cSatipRtsp::%s(): [device %d] RTSP HEAD <<< %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); + extra("%s [device %d] RTSP HEAD <<< %.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); break; case CURLINFO_HEADER_OUT: - extra("cSatipRtsp::%s(): [device %d] RTSP HEAD >>>\n%.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); + extra("%s [device %d] RTSP HEAD >>>\n%.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); break; case CURLINFO_DATA_IN: - extra("cSatipRtsp::%s(): [device %d] RTSP DATA <<< %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); + extra("%s [device %d] RTSP DATA <<< %.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); break; case CURLINFO_DATA_OUT: - extra("cSatipRtsp::%s(): [device %d] RTSP DATA >>>\n%.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); + extra("%s [device %d] RTSP DATA >>>\n%.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); break; default: break; @@ -129,7 +129,7 @@ int cSatipRtsp::DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, s cString cSatipRtsp::RtspUnescapeString(const char *strP) { - debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, strP, tunerM.GetId()); + debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, strP, tunerM.GetId()); if (handleM) { char *p = curl_easy_unescape(handleM, strP, 0, NULL); cString s = p; @@ -143,7 +143,7 @@ cString cSatipRtsp::RtspUnescapeString(const char *strP) bool cSatipRtsp::Options(const char *uriP) { - debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId()); + debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, uriP, tunerM.GetId()); if (handleM && !isempty(uriP)) { CURLcode res = CURLE_OK; @@ -161,7 +161,7 @@ bool cSatipRtsp::Options(const char *uriP) bool cSatipRtsp::Setup(const char *uriP, int rtpPortP, int rtcpPortP) { - debug("cSatipRtsp::%s(%s, %d, %d) [device %d]", __FUNCTION__, uriP, rtpPortP, rtcpPortP, tunerM.GetId()); + debug("%s(%s, %d, %d) [device %d]", __PRETTY_FUNCTION__, uriP, rtpPortP, rtcpPortP, tunerM.GetId()); if (handleM && !isempty(uriP)) { CURLcode res = CURLE_OK; cString transport = cString::sprintf("RTP/AVP;unicast;client_port=%d-%d", rtpPortP, rtcpPortP); @@ -186,11 +186,11 @@ bool cSatipRtsp::Setup(const char *uriP, int rtpPortP, int rtcpPortP) bool cSatipRtsp::SetSession(const char *sessionP) { - debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, sessionP, tunerM.GetId()); + debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, sessionP, tunerM.GetId()); if (handleM) { CURLcode res = CURLE_OK; - debug("cSatipRtsp::%s(): session id quirk enabled [device %d]", __FUNCTION__, tunerM.GetId()); + debug("%s: session id quirk enabled [device %d]", __PRETTY_FUNCTION__, tunerM.GetId()); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_SESSION_ID, sessionP); } @@ -199,7 +199,7 @@ bool cSatipRtsp::SetSession(const char *sessionP) bool cSatipRtsp::Describe(const char *uriP) { - debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId()); + debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, uriP, tunerM.GetId()); if (handleM && !isempty(uriP)) { CURLcode res = CURLE_OK; @@ -219,7 +219,7 @@ bool cSatipRtsp::Describe(const char *uriP) bool cSatipRtsp::Play(const char *uriP) { - debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId()); + debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, uriP, tunerM.GetId()); if (handleM && !isempty(uriP)) { CURLcode res = CURLE_OK; @@ -235,7 +235,7 @@ bool cSatipRtsp::Play(const char *uriP) bool cSatipRtsp::Teardown(const char *uriP) { - debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId()); + debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, uriP, tunerM.GetId()); if (handleM && !isempty(uriP)) { CURLcode res = CURLE_OK; @@ -267,7 +267,7 @@ bool cSatipRtsp::ValidateLatestResponse(void) error("Detected invalid status code %ld: %s [device %d]", rc, url, tunerM.GetId()); } } - debug("cSatipRtsp::%s(): %s [device %d]", __FUNCTION__, result ? "ok" : "failed", tunerM.GetId()); + debug("%s result=%s [device %d]", __PRETTY_FUNCTION__, result ? "ok" : "failed", tunerM.GetId()); return result; } diff --git a/satip.c b/satip.c index 3ab063f..3e82cf6 100644 --- a/satip.c +++ b/satip.c @@ -63,7 +63,7 @@ cPluginSatip::cPluginSatip(void) : deviceCountM(1), serversM(NULL) { - //debug("cPluginSatip::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); // Initialize any member variables here. // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT! @@ -71,13 +71,13 @@ cPluginSatip::cPluginSatip(void) cPluginSatip::~cPluginSatip() { - //debug("cPluginSatip::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); // Clean up after yourself! } const char *cPluginSatip::CommandLineHelp(void) { - debug("cPluginSatip::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); // Return a string that describes all known command line options. return " -d , --devices= set number of devices to be created\n" " -s ||, --server=||;||\n" @@ -86,7 +86,7 @@ const char *cPluginSatip::CommandLineHelp(void) bool cPluginSatip::ProcessArgs(int argc, char *argv[]) { - debug("cPluginSatip::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); // Implement command line argument processing here if applicable. static const struct option long_options[] = { { "devices", required_argument, NULL, 'd' }, @@ -116,7 +116,7 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[]) bool cPluginSatip::Initialize(void) { - debug("cPluginSatip::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); // Initialize any background activities the plugin shall perform. if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) error("Unable to initialize CURL"); @@ -128,7 +128,7 @@ bool cPluginSatip::Initialize(void) bool cPluginSatip::Start(void) { - debug("cPluginSatip::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); // Start any background activities the plugin shall perform. curl_version_info_data *data = curl_version_info(CURLVERSION_NOW); cString info = cString::sprintf("Using CURL %s", data->version); @@ -143,7 +143,7 @@ bool cPluginSatip::Start(void) void cPluginSatip::Stop(void) { - debug("cPluginSatip::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); // Stop any background activities the plugin is performing. cSatipDevice::Shutdown(); cSatipDiscover::GetInstance()->Destroy(); @@ -153,60 +153,60 @@ void cPluginSatip::Stop(void) void cPluginSatip::Housekeeping(void) { - //debug("cPluginSatip::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); // Perform any cleanup or other regular tasks. } void cPluginSatip::MainThreadHook(void) { - //debug("cPluginSatip::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); // Perform actions in the context of the main program thread. // WARNING: Use with great care - see PLUGINS.html! } cString cPluginSatip::Active(void) { - //debug("cPluginSatip::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); // Return a message string if shutdown should be postponed return NULL; } time_t cPluginSatip::WakeupTime(void) { - //debug("cPluginSatip::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); // Return custom wakeup time for shutdown script return 0; } cOsdObject *cPluginSatip::MainMenuAction(void) { - //debug("cPluginSatip::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); // Perform the action when selected from the main VDR menu. return NULL; } cMenuSetupPage *cPluginSatip::SetupMenu(void) { - debug("cPluginSatip::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); // Return a setup menu in case the plugin supports one. return new cSatipPluginSetup(); } void cPluginSatip::ParseServer(const char *paramP) { - debug("cPluginSatip::%s(%s)", __FUNCTION__, paramP); + debug("%s(%s)", __PRETTY_FUNCTION__, paramP); int n = 0; char *s, *p = (char *)paramP; char *r = strtok_r(p, ";", &s); while (r) { r = skipspace(r); - //debug("cPluginSatip::%s(): server[%d]=%s", __FUNCTION__, n, r); + //debug("%s server[%d]=%s", __PRETTY_FUNCTION__, n, r); cString serverAddr, serverModel, serverDescription; int n2 = 0; char *s2, *p2 = r; char *r2 = strtok_r(p2, "|", &s2); while (r2) { - //debug("cPluginSatip::%s(): param[%d]=%s", __FUNCTION__, n2, r2); + //debug("%s param[%d]=%s", __PRETTY_FUNCTION__, n2, r2); switch (n2++) { case 0: serverAddr = r2; @@ -223,7 +223,7 @@ void cPluginSatip::ParseServer(const char *paramP) r2 = strtok_r(NULL, "|", &s2); } if (*serverAddr && *serverModel && *serverDescription) { - debug("cPluginSatip::%s(): ipaddr=%s model=%s desc=%s", __FUNCTION__, *serverAddr, *serverModel, *serverDescription); + debug("%s ipaddr=%s model=%s desc=%s", __PRETTY_FUNCTION__, *serverAddr, *serverModel, *serverDescription); if (!serversM) serversM = new cSatipDiscoverServers(); serversM->Add(new cSatipDiscoverServer(*serverAddr, *serverModel, *serverDescription)); @@ -235,13 +235,13 @@ void cPluginSatip::ParseServer(const char *paramP) int cPluginSatip::ParseSources(const char *valueP, int *sourcesP) { - debug("cPluginSatip::%s(%s)", __FUNCTION__, valueP); + debug("%s(%s,)", __PRETTY_FUNCTION__, valueP); int n = 0; char *s, *p = (char *)valueP; char *r = strtok_r(p, " ", &s); while (r) { r = skipspace(r); - debug("cPluginSatip::%s(): sources[%d]=%s", __FUNCTION__, n, r); + debug("%s sources[%d]=%s", __PRETTY_FUNCTION__, n, r); if (n < MAX_DISABLED_SOURCES_COUNT) { sourcesP[n++] = cSource::FromString(r); } @@ -252,13 +252,13 @@ int cPluginSatip::ParseSources(const char *valueP, int *sourcesP) int cPluginSatip::ParseFilters(const char *valueP, int *filtersP) { - debug("cPluginSatip::%s(%s)", __FUNCTION__, valueP); + debug("%s(%s,)", __PRETTY_FUNCTION__, valueP); char buffer[256]; int n = 0; while (valueP && *valueP && (n < SECTION_FILTER_TABLE_SIZE)) { strn0cpy(buffer, valueP, sizeof(buffer)); int i = atoi(buffer); - //debug("cPluginSatip::%s(): filters[%d]=%d", __FUNCTION__, n, i); + //debug(":%s filters[%d]=%d", __PRETTY_FUNCTION__, n, i); if (i >= 0) filtersP[n++] = i; if ((valueP = strchr(valueP, ' ')) != NULL) @@ -269,7 +269,7 @@ int cPluginSatip::ParseFilters(const char *valueP, int *filtersP) bool cPluginSatip::SetupParse(const char *nameP, const char *valueP) { - debug("cPluginSatip::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); // Parse your own setup parameters and store their values. if (!strcasecmp(nameP, "OperatingMode")) SatipConfig.SetOperatingMode(atoi(valueP)); @@ -298,13 +298,13 @@ bool cPluginSatip::SetupParse(const char *nameP, const char *valueP) bool cPluginSatip::Service(const char *idP, void *dataP) { - debug("cPluginSatip::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); return false; } const char **cPluginSatip::SVDRPHelpPages(void) { - debug("cPluginSatip::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); static const char *HelpPages[] = { "INFO [ ] [ ]\n" " Prints SAT>IP device information and statistics.\n" @@ -329,7 +329,7 @@ const char **cPluginSatip::SVDRPHelpPages(void) cString cPluginSatip::SVDRPCommand(const char *commandP, const char *optionP, int &replyCodeP) { - debug("cPluginSatip::%s(%s, %s)", __FUNCTION__, commandP, optionP); + debug("%s(%s, %s,)", __PRETTY_FUNCTION__, commandP, optionP); if (strcasecmp(commandP, "INFO") == 0) { int index = cDevice::ActualDevice()->CardIndex(); int page = SATIP_DEVICE_INFO_ALL; diff --git a/sectionfilter.c b/sectionfilter.c index d8f10bc..99f682c 100644 --- a/sectionfilter.c +++ b/sectionfilter.c @@ -20,7 +20,7 @@ cSatipSectionFilter::cSatipSectionFilter(int deviceIndexP, uint16_t pidP, uint8_ ringBufferM(new cRingBufferFrame(eDmxMaxSectionCount * eDmxMaxSectionSize)), deviceIndexM(deviceIndexP) { - //debug("cSatipSectionFilter::%s(%d, %d)", __FUNCTION__, deviceIndexM, pidM); + //debug("%s(%d, %d, %d, %d) [device %d]", __PRETTY_FUNCTION__, deviceIndexM, pidM, tidP, maskP, deviceIndexM); int i; memset(secBufBaseM, 0, sizeof(secBufBaseM)); @@ -61,7 +61,7 @@ cSatipSectionFilter::cSatipSectionFilter(int deviceIndexP, uint16_t pidP, uint8_ cSatipSectionFilter::~cSatipSectionFilter() { - //debug("cSatipSectionFilter::%s(%d, %d)", __FUNCTION__, deviceIndexM, pidM); + //debug("%s pid=%d [device %d]", __PRETTY_FUNCTION__, pidM, deviceIndexM); int tmp = socketM[1]; socketM[1] = -1; if (tmp >= 0) @@ -236,7 +236,7 @@ cSatipSectionFilterHandler::cSatipSectionFilterHandler(int deviceIndexP, unsigne mutexM(), deviceIndexM(deviceIndexP) { - debug("cSatipSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM); + debug("%s(%d, %d) [device %d]", __PRETTY_FUNCTION__, deviceIndexM, bufferLenP, deviceIndexM); // Initialize filter pointers memset(filtersM, 0, sizeof(filtersM)); @@ -247,14 +247,14 @@ cSatipSectionFilterHandler::cSatipSectionFilterHandler(int deviceIndexP, unsigne ringBufferM->SetIoThrottle(); } else - error("Failed to allocate buffer for section filter handler (device=%d): ", deviceIndexM); + error("Failed to allocate buffer for section filter handler [device=%d]", deviceIndexM); Start(); } cSatipSectionFilterHandler::~cSatipSectionFilterHandler() { - debug("cSatipSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM); + debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM); // Stop thread if (Running()) Cancel(3); @@ -268,7 +268,7 @@ cSatipSectionFilterHandler::~cSatipSectionFilterHandler() void cSatipSectionFilterHandler::Action(void) { - debug("cSatipSectionFilterHandler::%s(%d): entering", __FUNCTION__, deviceIndexM); + debug("%s Entering [device %d]", __PRETTY_FUNCTION__, deviceIndexM); bool processed = false; // Do the thread loop while (Running()) { @@ -299,7 +299,7 @@ void cSatipSectionFilterHandler::Action(void) } } ringBufferM->Del(len); - debug("cSatipSectionFilterHandler::%s(%d): Skipped %d bytes to sync on TS packet", __FUNCTION__, deviceIndexM, len); + debug("%s Skipped %d bytes to sync on TS packet [device %d]", __PRETTY_FUNCTION__, len, deviceIndexM); continue; } // Process TS packet through all filters @@ -315,12 +315,12 @@ void cSatipSectionFilterHandler::Action(void) } cCondWait::SleepMs(10); // to avoid busy loop and reduce cpu load } - debug("cSatipSectionFilterHandler::%s(%d): exiting", __FUNCTION__, deviceIndexM); + debug("%s Exiting [device %d]", __PRETTY_FUNCTION__, deviceIndexM); } cString cSatipSectionFilterHandler::GetInformation(void) { - //debug("cSatipSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM); + //debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM); // loop through active section filters cMutexLock MutexLock(&mutexM); cString s = ""; @@ -339,9 +339,9 @@ cString cSatipSectionFilterHandler::GetInformation(void) bool cSatipSectionFilterHandler::Delete(unsigned int indexP) { - //debug("cSatipSectionFilterHandler::%s(%d): index=%d", __FUNCTION__, deviceIndexM, indexP); + //debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, indexP, deviceIndexM); if ((indexP < eMaxSecFilterCount) && filtersM[indexP]) { - //debug("cSatipSectionFilterHandler::%s(%d): found %d", __FUNCTION__, deviceIndexM, indexP); + //debug("%s(%d) Found [device %d]", __PRETTY_FUNCTION__, indexP, deviceIndexM); cSatipSectionFilter *tmp = filtersM[indexP]; filtersM[indexP] = NULL; delete tmp; @@ -352,7 +352,7 @@ bool cSatipSectionFilterHandler::Delete(unsigned int indexP) bool cSatipSectionFilterHandler::IsBlackListed(u_short pidP, u_char tidP, u_char maskP) const { - //debug("cSatipSectionFilterHandler::%s(%d): pid=%d tid=%02X mask=%02X", __FUNCTION__, deviceIndexM, pidP, tidP, maskP); + //debug("%s(%d, %02X, %02X) [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, deviceIndexM); // loop through section filter table for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) { int index = SatipConfig.GetDisabledFilters(i); @@ -360,7 +360,7 @@ bool cSatipSectionFilterHandler::IsBlackListed(u_short pidP, u_char tidP, u_char if ((index >= 0) && (index < SECTION_FILTER_TABLE_SIZE) && (section_filter_table[index].pid == pidP) && (section_filter_table[index].tid == tidP) && (section_filter_table[index].mask == maskP)) { - //debug("cSatipSectionFilterHandler::%s(%d): found %s", __FUNCTION__, deviceIndexM, section_filter_table[index].description); + //debug("%s Found %s [device %d]", __PRETTY_FUNCTION__, section_filter_table[index].description, deviceIndexM); return true; } } @@ -378,7 +378,7 @@ int cSatipSectionFilterHandler::Open(u_short pidP, u_char tidP, u_char maskP) for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { if (!filtersM[i]) { filtersM[i] = new cSatipSectionFilter(deviceIndexM, pidP, tidP, maskP); - //debug("cSatipSectionFilterHandler::%s(%d): pid=%d tid=%02X mask=%02X handle=%d index=%u", __FUNCTION__, deviceIndexM, pidP, tidP, maskP, filtersM[i]->GetFd(), i); + //debug("%s(%d, %02X, %02X) handle=%d index=%u [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, filtersM[i]->GetFd(), i, deviceIndexM); return filtersM[i]->GetFd(); } } @@ -393,7 +393,7 @@ void cSatipSectionFilterHandler::Close(int handleP) // Search the filter for deletion for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { if (filtersM[i] && (handleP == filtersM[i]->GetFd())) { - //debug("cSatipSectionFilterHandler::%s(%d): pid=%d handle=%d index=%u", __FUNCTION__, deviceIndexM, filtersM[i]->GetPid(), filtersM[i]->GetFd(), i); + //debug("%s(%d) pid=%d index=%u [device %d]", __PRETTY_FUNCTION__, handleP, filtersM[i]->GetPid(), i, deviceIndexM); Delete(i); break; } @@ -407,7 +407,7 @@ int cSatipSectionFilterHandler::GetPid(int handleP) // Search the filter for data for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { if (filtersM[i] && (handleP == filtersM[i]->GetFd())) { - //debug("cSatipSectionFilterHandler::%s(%d): pid=%d handle=%d index=%u", __FUNCTION__, deviceIndexM, filtersM[i]->GetPid(), filtersM[i]->GetFd(), i); + //debug("%s(%d) pid=%d index=%u [device %d]", __PRETTY_FUNCTION__, handleP, filtersM[i]->GetPid(), i, deviceIndexM); return filtersM[i]->GetPid(); } } @@ -416,7 +416,7 @@ int cSatipSectionFilterHandler::GetPid(int handleP) void cSatipSectionFilterHandler::Write(uchar *bufferP, int lengthP) { - //debug("cSatipSectionFilterHandler::%s(%d): length=%d", __FUNCTION__, deviceIndexM, lengthP); + //debug("%s(, %d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIndexM); // Fill up the buffer if (ringBufferM) { int len = ringBufferM->Put(bufferP, lengthP); diff --git a/setup.c b/setup.c index d44eaba..8e389c5 100644 --- a/setup.c +++ b/setup.c @@ -332,7 +332,7 @@ cSatipPluginSetup::cSatipPluginSetup() numDisabledSourcesM(SatipConfig.GetDisabledSourcesCount()), numDisabledFiltersM(SatipConfig.GetDisabledFiltersCount()) { - debug("cSatipPluginSetup::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); operatingModeTextsM[cSatipConfig::eOperatingModeOff] = tr("off"); operatingModeTextsM[cSatipConfig::eOperatingModeLow] = tr("low"); operatingModeTextsM[cSatipConfig::eOperatingModeNormal] = tr("normal"); @@ -398,7 +398,7 @@ void cSatipPluginSetup::Setup(void) eOSState cSatipPluginSetup::DeviceScan(void) { - debug("cSatipPluginSetup::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); cSatipDiscover::GetInstance()->TriggerScan(); return osContinue; @@ -406,7 +406,7 @@ eOSState cSatipPluginSetup::DeviceScan(void) eOSState cSatipPluginSetup::DeviceInfo(void) { - debug("cSatipPluginSetup::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); if (HasSubMenu() || Count() == 0) return osContinue; @@ -419,7 +419,7 @@ eOSState cSatipPluginSetup::DeviceInfo(void) eOSState cSatipPluginSetup::ShowDeviceStatus(void) { - debug("cSatipPluginSetup::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); if (HasSubMenu() || Count() == 0) return osContinue; @@ -428,7 +428,7 @@ eOSState cSatipPluginSetup::ShowDeviceStatus(void) eOSState cSatipPluginSetup::ShowInfo(void) { - debug("cSatipPluginSetup::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); if (HasSubMenu() || Count() == 0) return osContinue; @@ -485,7 +485,7 @@ void cSatipPluginSetup::StoreSources(const char *nameP, int *sourcesP) else buffer = cString::sprintf("%s", *cSource::ToString(sourcesP[i])); } - debug("cSatipPluginSetup::%s(%s, %s)", __FUNCTION__, nameP, *buffer); + debug("%s(%s, %s)", __PRETTY_FUNCTION__, nameP, *buffer); SetupStore(nameP, *buffer); } @@ -501,7 +501,7 @@ void cSatipPluginSetup::StoreFilters(const char *nameP, int *valuesP) else buffer = cString::sprintf("%d", valuesP[i]); } - debug("cSatipPluginSetup::%s(%s, %s)", __FUNCTION__, nameP, *buffer); + debug("%s(%s, %s)", __PRETTY_FUNCTION__, nameP, *buffer); SetupStore(nameP, *buffer); } diff --git a/socket.c b/socket.c index 3ecde0d..d7b9ce4 100644 --- a/socket.c +++ b/socket.c @@ -22,13 +22,13 @@ cSatipSocket::cSatipSocket() : socketPortM(0), socketDescM(-1) { - debug("cSatipSocket::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); memset(&sockAddrM, 0, sizeof(sockAddrM)); } cSatipSocket::~cSatipSocket() { - debug("cSatipSocket::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); // Close the socket Close(); } @@ -60,13 +60,13 @@ bool cSatipSocket::Open(const int portP) "getsockname()", Close(), return false); socketPortM = ntohs(sockAddrM.sin_port); } - debug("cSatipSocket::%s(%d): socketPort=%d", __FUNCTION__, portP, socketPortM); + debug("%s(%d) socketPort=%d", __PRETTY_FUNCTION__, portP, socketPortM); return true; } void cSatipSocket::Close(void) { - debug("cSatipSocket::%s(%d)", __FUNCTION__, socketPortM); + debug("%s sockerPort=%d", __PRETTY_FUNCTION__, socketPortM); // Check if socket exists if (socketDescM >= 0) { close(socketDescM); @@ -78,7 +78,7 @@ void cSatipSocket::Close(void) bool cSatipSocket::Flush(void) { - debug("cSatipSocket::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); if (socketDescM < 0) { const unsigned int len = 65535; unsigned char *buf = MALLOC(unsigned char, len); @@ -97,10 +97,10 @@ bool cSatipSocket::Flush(void) int cSatipSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP) { - //debug("cSatipSocket::%s()", __FUNCTION__); + //debug("%s(, %d)", __PRETTY_FUNCTION__, bufferLenP); // Error out if socket not initialized if (socketDescM <= 0) { - error("Invalid socket in cSatipUdpSocket::%s()", __FUNCTION__); + error("Invalid socket in %s()", __PRETTY_FUNCTION__); return -1; } int len = 0; @@ -135,10 +135,10 @@ int cSatipSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP) bool cSatipSocket::Write(const char *addrP, const unsigned char *bufferAddrP, unsigned int bufferLenP) { - debug("cSatipSocket::%s(%s)", __FUNCTION__, addrP); + debug("%s(%s, , %d)", __PRETTY_FUNCTION__, addrP, bufferLenP); // Error out if socket not initialized if (socketDescM <= 0) { - error("cSatipSocket::%s(): Invalid socket", __FUNCTION__); + error("%s Invalid socket", __PRETTY_FUNCTION__); return false; } struct sockaddr_in sockAddr; diff --git a/statistics.c b/statistics.c index 12f046f..cb8b51e 100644 --- a/statistics.c +++ b/statistics.c @@ -18,17 +18,17 @@ cSatipSectionStatistics::cSatipSectionStatistics() timerM(), mutexM() { - //debug("cSatipSectionStatistics::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); } cSatipSectionStatistics::~cSatipSectionStatistics() { - //debug("cSatipSectionStatistics::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); } cString cSatipSectionStatistics::GetSectionStatistic() { - //debug("cSatipSectionStatistics::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */ timerM.Set(); @@ -44,7 +44,7 @@ cString cSatipSectionStatistics::GetSectionStatistic() void cSatipSectionStatistics::AddSectionStatistic(long bytesP, long callsP) { - //debug("cSatipSectionStatistics::%s(%ld, %ld)", __FUNCTION__, bytesP, callsP); + //debug("%s(%ld, %ld)", __PRETTY_FUNCTION__, bytesP, callsP); cMutexLock MutexLock(&mutexM); filteredDataM += bytesP; numberOfCallsM += callsP; @@ -57,7 +57,7 @@ cSatipPidStatistics::cSatipPidStatistics() : timerM(), mutexM() { - debug("cSatipPidStatistics::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); const int numberOfElements = sizeof(mostActivePidsM) / sizeof(pidStruct); for (int i = 0; i < numberOfElements; ++i) { mostActivePidsM[i].pid = -1; @@ -67,12 +67,12 @@ cSatipPidStatistics::cSatipPidStatistics() cSatipPidStatistics::~cSatipPidStatistics() { - debug("cSatipPidStatistics::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); } cString cSatipPidStatistics::GetPidStatistic() { - //debug("cSatipPidStatistics::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); const int numberOfElements = sizeof(mostActivePidsM) / sizeof(pidStruct); uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */ @@ -97,7 +97,7 @@ cString cSatipPidStatistics::GetPidStatistic() int cSatipPidStatistics::SortPids(const void* data1P, const void* data2P) { - //debug("cSatipPidStatistics::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); const pidStruct *comp1 = reinterpret_cast(data1P); const pidStruct *comp2 = reinterpret_cast(data2P); if (comp1->dataAmount > comp2->dataAmount) @@ -109,7 +109,7 @@ int cSatipPidStatistics::SortPids(const void* data1P, const void* data2P) void cSatipPidStatistics::AddPidStatistic(int pidP, long payloadP) { - //debug("cSatipPidStatistics::%s(%ld, %ld)", __FUNCTION__, pidP, payloadP); + //debug("%s(%ld, %ld)", __PRETTY_FUNCTION__, pidP, payloadP); cMutexLock MutexLock(&mutexM); const int numberOfElements = sizeof(mostActivePidsM) / sizeof(pidStruct); // If our statistic already is in the array, update it and quit @@ -139,17 +139,17 @@ cSatipTunerStatistics::cSatipTunerStatistics() timerM(), mutexM() { - debug("cSatipTunerStatistics::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); } cSatipTunerStatistics::~cSatipTunerStatistics() { - debug("cSatipTunerStatistics::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); } cString cSatipTunerStatistics::GetTunerStatistic() { - //debug("cSatipTunerStatistics::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); mutexM.Lock(); uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */ timerM.Set(); @@ -165,7 +165,7 @@ cString cSatipTunerStatistics::GetTunerStatistic() void cSatipTunerStatistics::AddTunerStatistic(long bytesP) { - //debug("cSatipTunerStatistics::%s(%ld)", __FUNCTION__, bytesP); + //debug("%s(%ld)", __PRETTY_FUNCTION__, bytesP); cMutexLock MutexLock(&mutexM); dataBytesM += bytesP; } @@ -179,17 +179,17 @@ cSatipBufferStatistics::cSatipBufferStatistics() timerM(), mutexM() { - debug("cSatipBufferStatistics::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); } cSatipBufferStatistics::~cSatipBufferStatistics() { - debug("cSatipBufferStatistics::%s()", __FUNCTION__); + debug("%s", __PRETTY_FUNCTION__); } cString cSatipBufferStatistics::GetBufferStatistic() { - //debug("cSatipBufferStatistics::%s()", __FUNCTION__); + //debug("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */ timerM.Set(); @@ -213,7 +213,7 @@ cString cSatipBufferStatistics::GetBufferStatistic() void cSatipBufferStatistics::AddBufferStatistic(long bytesP, long usedP) { - //debug("cSatipBufferStatistics::%s(%ld, %ld)", __FUNCTION__, bytesP, usedP); + //debug("%s(%ld, %ld)", __PRETTY_FUNCTION__, bytesP, usedP); cMutexLock MutexLock(&mutexM); dataBytesM += bytesP; if (usedP > usedSpaceM) diff --git a/tuner.c b/tuner.c index fe6bf9d..bdf8b34 100644 --- a/tuner.c +++ b/tuner.c @@ -41,7 +41,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP) delPidsM(), pidsM() { - debug("cSatipTuner::%s(%d) [device %d]", __FUNCTION__, packetLenP, deviceIdM); + debug("%s(, %d) [device %d]", __PRETTY_FUNCTION__, packetLenP, deviceIdM); // Open sockets int i = 100; @@ -64,7 +64,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP) cSatipTuner::~cSatipTuner() { - debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM); + debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); // Stop thread sleepM.Signal(); @@ -84,22 +84,22 @@ cSatipTuner::~cSatipTuner() void cSatipTuner::Action(void) { - debug("cSatipTuner::%s(): entering [device %d]", __FUNCTION__, deviceIdM); + debug("%s Entering [device %d]", __PRETTY_FUNCTION__, deviceIdM); reConnectM.Set(eConnectTimeoutMs); // Do the thread loop while (Running()) { UpdateCurrentState(); switch (currentStateM) { case tsIdle: - //debug("cSatipTuner::%s(): tsIdle [device %d]", __FUNCTION__, deviceIdM); + //debug("%s: tsIdle [device %d]", __PRETTY_FUNCTION__, deviceIdM); break; case tsRelease: - //debug("cSatipTuner::%s(): tsRelease [device %d]", __FUNCTION__, deviceIdM); + //debug("%s: tsRelease [device %d]", __PRETTY_FUNCTION__, deviceIdM); Disconnect(); RequestState(tsIdle, smInternal); break; case tsSet: - //debug("cSatipTuner::%s(): tsSet [device %d]", __FUNCTION__, deviceIdM); + //debug("%s: tsSet [device %d]", __PRETTY_FUNCTION__, deviceIdM); reConnectM.Set(eConnectTimeoutMs); if (Connect()) { RequestState(tsTuned, smInternal); @@ -111,7 +111,7 @@ void cSatipTuner::Action(void) } break; case tsTuned: - //debug("cSatipTuner::%s(): tsTuned [device %d]", __FUNCTION__, deviceIdM); + //debug("%s: tsTuned [device %d]", __PRETTY_FUNCTION__, deviceIdM); reConnectM.Set(eConnectTimeoutMs); // Read reception statistics via DESCRIBE and RTCP if (hasLockM || ReadReceptionStatus()) { @@ -126,7 +126,7 @@ void cSatipTuner::Action(void) } break; case tsLocked: - //debug("cSatipTuner::%s(): tsLocked [device %d]", __FUNCTION__, deviceIdM); + //debug("%s: tsLocked [device %d]", __PRETTY_FUNCTION__, deviceIdM); if (!UpdatePids()) { error("Pid update failed - retuning [device %d]", deviceIdM); RequestState(tsSet, smInternal); @@ -150,13 +150,13 @@ void cSatipTuner::Action(void) if (!StateRequested()) sleepM.Wait(eSleepTimeoutMs); // to avoid busy loop and reduce cpu load } - debug("cSatipTuner::%s(): exiting [device %d]", __FUNCTION__, deviceIdM); + debug("%s Exiting [device %d]", __PRETTY_FUNCTION__, deviceIdM); } bool cSatipTuner::Open(void) { cMutexLock MutexLock(&mutexM); - debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM); + debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); RequestState(tsSet, smExternal); @@ -167,7 +167,7 @@ bool cSatipTuner::Open(void) bool cSatipTuner::Close(void) { cMutexLock MutexLock(&mutexM); - debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM); + debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); RequestState(tsRelease, smExternal); @@ -178,14 +178,14 @@ bool cSatipTuner::Close(void) bool cSatipTuner::Connect(void) { cMutexLock MutexLock(&mutexM); - debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM); + debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); if (!isempty(*streamAddrM)) { cString connectionUri = cString::sprintf("rtsp://%s/", *streamAddrM); // Just retune if (streamIdM >= 0) { cString uri = cString::sprintf("%sstream=%d?%s", *connectionUri, streamIdM, *streamParamM); - debug("cSatipTuner::%s(): retuning [device %d]", __FUNCTION__, deviceIdM); + debug("%s Retuning [device %d]", __PRETTY_FUNCTION__, deviceIdM); if (rtspM.Play(*uri)) { keepAliveM.Set(timeoutM); return true; @@ -218,7 +218,7 @@ bool cSatipTuner::Connect(void) bool cSatipTuner::Disconnect(void) { cMutexLock MutexLock(&mutexM); - debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM); + debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); if (!isempty(*streamAddrM) && (streamIdM >= 0)) { cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM); @@ -244,7 +244,7 @@ bool cSatipTuner::Disconnect(void) void cSatipTuner::ProcessVideoData(u_char *bufferP, int lengthP) { - //debug("cSatipTuner::%s(%d) [device %d]", __FUNCTION__, lengthP, deviceIdM); + //debug("%s(, %d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIdM); if (lengthP > 0) { AddTunerStatistic(lengthP); deviceM->WriteData(bufferP, lengthP); @@ -254,7 +254,7 @@ void cSatipTuner::ProcessVideoData(u_char *bufferP, int lengthP) void cSatipTuner::ProcessApplicationData(u_char *bufferP, int lengthP) { - //debug("cSatipTuner::%s(%d) [device %d]", __FUNCTION__, lengthP, deviceIdM); + //debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIdM); // DVB-S2: // ver=.;src=;tuner=,,,,,,,,,,,;pids=,..., // DVB-T2: @@ -264,7 +264,7 @@ void cSatipTuner::ProcessApplicationData(u_char *bufferP, int lengthP) if (lengthP > 0) { char s[lengthP]; memcpy(s, (char *)bufferP, lengthP); - //debug("cSatipTuner::%s(%s) [device %d]", __FUNCTION__, s, deviceIdM); + //debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, s, deviceIdM); char *c = strstr(s, ";tuner="); if (c) { int value; @@ -305,27 +305,27 @@ void cSatipTuner::ProcessApplicationData(u_char *bufferP, int lengthP) void cSatipTuner::SetStreamId(int streamIdP) { cMutexLock MutexLock(&mutexM); - debug("cSatipTuner::%s(%d) [device %d]", __FUNCTION__, streamIdP, deviceIdM); + debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, streamIdP, deviceIdM); streamIdM = streamIdP; } void cSatipTuner::SetSessionTimeout(const char *sessionP, int timeoutP) { cMutexLock MutexLock(&mutexM); - debug("cSatipTuner::%s(%s, %d) [device %d]", __FUNCTION__, sessionP, timeoutP, deviceIdM); + debug("%s(%s, %d) [device %d]", __PRETTY_FUNCTION__, sessionP, timeoutP, deviceIdM); sessionM = sessionP; timeoutM = (timeoutP > eMinKeepAliveIntervalMs) ? timeoutP : eMinKeepAliveIntervalMs; } int cSatipTuner::GetId(void) { - //debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM); + //debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); return deviceIdM; } bool cSatipTuner::SetSource(cSatipServer *serverP, const char *parameterP, const int indexP) { - debug("cSatipTuner::%s(%s, %d) [device %d]", __FUNCTION__, parameterP, indexP, deviceIdM); + debug("%s(%s, %d) [device %d]", __PRETTY_FUNCTION__, parameterP, indexP, deviceIdM); cMutexLock MutexLock(&mutexM); if (serverP) { nextServerM = cSatipDiscover::GetInstance()->GetServer(serverP); @@ -347,7 +347,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) [device %d]", __FUNCTION__, pidP, typeP, onP, deviceIdM); + //debug("%s(%d, %d, %d) [device %d]", __PRETTY_FUNCTION__, pidP, typeP, onP, deviceIdM); cMutexLock MutexLock(&mutexM); if (onP) { pidsM.AddPid(pidP); @@ -367,7 +367,7 @@ bool cSatipTuner::SetPid(int pidP, int typeP, bool onP) bool cSatipTuner::UpdatePids(bool forceP) { - //debug("cSatipTuner::%s(%d) tunerState=%s [device %d]", __FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM); + //debug("%s(%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM); if (((forceP && pidsM.Size()) || (pidUpdateCacheM.TimedOut() && (addPidsM.Size() || delPidsM.Size()))) && !isempty(*streamAddrM) && (streamIdM > 0)) { cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM); @@ -404,7 +404,7 @@ bool cSatipTuner::UpdatePids(bool forceP) bool cSatipTuner::KeepAlive(bool forceP) { - //debug("cSatipTuner::%s(%d) tunerState=%s [device %d]", __FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM); + //debug("%s(%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM); cMutexLock MutexLock(&mutexM); if (keepAliveM.TimedOut()) { keepAliveM.Set(timeoutM); @@ -421,7 +421,7 @@ bool cSatipTuner::KeepAlive(bool forceP) bool cSatipTuner::ReadReceptionStatus(bool forceP) { - //debug("cSatipTuner::%s(%d) tunerState=%s [device %d]", __FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM); + //debug("%s(%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM); cMutexLock MutexLock(&mutexM); if (statusUpdateM.TimedOut()) { statusUpdateM.Set(eStatusUpdateTimeoutMs); @@ -438,7 +438,7 @@ bool cSatipTuner::ReadReceptionStatus(bool forceP) void cSatipTuner::UpdateCurrentState(void) { - //debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM); + //debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); cMutexLock MutexLock(&mutexM); eTunerState state = currentStateM; @@ -452,7 +452,7 @@ void cSatipTuner::UpdateCurrentState(void) } if (currentStateM != state) { - debug("cSatipTuner::%s(): switching from %s to %s [device %d]", __FUNCTION__, TunerStateString(currentStateM), TunerStateString(state), deviceIdM); + debug("%s: switching from %s to %s [device %d]", __PRETTY_FUNCTION__, TunerStateString(currentStateM), TunerStateString(state), deviceIdM); currentStateM = state; } } @@ -460,7 +460,7 @@ void cSatipTuner::UpdateCurrentState(void) bool cSatipTuner::StateRequested(void) { cMutexLock MutexLock(&mutexM); - //debug("cSatipTuner::%s() current=%s internal=%d external=%d [device %d]", __FUNCTION__, TunerStateString(currentStateM), internalStateM.Size(), externalStateM.Size(), deviceIdM); + //debug("%s current=%s internal=%d external=%d [device %d]", __PRETTY_FUNCTION__, TunerStateString(currentStateM), internalStateM.Size(), externalStateM.Size(), deviceIdM); return (internalStateM.Size() || externalStateM.Size()); } @@ -468,7 +468,7 @@ bool cSatipTuner::StateRequested(void) bool cSatipTuner::RequestState(eTunerState stateP, eStateMode modeP) { cMutexLock MutexLock(&mutexM); - debug("cSatipTuner::%s(%s, %s) current=%s internal=%d external=%d [device %d]", __FUNCTION__, TunerStateString(stateP), StateModeString(modeP), TunerStateString(currentStateM), internalStateM.Size(), externalStateM.Size(), deviceIdM); + debug("%s(%s, %s) current=%s internal=%d external=%d [device %d]", __PRETTY_FUNCTION__, TunerStateString(stateP), StateModeString(modeP), TunerStateString(currentStateM), internalStateM.Size(), externalStateM.Size(), deviceIdM); if (modeP == smExternal) externalStateM.Append(stateP); @@ -532,30 +532,30 @@ const char *cSatipTuner::TunerStateString(eTunerState stateP) int cSatipTuner::SignalStrength(void) { - //debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM); + //debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); return signalStrengthM; } int cSatipTuner::SignalQuality(void) { - //debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM); + //debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); return signalQualityM; } bool cSatipTuner::HasLock(void) { - //debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM); + //debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); return (currentStateM >= tsTuned) && hasLockM; } cString cSatipTuner::GetSignalStatus(void) { - //debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM); + //debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); return cString::sprintf("lock=%d strength=%d quality=%d", HasLock(), SignalStrength(), SignalQuality()); } cString cSatipTuner::GetInformation(void) { - //debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM); + //debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); return (currentStateM >= tsTuned) ? cString::sprintf("rtsp://%s/?%s [stream=%d]", *streamAddrM, *streamParamM, streamIdM) : "connection failed"; }