diff --git a/rtcp.c b/rtcp.c index 0ba5ecf..bbd3b87 100644 --- a/rtcp.c +++ b/rtcp.c @@ -9,7 +9,7 @@ #include "rtcp.h" cSatipRtcp::cSatipRtcp(cSatipTunerIf &tunerP, unsigned int bufferLenP) -: tunerM(&tunerP), +: tunerM(tunerP), bufferLenM(bufferLenP), bufferM(MALLOC(unsigned char, bufferLenM)) { @@ -82,7 +82,7 @@ void cSatipRtcp::Process(int fdP) if (length > 0) { int offset = GetApplicationOffset(&length); if (offset >= 0) - tunerM->ProcessApplicationData(bufferM + offset, length); + tunerM.ProcessApplicationData(bufferM + offset, length); } } } diff --git a/rtcp.h b/rtcp.h index 79931e0..6257764 100644 --- a/rtcp.h +++ b/rtcp.h @@ -14,7 +14,7 @@ class cSatipRtcp : public cSatipSocket, public cSatipPollerIf { private: - cSatipTunerIf *tunerM; + cSatipTunerIf &tunerM; unsigned int bufferLenM; unsigned char *bufferM; int GetApplicationOffset(int *lenghtP); diff --git a/rtp.c b/rtp.c index 4b9ee0b..c5a0222 100644 --- a/rtp.c +++ b/rtp.c @@ -9,7 +9,7 @@ #include "rtp.h" cSatipRtp::cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP) -: tunerM(&tunerP), +: tunerM(tunerP), bufferLenM(bufferLenP), bufferM(MALLOC(unsigned char, bufferLenM)), lastErrorReportM(0), @@ -104,11 +104,11 @@ void cSatipRtp::Process(int fdP) { //debug("cSatipRtp::%s(%d)", __FUNCTION__, fdP); if (bufferM) { - int length = Read(bufferM, min(tunerM->GetVideoDataSize(), bufferLenM)); + int length = Read(bufferM, min(tunerM.GetVideoDataSize(), bufferLenM)); if (length > 0) { int headerlen = GetHeaderLenght(length); if ((headerlen >= 0) && (headerlen < length)) - tunerM->ProcessVideoData(bufferM + headerlen, length - headerlen); + tunerM.ProcessVideoData(bufferM + headerlen, length - headerlen); } } } diff --git a/rtp.h b/rtp.h index c5b2d2f..ccc654b 100644 --- a/rtp.h +++ b/rtp.h @@ -17,7 +17,7 @@ private: enum { eReportIntervalS = 300 // in seconds }; - cSatipTunerIf *tunerM; + cSatipTunerIf &tunerM; unsigned int bufferLenM; unsigned char *bufferM; time_t lastErrorReportM; diff --git a/rtsp.c b/rtsp.c index 73390af..38a4b41 100644 --- a/rtsp.c +++ b/rtsp.c @@ -9,7 +9,7 @@ #include "rtsp.h" cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP) -: tunerM(&tunerP), +: tunerM(tunerP), tunerIdM(tunerP.GetId()), handleM(curl_easy_init()), headerListM(NULL) @@ -59,21 +59,21 @@ size_t cSatipRtsp::HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP, void char *s, *p = (char *)ptrP; char *r = strtok_r(p, "\r\n", &s); - while (obj && obj->tunerM && r) { + while (obj && r) { //debug("cSatipRtsp::%s(%zu): %s", __FUNCTION__, len, r); r = skipspace(r); if (strstr(r, "com.ses.streamID")) { int streamid = -1; if (sscanf(r, "com.ses.streamID:%11d", &streamid) == 1) - obj->tunerM->SetStreamId(streamid); + obj->tunerM.SetStreamId(streamid); } else if (strstr(r, "Session:")) { int timeout = -1; char *session = NULL; if (sscanf(r, "Session:%m[^;];timeout=%11d", &session, &timeout) == 2) - obj->tunerM->SetSessionTimeout(skipspace(session), timeout * 1000); + obj->tunerM.SetSessionTimeout(skipspace(session), timeout * 1000); else if (sscanf(r, "Session:%m[^;]", &session) == 1) - obj->tunerM->SetSessionTimeout(skipspace(session), -1); + obj->tunerM.SetSessionTimeout(skipspace(session), -1); FREE_POINTER(session); } r = strtok_r(NULL, "\r\n", &s); @@ -88,8 +88,8 @@ size_t cSatipRtsp::WriteCallback(void *ptrP, size_t sizeP, size_t nmembP, void * size_t len = sizeP * nmembP; //debug("cSatipRtsp::%s(%zu)", __FUNCTION__, len); - if (obj && obj->tunerM && (len > 0)) - obj->tunerM->ProcessApplicationData((u_char*)ptrP, len); + if (obj && (len > 0)) + obj->tunerM.ProcessApplicationData((u_char*)ptrP, len); return len; } @@ -98,22 +98,22 @@ int cSatipRtsp::DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, s { cSatipRtsp *obj = reinterpret_cast(userPtrP); - if (obj && obj->tunerM) { + if (obj) { switch (typeP) { case CURLINFO_TEXT: - debug("cSatipTuner::%s(%d): RTSP INFO %.*s", __FUNCTION__, obj->tunerM->GetId(), (int)sizeP, dataP); + debug("cSatipTuner::%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("cSatipTuner::%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("cSatipTuner::%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("cSatipTuner::%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("cSatipTuner::%s(%d): RTSP DATA >>>\n%.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); break; default: break; diff --git a/rtsp.h b/rtsp.h index 81d152d..1cd00d2 100644 --- a/rtsp.h +++ b/rtsp.h @@ -27,7 +27,7 @@ private: eConnectTimeoutMs = 1500, // in milliseconds }; - cSatipTunerIf* tunerM; + cSatipTunerIf &tunerM; int tunerIdM; CURL *handleM; struct curl_slist *headerListM;