From 778f3bd84ab0ae21f1b5c004f59192941fdc5a14 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Sun, 14 Dec 2014 17:45:55 +0200 Subject: [PATCH] Preliminary documentation for used logging modes. --- device.c | 34 +++++++++++++++++----------------- discover.c | 22 +++++++++++----------- log.h | 16 ++++++++++++++++ msearch.c | 2 +- rtcp.c | 6 +++--- rtp.c | 12 ++++++------ rtsp.c | 6 +++--- satip.c | 14 +++++++------- sectionfilter.c | 25 +++++++++++-------------- socket.c | 6 +++--- statistics.c | 22 +++++++++++----------- tuner.c | 30 +++++++++++++++--------------- 12 files changed, 104 insertions(+), 91 deletions(-) diff --git a/device.c b/device.c index 83525b6..7675be0 100644 --- a/device.c +++ b/device.c @@ -83,10 +83,10 @@ unsigned int cSatipDevice::Count(void) cSatipDevice *cSatipDevice::GetSatipDevice(int cardIndexP) { - debug8("%s (%d)", __PRETTY_FUNCTION__, cardIndexP); + debug16("%s (%d)", __PRETTY_FUNCTION__, cardIndexP); for (unsigned int i = 0; i < SATIP_MAX_DEVICES; ++i) { if (SatipDevicesS[i] && (SatipDevicesS[i]->CardIndex() == cardIndexP)) { - debug3("%s (%d): Found!", __PRETTY_FUNCTION__, cardIndexP); + debug16("%s (%d): Found!", __PRETTY_FUNCTION__, cardIndexP); return SatipDevicesS[i]; } } @@ -127,7 +127,7 @@ cString cSatipDevice::GetSatipStatus(void) cString cSatipDevice::GetGeneralInformation(void) { - debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%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() : "", @@ -139,13 +139,13 @@ cString cSatipDevice::GetGeneralInformation(void) cString cSatipDevice::GetPidsInformation(void) { - debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return GetPidStatistic(); } cString cSatipDevice::GetFiltersInformation(void) { - debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return cString::sprintf("Active section filters:\n%s", pSectionFilterHandlerM ? *pSectionFilterHandlerM->GetInformation() : ""); } @@ -181,37 +181,37 @@ cString cSatipDevice::GetInformation(unsigned int pageP) bool cSatipDevice::Ready(void) { - debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return ((cSatipDiscover::GetInstance()->GetServerCount() > 0) || (createdM.Elapsed() > eReadyTimeoutMs)); } cString cSatipDevice::DeviceType(void) const { - debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return "SAT>IP"; } cString cSatipDevice::DeviceName(void) const { - debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return deviceNameM; } bool cSatipDevice::AvoidRecording(void) const { - debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return SatipConfig.IsOperatingModeLow(); } int cSatipDevice::SignalStrength(void) const { - debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return (pTunerM ? pTunerM->SignalStrength() : -1); } int cSatipDevice::SignalQuality(void) const { - debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return (pTunerM ? pTunerM->SignalQuality() : -1); } @@ -399,19 +399,19 @@ void cSatipDevice::CloseDvr(void) bool cSatipDevice::HasLock(int timeoutMsP) const { - debug8("%s (%d) [device %d]", __PRETTY_FUNCTION__, timeoutMsP, deviceIndexM); + debug16("%s (%d) [device %d]", __PRETTY_FUNCTION__, timeoutMsP, deviceIndexM); return (pTunerM && pTunerM->HasLock()); } bool cSatipDevice::HasInternalCam(void) { - debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); return false; } void cSatipDevice::WriteData(uchar *bufferP, int lengthP) { - debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); // Fill up TS buffer if (isOpenDvrM && tsBufferM) { int len = tsBufferM->Put(bufferP, lengthP); @@ -430,7 +430,7 @@ int cSatipDevice::GetId(void) uchar *cSatipDevice::GetData(int *availableP) { - debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); if (isOpenDvrM && tsBufferM) { int count = 0; if (isPacketDeliveredM) @@ -461,7 +461,7 @@ uchar *cSatipDevice::GetData(int *availableP) void cSatipDevice::SkipData(int countP) { - debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); tsBufferM->Del(countP); isPacketDeliveredM = false; // Update buffer statistics @@ -470,7 +470,7 @@ void cSatipDevice::SkipData(int countP) bool cSatipDevice::GetTSPacket(uchar *&dataP) { - debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%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 8c7ab3f..8317ada 100644 --- a/discover.c +++ b/discover.c @@ -51,7 +51,7 @@ size_t cSatipDiscover::WriteCallback(char *ptrP, size_t sizeP, size_t nmembP, vo { cSatipDiscover *obj = reinterpret_cast(dataP); size_t len = sizeP * nmembP; - debug8("%s len=%zu", __PRETTY_FUNCTION__, len); + debug16("%s len=%zu", __PRETTY_FUNCTION__, len); if (obj) { CURLcode res = CURLE_OK; @@ -245,70 +245,70 @@ void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char int cSatipDiscover::GetServerCount(void) { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); return serversM.Count(); } cSatipServer *cSatipDiscover::GetServer(int sourceP, int transponderP, int systemP) { - debug8("%s (%d, %d, %d)", __PRETTY_FUNCTION__, sourceP, transponderP, systemP); + debug16("%s (%d, %d, %d)", __PRETTY_FUNCTION__, sourceP, transponderP, systemP); cMutexLock MutexLock(&mutexM); return serversM.Find(sourceP, transponderP, systemP); } cSatipServer *cSatipDiscover::GetServer(cSatipServer *serverP) { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); return serversM.Find(serverP); } cSatipServers *cSatipDiscover::GetServers(void) { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); return &serversM; } cString cSatipDiscover::GetServerString(cSatipServer *serverP) { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); return serversM.GetString(serverP); } cString cSatipDiscover::GetServerList(void) { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); return serversM.List(); } void cSatipDiscover::SetTransponder(cSatipServer *serverP, int transponderP) { - debug8("%s (, %d)", __PRETTY_FUNCTION__, transponderP); + debug16("%s (, %d)", __PRETTY_FUNCTION__, transponderP); cMutexLock MutexLock(&mutexM); serversM.SetTransponder(serverP, transponderP); } void cSatipDiscover::UseServer(cSatipServer *serverP, bool onOffP) { - debug8("%s (, %d)", __PRETTY_FUNCTION__, onOffP); + debug16("%s (, %d)", __PRETTY_FUNCTION__, onOffP); cMutexLock MutexLock(&mutexM); serversM.Use(serverP, onOffP); } int cSatipDiscover::NumProvidedSystems(void) { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); return serversM.NumProvidedSystems(); } void cSatipDiscover::SetUrl(const char *urlP) { - debug8("%s (%s)", __PRETTY_FUNCTION__, urlP); + debug16("%s (%s)", __PRETTY_FUNCTION__, urlP); mutexM.Lock(); probeUrlListM.Insert(strdup(urlP)); mutexM.Unlock(); diff --git a/log.h b/log.h index 3054911..0e60202 100644 --- a/log.h +++ b/log.h @@ -12,21 +12,37 @@ #define error(x...) esyslog("SATIP-ERROR: " x) #define info(x...) isyslog("SATIP: " x) +// 0x0001: Generic call stack #define debug1(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug1) ? dsyslog("SATIP1: " x) : void() ) +// 0x0002: CURL data flow #define debug2(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug2) ? dsyslog("SATIP2: " x) : void() ) +// 0x0004: Data parsing #define debug3(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug3) ? dsyslog("SATIP3: " x) : void() ) +// 0x0008: Tuner state machine #define debug4(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug4) ? dsyslog("SATIP4: " x) : void() ) +// 0x0010: RTSP responses #define debug5(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug5) ? dsyslog("SATIP5: " x) : void() ) +// 0x0020: RTP throughput performance #define debug6(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug6) ? dsyslog("SATIP6: " x) : void() ) +// 0x0040: RTP packet internals #define debug7(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug7) ? dsyslog("SATIP7: " x) : void() ) +// 0x0080: Section filtering #define debug8(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug8) ? dsyslog("SATIP8: " x) : void() ) +// 0x0100: Channel switching #define debug9(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug9) ? dsyslog("SATIP9: " x) : void() ) +// 0x0200: TBD #define debug10(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug10) ? dsyslog("SATIP10: " x) : void() ) +// 0x0400: TBD #define debug11(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug11) ? dsyslog("SATIP11: " x) : void() ) +// 0x0800: TBD #define debug12(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug12) ? dsyslog("SATIP12: " x) : void() ) +// 0x1000: TBD #define debug13(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug13) ? dsyslog("SATIP13: " x) : void() ) +// 0x2000: TBD #define debug14(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug14) ? dsyslog("SATIP14: " x) : void() ) +// 0x4000: TBD #define debug15(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug15) ? dsyslog("SATIP15: " x) : void() ) +// 0x8000; Extra call stack #define debug16(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug16) ? dsyslog("SATIP16: " x) : void() ) #endif // __SATIP_LOG_H diff --git a/msearch.c b/msearch.c index cde1216..087c912 100644 --- a/msearch.c +++ b/msearch.c @@ -54,7 +54,7 @@ int cSatipMsearch::GetFd(void) void cSatipMsearch::Process(void) { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); if (bufferM) { int length; while ((length = Read(bufferM, bufferLenM)) > 0) { diff --git a/rtcp.c b/rtcp.c index a2dca4d..0426010 100644 --- a/rtcp.c +++ b/rtcp.c @@ -30,13 +30,13 @@ cSatipRtcp::~cSatipRtcp() int cSatipRtcp::GetFd(void) { - debug8("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId()); + debug16("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId()); return Fd(); } int cSatipRtcp::GetApplicationOffset(int *lengthP) { - debug8("%s (%d) [device %d]", __PRETTY_FUNCTION__, *lengthP, tunerM.GetId()); + debug16("%s (%d) [device %d]", __PRETTY_FUNCTION__, *lengthP, tunerM.GetId()); if (!lengthP) return -1; int offset = 0; @@ -81,7 +81,7 @@ int cSatipRtcp::GetApplicationOffset(int *lengthP) void cSatipRtcp::Process(void) { - debug8("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId()); + debug16("%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 ab278e6..741c7fe 100644 --- a/rtp.c +++ b/rtp.c @@ -53,7 +53,7 @@ void cSatipRtp::Close(void) int cSatipRtp::GetHeaderLenght(unsigned char *bufferP, unsigned int lengthP) { - debug8("%s (, %d) [device %d]", __PRETTY_FUNCTION__, lengthP, tunerM.GetId()); + debug16("%s (, %d) [device %d]", __PRETTY_FUNCTION__, lengthP, tunerM.GetId()); unsigned int headerlen = 0; if (lengthP > 0) { @@ -71,7 +71,7 @@ int cSatipRtp::GetHeaderLenght(unsigned char *bufferP, unsigned int lengthP) // Payload type: MPEG2 TS = 33 unsigned int pt = bufferP[1] & 0x7F; if (pt != 33) - debug16("%s (%d) Received invalid RTP payload type %d - v=%d [device %d]", + debug7("%s (%d) Received invalid RTP payload type %d - v=%d [device %d]", __PRETTY_FUNCTION__, lengthP, pt, v, tunerM.GetId()); // Sequence number int seq = ((bufferP[2] & 0xFF) << 8) | (bufferP[3] & 0xFF); @@ -99,17 +99,17 @@ int cSatipRtp::GetHeaderLenght(unsigned char *bufferP, unsigned int lengthP) } // Check for empty payload if (lengthP == headerlen) { - debug16("%s (%d) Received empty RTP packet #%d [device %d]", __PRETTY_FUNCTION__, lengthP, seq, tunerM.GetId()); + debug7("%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) || (bufferP[headerlen] != TS_SYNC_BYTE)) { - debug16("%s (%d) Received incorrect RTP packet #%d v=%d len=%d sync=0x%02X [device %d]", __PRETTY_FUNCTION__, + debug7("%s (%d) Received incorrect RTP packet #%d v=%d len=%d sync=0x%02X [device %d]", __PRETTY_FUNCTION__, lengthP, seq, v, headerlen, bufferP[headerlen], tunerM.GetId()); headerlen = -1; } else - debug16("%s (%d) Received RTP packet #%d v=%d len=%d sync=0x%02X [device %d]", __PRETTY_FUNCTION__, + debug7("%s (%d) Received RTP packet #%d v=%d len=%d sync=0x%02X [device %d]", __PRETTY_FUNCTION__, lengthP, seq, v, headerlen, bufferP[headerlen], tunerM.GetId()); } } @@ -119,7 +119,7 @@ int cSatipRtp::GetHeaderLenght(unsigned char *bufferP, unsigned int lengthP) void cSatipRtp::Process(void) { - debug8("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId()); + debug16("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId()); if (bufferM) { unsigned int lenMsg[eRtpPacketReadCount]; uint64_t elapsed; diff --git a/rtsp.c b/rtsp.c index 1d36364..e239354 100644 --- a/rtsp.c +++ b/rtsp.c @@ -60,13 +60,13 @@ size_t cSatipRtsp::HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP, void { cSatipRtsp *obj = reinterpret_cast(dataP); size_t len = sizeP * nmembP; - debug8("%s len=%zu", __PRETTY_FUNCTION__, len); + debug16("%s len=%zu", __PRETTY_FUNCTION__, len); char *s, *p = (char *)ptrP; char *r = strtok_r(p, "\r\n", &s); while (obj && r) { - debug8("%s (%zu): %s", __PRETTY_FUNCTION__, len, r); + debug16("%s (%zu): %s", __PRETTY_FUNCTION__, len, r); r = skipspace(r); if (strstr(r, "com.ses.streamID")) { int streamid = -1; @@ -92,7 +92,7 @@ size_t cSatipRtsp::WriteCallback(void *ptrP, size_t sizeP, size_t nmembP, void * { cSatipRtsp *obj = reinterpret_cast(dataP); size_t len = sizeP * nmembP; - debug8("%s len=%zu", __PRETTY_FUNCTION__, len); + debug16("%s len=%zu", __PRETTY_FUNCTION__, len); if (obj && (len > 0)) obj->tunerM.ProcessApplicationData((u_char*)ptrP, len); diff --git a/satip.c b/satip.c index 4edcffd..622a3e9 100644 --- a/satip.c +++ b/satip.c @@ -64,7 +64,7 @@ cPluginSatip::cPluginSatip(void) : deviceCountM(1), serversM(NULL) { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%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! @@ -72,7 +72,7 @@ cPluginSatip::cPluginSatip(void) cPluginSatip::~cPluginSatip() { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); // Clean up after yourself! } @@ -154,34 +154,34 @@ void cPluginSatip::Stop(void) void cPluginSatip::Housekeeping(void) { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); // Perform any cleanup or other regular tasks. } void cPluginSatip::MainThreadHook(void) { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%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) { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); // Return a message string if shutdown should be postponed return NULL; } time_t cPluginSatip::WakeupTime(void) { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); // Return custom wakeup time for shutdown script return 0; } cOsdObject *cPluginSatip::MainMenuAction(void) { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); // Perform the action when selected from the main VDR menu. return NULL; } diff --git a/sectionfilter.c b/sectionfilter.c index 5248f50..d7f5182 100644 --- a/sectionfilter.c +++ b/sectionfilter.c @@ -21,7 +21,7 @@ cSatipSectionFilter::cSatipSectionFilter(int deviceIndexP, uint16_t pidP, uint8_ ringBufferM(new cRingBufferFrame(eDmxMaxSectionCount * eDmxMaxSectionSize)), deviceIndexM(deviceIndexP) { - debug8("%s (%d, %d, %d, %d) [device %d]", __PRETTY_FUNCTION__, deviceIndexM, pidM, tidP, maskP, deviceIndexM); + debug16("%s (%d, %d, %d, %d) [device %d]", __PRETTY_FUNCTION__, deviceIndexM, pidM, tidP, maskP, deviceIndexM); int i; memset(secBufBaseM, 0, sizeof(secBufBaseM)); @@ -62,7 +62,7 @@ cSatipSectionFilter::cSatipSectionFilter(int deviceIndexP, uint16_t pidP, uint8_ cSatipSectionFilter::~cSatipSectionFilter() { - debug8("%s pid=%d [device %d]", __PRETTY_FUNCTION__, pidM, deviceIndexM); + debug16("%s pid=%d [device %d]", __PRETTY_FUNCTION__, pidM, deviceIndexM); int tmp = socketM[1]; socketM[1] = -1; if (tmp >= 0) @@ -321,7 +321,7 @@ void cSatipSectionFilterHandler::Action(void) cString cSatipSectionFilterHandler::GetInformation(void) { - debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM); + debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM); // loop through active section filters cMutexLock MutexLock(&mutexM); cString s = ""; @@ -340,9 +340,9 @@ cString cSatipSectionFilterHandler::GetInformation(void) bool cSatipSectionFilterHandler::Delete(unsigned int indexP) { - debug8("%s (%d) [device %d]", __PRETTY_FUNCTION__, indexP, deviceIndexM); + debug16("%s (%d) [device %d]", __PRETTY_FUNCTION__, indexP, deviceIndexM); if ((indexP < eMaxSecFilterCount) && filtersM[indexP]) { - debug3("%s (%d) Found [device %d]", __PRETTY_FUNCTION__, indexP, deviceIndexM); + debug8("%s (%d) Found [device %d]", __PRETTY_FUNCTION__, indexP, deviceIndexM); cSatipSectionFilter *tmp = filtersM[indexP]; filtersM[indexP] = NULL; delete tmp; @@ -353,7 +353,7 @@ bool cSatipSectionFilterHandler::Delete(unsigned int indexP) bool cSatipSectionFilterHandler::IsBlackListed(u_short pidP, u_char tidP, u_char maskP) const { - debug8("%s (%d, %02X, %02X) [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, deviceIndexM); + debug16("%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); @@ -361,7 +361,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)) { - debug3("%s Found %s [device %d]", __PRETTY_FUNCTION__, section_filter_table[index].description, deviceIndexM); + debug8("%s Found %s [device %d]", __PRETTY_FUNCTION__, section_filter_table[index].description, deviceIndexM); return true; } } @@ -370,7 +370,6 @@ bool cSatipSectionFilterHandler::IsBlackListed(u_short pidP, u_char tidP, u_char int cSatipSectionFilterHandler::Open(u_short pidP, u_char tidP, u_char maskP) { - // Lock cMutexLock MutexLock(&mutexM); // Blacklist check, refuse certain filters if (IsBlackListed(pidP, tidP, maskP)) @@ -379,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); - debug8("%s (%d, %02X, %02X) handle=%d index=%u [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, filtersM[i]->GetFd(), i, deviceIndexM); + debug16("%s (%d, %02X, %02X) handle=%d index=%u [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, filtersM[i]->GetFd(), i, deviceIndexM); return filtersM[i]->GetFd(); } } @@ -389,12 +388,11 @@ int cSatipSectionFilterHandler::Open(u_short pidP, u_char tidP, u_char maskP) void cSatipSectionFilterHandler::Close(int handleP) { - // Lock cMutexLock MutexLock(&mutexM); // Search the filter for deletion for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { if (filtersM[i] && (handleP == filtersM[i]->GetFd())) { - debug3("%s (%d) pid=%d index=%u [device %d]", __PRETTY_FUNCTION__, handleP, filtersM[i]->GetPid(), i, deviceIndexM); + debug8("%s (%d) pid=%d index=%u [device %d]", __PRETTY_FUNCTION__, handleP, filtersM[i]->GetPid(), i, deviceIndexM); Delete(i); break; } @@ -403,12 +401,11 @@ void cSatipSectionFilterHandler::Close(int handleP) int cSatipSectionFilterHandler::GetPid(int handleP) { - // Lock cMutexLock MutexLock(&mutexM); // Search the filter for data for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) { if (filtersM[i] && (handleP == filtersM[i]->GetFd())) { - debug3("%s (%d) pid=%d index=%u [device %d]", __PRETTY_FUNCTION__, handleP, filtersM[i]->GetPid(), i, deviceIndexM); + debug8("%s (%d) pid=%d index=%u [device %d]", __PRETTY_FUNCTION__, handleP, filtersM[i]->GetPid(), i, deviceIndexM); return filtersM[i]->GetPid(); } } @@ -417,7 +414,7 @@ int cSatipSectionFilterHandler::GetPid(int handleP) void cSatipSectionFilterHandler::Write(uchar *bufferP, int lengthP) { - debug8("%s (, %d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIndexM); + debug16("%s (, %d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIndexM); // Fill up the buffer if (ringBufferM) { int len = ringBufferM->Put(bufferP, lengthP); diff --git a/socket.c b/socket.c index 6226f43..d6a9e50 100644 --- a/socket.c +++ b/socket.c @@ -98,7 +98,7 @@ bool cSatipSocket::Flush(void) int cSatipSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP) { - debug8("%s (, %d)", __PRETTY_FUNCTION__, bufferLenP); + debug16("%s (, %d)", __PRETTY_FUNCTION__, bufferLenP); // Error out if socket not initialized if (socketDescM <= 0) { error("%s Invalid socket", __PRETTY_FUNCTION__); @@ -135,7 +135,7 @@ int cSatipSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP) int cSatipSocket::ReadMulti(unsigned char *bufferAddrP, unsigned int *elementRecvSizeP, unsigned int elementCountP, unsigned int elementBufferSizeP) { - debug8("%s (, , %d, %d)", __PRETTY_FUNCTION__, elementCountP, elementBufferSizeP); + debug16("%s (, , %d, %d)", __PRETTY_FUNCTION__, elementCountP, elementBufferSizeP); // Error out if socket not initialized if (socketDescM <= 0) { error("%s Invalid socket", __PRETTY_FUNCTION__); @@ -159,7 +159,7 @@ int cSatipSocket::ReadMulti(unsigned char *bufferAddrP, unsigned int *elementRec ERROR_IF_RET(count < 0 && errno != EAGAIN && errno != EWOULDBLOCK, "recvmmsg()", return -1); for (int i = 0; i < count; ++i) elementRecvSizeP[i] = mmsgh[i].msg_len; - debug8("%s Received %d packets size[0]=%d", __PRETTY_FUNCTION__, count, elementRecvSizeP[0]); + debug16("%s Received %d packets size[0]=%d", __PRETTY_FUNCTION__, count, elementRecvSizeP[0]); return count; } diff --git a/statistics.c b/statistics.c index dcdc8ca..2133e01 100644 --- a/statistics.c +++ b/statistics.c @@ -19,17 +19,17 @@ cSatipSectionStatistics::cSatipSectionStatistics() timerM(), mutexM() { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); } cSatipSectionStatistics::~cSatipSectionStatistics() { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); } cString cSatipSectionStatistics::GetSectionStatistic() { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */ timerM.Set(); @@ -45,7 +45,7 @@ cString cSatipSectionStatistics::GetSectionStatistic() void cSatipSectionStatistics::AddSectionStatistic(long bytesP, long callsP) { - debug8("%s (%ld, %ld)", __PRETTY_FUNCTION__, bytesP, callsP); + debug16("%s (%ld, %ld)", __PRETTY_FUNCTION__, bytesP, callsP); cMutexLock MutexLock(&mutexM); filteredDataM += bytesP; numberOfCallsM += callsP; @@ -73,7 +73,7 @@ cSatipPidStatistics::~cSatipPidStatistics() cString cSatipPidStatistics::GetPidStatistic() { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); const int numberOfElements = sizeof(mostActivePidsM) / sizeof(pidStruct); uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */ @@ -98,7 +98,7 @@ cString cSatipPidStatistics::GetPidStatistic() int cSatipPidStatistics::SortPids(const void* data1P, const void* data2P) { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); const pidStruct *comp1 = reinterpret_cast(data1P); const pidStruct *comp2 = reinterpret_cast(data2P); if (comp1->dataAmount > comp2->dataAmount) @@ -110,7 +110,7 @@ int cSatipPidStatistics::SortPids(const void* data1P, const void* data2P) void cSatipPidStatistics::AddPidStatistic(int pidP, long payloadP) { - debug8("%s (%d, %ld)", __PRETTY_FUNCTION__, pidP, payloadP); + debug16("%s (%d, %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 @@ -150,7 +150,7 @@ cSatipTunerStatistics::~cSatipTunerStatistics() cString cSatipTunerStatistics::GetTunerStatistic() { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); mutexM.Lock(); uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */ timerM.Set(); @@ -166,7 +166,7 @@ cString cSatipTunerStatistics::GetTunerStatistic() void cSatipTunerStatistics::AddTunerStatistic(long bytesP) { - debug8("%s (%ld)", __PRETTY_FUNCTION__, bytesP); + debug16("%s (%ld)", __PRETTY_FUNCTION__, bytesP); cMutexLock MutexLock(&mutexM); dataBytesM += bytesP; } @@ -190,7 +190,7 @@ cSatipBufferStatistics::~cSatipBufferStatistics() cString cSatipBufferStatistics::GetBufferStatistic() { - debug8("%s", __PRETTY_FUNCTION__); + debug16("%s", __PRETTY_FUNCTION__); cMutexLock MutexLock(&mutexM); uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */ timerM.Set(); @@ -214,7 +214,7 @@ cString cSatipBufferStatistics::GetBufferStatistic() void cSatipBufferStatistics::AddBufferStatistic(long bytesP, long usedP) { - debug8("%s (%ld, %ld)", __PRETTY_FUNCTION__, bytesP, usedP); + debug16("%s (%ld, %ld)", __PRETTY_FUNCTION__, bytesP, usedP); cMutexLock MutexLock(&mutexM); dataBytesM += bytesP; if (usedP > usedSpaceM) diff --git a/tuner.c b/tuner.c index 486d553..b3c10e2 100644 --- a/tuner.c +++ b/tuner.c @@ -246,7 +246,7 @@ bool cSatipTuner::Disconnect(void) void cSatipTuner::ProcessVideoData(u_char *bufferP, int lengthP) { - debug8("%s (, %d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIdM); + debug16("%s (, %d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIdM); if (lengthP > 0) { uint64_t elapsed; cTimeMs processing(0); @@ -267,7 +267,7 @@ void cSatipTuner::ProcessVideoData(u_char *bufferP, int lengthP) void cSatipTuner::ProcessApplicationData(u_char *bufferP, int lengthP) { - debug8("%s (%d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIdM); + debug16("%s (%d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIdM); // DVB-S2: // ver=.;src=;tuner=,,,,,,,,,,,;pids=,..., // DVB-T2: @@ -277,7 +277,7 @@ void cSatipTuner::ProcessApplicationData(u_char *bufferP, int lengthP) if (lengthP > 0) { char s[lengthP]; memcpy(s, (char *)bufferP, lengthP); - debug8("%s (%s) [device %d]", __PRETTY_FUNCTION__, s, deviceIdM); + debug16("%s (%s) [device %d]", __PRETTY_FUNCTION__, s, deviceIdM); char *c = strstr(s, ";tuner="); if (c) { int value; @@ -334,7 +334,7 @@ void cSatipTuner::SetSessionTimeout(const char *sessionP, int timeoutP) int cSatipTuner::GetId(void) { - debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); + debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); return deviceIdM; } @@ -362,7 +362,7 @@ bool cSatipTuner::SetSource(cSatipServer *serverP, const char *parameterP, const bool cSatipTuner::SetPid(int pidP, int typeP, bool onP) { - debug8("%s (%d, %d, %d) [device %d]", __PRETTY_FUNCTION__, pidP, typeP, onP, deviceIdM); + debug16("%s (%d, %d, %d) [device %d]", __PRETTY_FUNCTION__, pidP, typeP, onP, deviceIdM); cMutexLock MutexLock(&mutexM); if (onP) { pidsM.AddPid(pidP); @@ -389,7 +389,7 @@ bool cSatipTuner::SetPid(int pidP, int typeP, bool onP) bool cSatipTuner::UpdatePids(bool forceP) { - debug8("%s (%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM); + debug16("%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); @@ -429,7 +429,7 @@ bool cSatipTuner::UpdatePids(bool forceP) bool cSatipTuner::KeepAlive(bool forceP) { - debug8("%s (%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM); + debug16("%s (%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM); cMutexLock MutexLock(&mutexM); if (keepAliveM.TimedOut()) { keepAliveM.Set(timeoutM); @@ -446,7 +446,7 @@ bool cSatipTuner::KeepAlive(bool forceP) bool cSatipTuner::ReadReceptionStatus(bool forceP) { - debug8("%s (%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM); + debug16("%s (%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM); cMutexLock MutexLock(&mutexM); if (statusUpdateM.TimedOut()) { statusUpdateM.Set(eStatusUpdateTimeoutMs); @@ -463,7 +463,7 @@ bool cSatipTuner::ReadReceptionStatus(bool forceP) void cSatipTuner::UpdateCurrentState(void) { - debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); + debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); cMutexLock MutexLock(&mutexM); eTunerState state = currentStateM; @@ -485,7 +485,7 @@ void cSatipTuner::UpdateCurrentState(void) bool cSatipTuner::StateRequested(void) { cMutexLock MutexLock(&mutexM); - debug8("%s current=%s internal=%d external=%d [device %d]", __PRETTY_FUNCTION__, TunerStateString(currentStateM), internalStateM.Size(), externalStateM.Size(), deviceIdM); + debug16("%s current=%s internal=%d external=%d [device %d]", __PRETTY_FUNCTION__, TunerStateString(currentStateM), internalStateM.Size(), externalStateM.Size(), deviceIdM); return (internalStateM.Size() || externalStateM.Size()); } @@ -557,30 +557,30 @@ const char *cSatipTuner::TunerStateString(eTunerState stateP) int cSatipTuner::SignalStrength(void) { - debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); + debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); return signalStrengthM; } int cSatipTuner::SignalQuality(void) { - debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); + debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); return signalQualityM; } bool cSatipTuner::HasLock(void) { - debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); + debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); return (currentStateM >= tsTuned) && hasLockM; } cString cSatipTuner::GetSignalStatus(void) { - debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); + debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); return cString::sprintf("lock=%d strength=%d quality=%d", HasLock(), SignalStrength(), SignalQuality()); } cString cSatipTuner::GetInformation(void) { - debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); + debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); return (currentStateM >= tsTuned) ? cString::sprintf("rtsp://%s/?%s [stream=%d]", *streamAddrM, *streamParamM, streamIdM) : "connection failed"; }