diff --git a/rtcp.c b/rtcp.c index bbd3b87..effe382 100644 --- a/rtcp.c +++ b/rtcp.c @@ -13,6 +13,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()); if (bufferM) memset(bufferM, 0, bufferLenM); else @@ -21,17 +22,19 @@ cSatipRtcp::cSatipRtcp(cSatipTunerIf &tunerP, unsigned int bufferLenP) cSatipRtcp::~cSatipRtcp() { + debug("cSatipRtcp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); DELETE_POINTER(bufferM); } int cSatipRtcp::GetFd(void) { + //debug("cSatipRtcp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); return Fd(); } int cSatipRtcp::GetApplicationOffset(int *lengthP) { - //debug("cSatipRtcp::%s()", __FUNCTION__); + //debug("cSatipRtcp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); if (!lengthP) return -1; int offset = 0; @@ -76,7 +79,7 @@ int cSatipRtcp::GetApplicationOffset(int *lengthP) void cSatipRtcp::Process(int fdP) { - //debug("cSatipRtcp::%s(%d)", __FUNCTION__, fdP); + //debug("cSatipRtcp::%s(%d) [device %d]", __FUNCTION__, fdP, tunerM.GetId()); if (bufferM) { int length = Read(bufferM, bufferLenM); if (length > 0) { diff --git a/rtp.c b/rtp.c index c5a0222..44a85d8 100644 --- a/rtp.c +++ b/rtp.c @@ -16,6 +16,7 @@ cSatipRtp::cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP) packetErrorsM(0), sequenceNumberM(-1) { + debug("cSatipRtp::%s(%u) [device %d]", __FUNCTION__, bufferLenP, tunerM.GetId()); if (bufferM) memset(bufferM, 0, bufferLenM); else @@ -24,6 +25,7 @@ cSatipRtp::cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP) cSatipRtp::~cSatipRtp() { + debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); DELETE_POINTER(bufferM); } @@ -34,7 +36,7 @@ int cSatipRtp::GetFd(void) void cSatipRtp::Close(void) { - debug("cSatipRtp::%s(%d)", __FUNCTION__, GetFd()); + debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); cSatipSocket::Close(); @@ -48,7 +50,7 @@ void cSatipRtp::Close(void) int cSatipRtp::GetHeaderLenght(int lengthP) { - //debug("cSatipRtp::%s()", __FUNCTION__); + //debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); unsigned int headerlen = 0; if (lengthP > 0) { @@ -72,7 +74,7 @@ int cSatipRtp::GetHeaderLenght(int lengthP) else if ((sequenceNumberM >= 0) && (((sequenceNumberM + 1) % 0xFFFF) != seq)) { packetErrorsM++; if (time(NULL) - lastErrorReportM > eReportIntervalS) { - info("Detected %d RTP packet errors", packetErrorsM); + info("Detected %d RTP packet errors [device %d]", packetErrorsM, tunerM.GetId()); packetErrorsM = 0; lastErrorReportM = time(NULL); } @@ -91,7 +93,7 @@ int cSatipRtp::GetHeaderLenght(int lengthP) } // Check that rtp is version 2 and payload contains multiple of TS packet data if ((v != 2) || (((lengthP - headerlen) % TS_SIZE) != 0) || (bufferM[headerlen] != TS_SYNC_BYTE)) { - debug("cSatipRtp::%s(%d): Received incorrect RTP packet", __FUNCTION__, lengthP); + debug("cSatipRtp::%s(%d): Received incorrect RTP packet [device %d]", __FUNCTION__, lengthP, tunerM.GetId()); headerlen = -1; } } @@ -102,7 +104,7 @@ int cSatipRtp::GetHeaderLenght(int lengthP) void cSatipRtp::Process(int fdP) { - //debug("cSatipRtp::%s(%d)", __FUNCTION__, fdP); + //debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId()); if (bufferM) { int length = Read(bufferM, min(tunerM.GetVideoDataSize(), bufferLenM)); if (length > 0) { diff --git a/rtsp.c b/rtsp.c index 38a4b41..9971e74 100644 --- a/rtsp.c +++ b/rtsp.c @@ -10,7 +10,6 @@ cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP) : tunerM(tunerP), - tunerIdM(tunerP.GetId()), handleM(curl_easy_init()), headerListM(NULL) { @@ -33,7 +32,7 @@ cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP) SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_CONNECTTIMEOUT_MS, (long)eConnectTimeoutMs); // Set user-agent - SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_USERAGENT, *cString::sprintf("vdr-%s/%s (device %d)", PLUGIN_NAME_I18N, VERSION, tunerIdM)); + SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_USERAGENT, *cString::sprintf("vdr-%s/%s (device %d)", PLUGIN_NAME_I18N, VERSION, tunerM.GetId())); } } @@ -101,19 +100,19 @@ int cSatipRtsp::DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, s if (obj) { switch (typeP) { case CURLINFO_TEXT: - debug("cSatipTuner::%s(%d): RTSP INFO %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); + debug("cSatipRtsp::%s(%d): RTSP INFO %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); break; case CURLINFO_HEADER_IN: - debug("cSatipTuner::%s(%d): RTSP HEAD <<< %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); + debug("cSatipRtsp::%s(%d): RTSP HEAD <<< %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); break; case CURLINFO_HEADER_OUT: - debug("cSatipTuner::%s(%d): RTSP HEAD >>>\n%.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); + debug("cSatipRtsp::%s(%d): RTSP HEAD >>>\n%.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); break; case CURLINFO_DATA_IN: - debug("cSatipTuner::%s(%d): RTSP DATA <<< %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); + debug("cSatipRtsp::%s(%d): RTSP DATA <<< %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); break; case CURLINFO_DATA_OUT: - debug("cSatipTuner::%s(%d): RTSP DATA >>>\n%.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); + debug("cSatipRtsp::%s(%d): RTSP DATA >>>\n%.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); break; default: break; @@ -125,7 +124,7 @@ int cSatipRtsp::DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, s cString cSatipRtsp::RtspUnescapeString(const char *strP) { - debug("cSatipRtsp::%s(%d): str=%s", __FUNCTION__, tunerIdM, strP); + debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, strP, tunerM.GetId()); if (handleM) { char *p = curl_easy_unescape(handleM, strP, 0, NULL); cString s = p; @@ -139,7 +138,7 @@ cString cSatipRtsp::RtspUnescapeString(const char *strP) bool cSatipRtsp::Options(const char *uriP) { - debug("cSatipRtsp::%s(%d): uri=%s", __FUNCTION__, tunerIdM, uriP); + debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId()); if (handleM && !isempty(uriP)) { CURLcode res = CURLE_OK; @@ -157,7 +156,7 @@ bool cSatipRtsp::Options(const char *uriP) bool cSatipRtsp::Setup(const char *uriP, int rtpPortP, int rtcpPortP) { - debug("cSatipRtsp::%s(%d): uri=%s rtp=%d rtcp=%d", __FUNCTION__, tunerIdM, uriP, rtpPortP, rtcpPortP); + debug("cSatipRtsp::%s(%s, %d, %d) [device %d]", __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); @@ -182,11 +181,11 @@ bool cSatipRtsp::Setup(const char *uriP, int rtpPortP, int rtcpPortP) bool cSatipRtsp::SetSession(const char *sessionP) { - debug("cSatipRtsp::%s(%d): session=%s", __FUNCTION__, tunerIdM, sessionP); + debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, sessionP, tunerM.GetId()); if (handleM) { CURLcode res = CURLE_OK; - debug("cSatipRtsp::%s(%d): session id quirk enabled", __FUNCTION__, tunerIdM); + debug("cSatipRtsp::%s(): session id quirk enabled [device %d]", __FUNCTION__, tunerM.GetId()); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_SESSION_ID, sessionP); } @@ -195,7 +194,7 @@ bool cSatipRtsp::SetSession(const char *sessionP) bool cSatipRtsp::Describe(const char *uriP) { - debug("cSatipRtsp::%s(%d): uri=%s", __FUNCTION__, tunerIdM, uriP); + debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId()); if (handleM && !isempty(uriP)) { CURLcode res = CURLE_OK; @@ -215,7 +214,7 @@ bool cSatipRtsp::Describe(const char *uriP) bool cSatipRtsp::Play(const char *uriP) { - debug("cSatipRtsp::%s(%d): uri=%s", __FUNCTION__, tunerIdM, uriP); + debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId()); if (handleM && !isempty(uriP)) { CURLcode res = CURLE_OK; @@ -231,7 +230,7 @@ bool cSatipRtsp::Play(const char *uriP) bool cSatipRtsp::Teardown(const char *uriP) { - debug("cSatipRtsp::%s(%d): uri=%s", __FUNCTION__, tunerIdM, uriP); + debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId()); if (handleM && !isempty(uriP)) { CURLcode res = CURLE_OK; @@ -260,10 +259,10 @@ bool cSatipRtsp::ValidateLatestResponse(void) else if (rc != 0) { char *url = NULL; SATIP_CURL_EASY_GETINFO(handleM, CURLINFO_EFFECTIVE_URL, &url); - error("Detected invalid status code %ld: %s [device %d]", rc, url, tunerIdM); + error("Detected invalid status code %ld: %s [device %d]", rc, url, tunerM.GetId()); } } - debug("cSatipRtsp::%s(%d): %s", __FUNCTION__, tunerIdM, result ? "ok" : "failed"); + debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, result ? "ok" : "failed", tunerM.GetId()); return result; } diff --git a/rtsp.h b/rtsp.h index 1cd00d2..fabff40 100644 --- a/rtsp.h +++ b/rtsp.h @@ -28,7 +28,6 @@ private: }; cSatipTunerIf &tunerM; - int tunerIdM; CURL *handleM; struct curl_slist *headerListM;