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"
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);
}
}
}

2
rtcp.h
View File

@ -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);

6
rtp.c
View File

@ -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);
}
}
}

2
rtp.h
View File

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

26
rtsp.c
View File

@ -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<cSatipRtsp *>(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;

2
rtsp.h
View File

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