1
0
mirror of https://github.com/rofafor/vdr-plugin-satip.git synced 2023-10-10 13:37:42 +02:00

Get rid of pointers.

This commit is contained in:
Rolf Ahrenberg 2014-11-16 17:02:30 +02:00
parent 12d61d37cf
commit 2dcf3bbd6a
6 changed files with 21 additions and 21 deletions

4
rtcp.c
View File

@ -9,7 +9,7 @@
#include "rtcp.h" #include "rtcp.h"
cSatipRtcp::cSatipRtcp(cSatipTunerIf &tunerP, unsigned int bufferLenP) cSatipRtcp::cSatipRtcp(cSatipTunerIf &tunerP, unsigned int bufferLenP)
: tunerM(&tunerP), : tunerM(tunerP),
bufferLenM(bufferLenP), bufferLenM(bufferLenP),
bufferM(MALLOC(unsigned char, bufferLenM)) bufferM(MALLOC(unsigned char, bufferLenM))
{ {
@ -82,7 +82,7 @@ void cSatipRtcp::Process(int fdP)
if (length > 0) { if (length > 0) {
int offset = GetApplicationOffset(&length); int offset = GetApplicationOffset(&length);
if (offset >= 0) if (offset >= 0)
tunerM->ProcessApplicationData(bufferM + offset, length); tunerM.ProcessApplicationData(bufferM + offset, length);
} }
} }
} }

2
rtcp.h
View File

@ -14,7 +14,7 @@
class cSatipRtcp : public cSatipSocket, public cSatipPollerIf { class cSatipRtcp : public cSatipSocket, public cSatipPollerIf {
private: private:
cSatipTunerIf *tunerM; cSatipTunerIf &tunerM;
unsigned int bufferLenM; unsigned int bufferLenM;
unsigned char *bufferM; unsigned char *bufferM;
int GetApplicationOffset(int *lenghtP); int GetApplicationOffset(int *lenghtP);

6
rtp.c
View File

@ -9,7 +9,7 @@
#include "rtp.h" #include "rtp.h"
cSatipRtp::cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP) cSatipRtp::cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP)
: tunerM(&tunerP), : tunerM(tunerP),
bufferLenM(bufferLenP), bufferLenM(bufferLenP),
bufferM(MALLOC(unsigned char, bufferLenM)), bufferM(MALLOC(unsigned char, bufferLenM)),
lastErrorReportM(0), lastErrorReportM(0),
@ -104,11 +104,11 @@ void cSatipRtp::Process(int fdP)
{ {
//debug("cSatipRtp::%s(%d)", __FUNCTION__, fdP); //debug("cSatipRtp::%s(%d)", __FUNCTION__, fdP);
if (bufferM) { if (bufferM) {
int length = Read(bufferM, min(tunerM->GetVideoDataSize(), bufferLenM)); int length = Read(bufferM, min(tunerM.GetVideoDataSize(), bufferLenM));
if (length > 0) { if (length > 0) {
int headerlen = GetHeaderLenght(length); int headerlen = GetHeaderLenght(length);
if ((headerlen >= 0) && (headerlen < length)) if ((headerlen >= 0) && (headerlen < length))
tunerM->ProcessVideoData(bufferM + headerlen, length - headerlen); tunerM.ProcessVideoData(bufferM + headerlen, length - headerlen);
} }
} }
} }

2
rtp.h
View File

@ -17,7 +17,7 @@ private:
enum { enum {
eReportIntervalS = 300 // in seconds eReportIntervalS = 300 // in seconds
}; };
cSatipTunerIf *tunerM; cSatipTunerIf &tunerM;
unsigned int bufferLenM; unsigned int bufferLenM;
unsigned char *bufferM; unsigned char *bufferM;
time_t lastErrorReportM; time_t lastErrorReportM;

26
rtsp.c
View File

@ -9,7 +9,7 @@
#include "rtsp.h" #include "rtsp.h"
cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP) cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP)
: tunerM(&tunerP), : tunerM(tunerP),
tunerIdM(tunerP.GetId()), tunerIdM(tunerP.GetId()),
handleM(curl_easy_init()), handleM(curl_easy_init()),
headerListM(NULL) 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 *s, *p = (char *)ptrP;
char *r = strtok_r(p, "\r\n", &s); char *r = strtok_r(p, "\r\n", &s);
while (obj && obj->tunerM && r) { while (obj && r) {
//debug("cSatipRtsp::%s(%zu): %s", __FUNCTION__, len, r); //debug("cSatipRtsp::%s(%zu): %s", __FUNCTION__, len, r);
r = skipspace(r); r = skipspace(r);
if (strstr(r, "com.ses.streamID")) { if (strstr(r, "com.ses.streamID")) {
int streamid = -1; int streamid = -1;
if (sscanf(r, "com.ses.streamID:%11d", &streamid) == 1) if (sscanf(r, "com.ses.streamID:%11d", &streamid) == 1)
obj->tunerM->SetStreamId(streamid); obj->tunerM.SetStreamId(streamid);
} }
else if (strstr(r, "Session:")) { else if (strstr(r, "Session:")) {
int timeout = -1; int timeout = -1;
char *session = NULL; char *session = NULL;
if (sscanf(r, "Session:%m[^;];timeout=%11d", &session, &timeout) == 2) 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) else if (sscanf(r, "Session:%m[^;]", &session) == 1)
obj->tunerM->SetSessionTimeout(skipspace(session), -1); obj->tunerM.SetSessionTimeout(skipspace(session), -1);
FREE_POINTER(session); FREE_POINTER(session);
} }
r = strtok_r(NULL, "\r\n", &s); 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; size_t len = sizeP * nmembP;
//debug("cSatipRtsp::%s(%zu)", __FUNCTION__, len); //debug("cSatipRtsp::%s(%zu)", __FUNCTION__, len);
if (obj && obj->tunerM && (len > 0)) if (obj && (len > 0))
obj->tunerM->ProcessApplicationData((u_char*)ptrP, len); obj->tunerM.ProcessApplicationData((u_char*)ptrP, len);
return len; return len;
} }
@ -98,22 +98,22 @@ int cSatipRtsp::DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, s
{ {
cSatipRtsp *obj = reinterpret_cast<cSatipRtsp *>(userPtrP); cSatipRtsp *obj = reinterpret_cast<cSatipRtsp *>(userPtrP);
if (obj && obj->tunerM) { if (obj) {
switch (typeP) { switch (typeP) {
case CURLINFO_TEXT: 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; break;
case CURLINFO_HEADER_IN: 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; break;
case CURLINFO_HEADER_OUT: 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; break;
case CURLINFO_DATA_IN: 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; break;
case CURLINFO_DATA_OUT: 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; break;
default: default:
break; break;

2
rtsp.h
View File

@ -27,7 +27,7 @@ private:
eConnectTimeoutMs = 1500, // in milliseconds eConnectTimeoutMs = 1500, // in milliseconds
}; };
cSatipTunerIf* tunerM; cSatipTunerIf &tunerM;
int tunerIdM; int tunerIdM;
CURL *handleM; CURL *handleM;
struct curl_slist *headerListM; struct curl_slist *headerListM;