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:
parent
6b2090e9ad
commit
a94d25b635
57
tuner.c
57
tuner.c
@ -16,9 +16,9 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
|
|||||||
sleepM(),
|
sleepM(),
|
||||||
deviceM(&deviceP),
|
deviceM(&deviceP),
|
||||||
deviceIdM(deviceP.GetId()),
|
deviceIdM(deviceP.GetId()),
|
||||||
rtspM(new cSatipRtsp(*this)),
|
rtspM(*this),
|
||||||
rtpM(new cSatipRtp(*this, packetLenP)),
|
rtpM(*this, packetLenP),
|
||||||
rtcpM(new cSatipRtcp(*this, 1500)),
|
rtcpM(*this, 1500),
|
||||||
streamAddrM(""),
|
streamAddrM(""),
|
||||||
streamParamM(""),
|
streamParamM(""),
|
||||||
currentServerM(NULL),
|
currentServerM(NULL),
|
||||||
@ -44,17 +44,17 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
|
|||||||
// Open sockets
|
// Open sockets
|
||||||
int i = 100;
|
int i = 100;
|
||||||
while (i-- > 0) {
|
while (i-- > 0) {
|
||||||
if (rtpM->Open(0) && rtcpM->Open(rtpM->Port() + 1))
|
if (rtpM.Open(0) && rtcpM.Open(rtpM.Port() + 1))
|
||||||
break;
|
break;
|
||||||
rtpM->Close();
|
rtpM.Close();
|
||||||
rtcpM->Close();
|
rtcpM.Close();
|
||||||
}
|
}
|
||||||
if ((rtpM->Port() <= 0) || (rtcpM->Port() <= 0)) {
|
if ((rtpM.Port() <= 0) || (rtcpM.Port() <= 0)) {
|
||||||
error("Cannot open required RTP/RTCP ports [device %d]", deviceIdM);
|
error("Cannot open required RTP/RTCP ports [device %d]", deviceIdM);
|
||||||
}
|
}
|
||||||
// Must be done after socket initialization!
|
// Must be done after socket initialization!
|
||||||
cSatipPoller::GetInstance()->Register(*rtpM);
|
cSatipPoller::GetInstance()->Register(rtpM);
|
||||||
cSatipPoller::GetInstance()->Register(*rtcpM);
|
cSatipPoller::GetInstance()->Register(rtcpM);
|
||||||
|
|
||||||
// Start thread
|
// Start thread
|
||||||
Start();
|
Start();
|
||||||
@ -73,15 +73,10 @@ cSatipTuner::~cSatipTuner()
|
|||||||
Close();
|
Close();
|
||||||
|
|
||||||
// Close the listening sockets
|
// Close the listening sockets
|
||||||
cSatipPoller::GetInstance()->Unregister(*rtcpM);
|
cSatipPoller::GetInstance()->Unregister(rtcpM);
|
||||||
cSatipPoller::GetInstance()->Unregister(*rtpM);
|
cSatipPoller::GetInstance()->Unregister(rtpM);
|
||||||
rtcpM->Close();
|
rtcpM.Close();
|
||||||
rtpM->Close();
|
rtpM.Close();
|
||||||
|
|
||||||
// Free allocated memory
|
|
||||||
DELETENULL(rtpM);
|
|
||||||
DELETENULL(rtcpM);
|
|
||||||
DELETENULL(rtspM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cSatipTuner::Action(void)
|
void cSatipTuner::Action(void)
|
||||||
@ -180,18 +175,18 @@ bool cSatipTuner::Connect(void)
|
|||||||
cString connectionUri = cString::sprintf("rtsp://%s", *streamAddrM);
|
cString connectionUri = cString::sprintf("rtsp://%s", *streamAddrM);
|
||||||
cString uri = cString::sprintf("%s/?%s", *connectionUri, *streamParamM);
|
cString uri = cString::sprintf("%s/?%s", *connectionUri, *streamParamM);
|
||||||
// Just retune
|
// Just retune
|
||||||
if ((tunerStatusM >= tsTuned) && (streamIdM >= 0) && rtpM && rtcpM) {
|
if ((tunerStatusM >= tsTuned) && (streamIdM >= 0)) {
|
||||||
debug("cSatipTuner::%s(): retune [device %d]", __FUNCTION__, deviceIdM);
|
debug("cSatipTuner::%s(): retune [device %d]", __FUNCTION__, deviceIdM);
|
||||||
KeepAlive(true);
|
KeepAlive(true);
|
||||||
// Flush any old content
|
// Flush any old content
|
||||||
rtpM->Flush();
|
rtpM.Flush();
|
||||||
return rtspM->Setup(*uri, rtpM->Port(), rtcpM->Port());
|
return rtspM.Setup(*uri, rtpM.Port(), rtcpM.Port());
|
||||||
}
|
}
|
||||||
keepAliveM.Set(timeoutM);
|
keepAliveM.Set(timeoutM);
|
||||||
if (rtspM->Options(*connectionUri)) {
|
if (rtspM.Options(*connectionUri)) {
|
||||||
if (nextServerM && nextServerM->Quirk(cSatipServer::eSatipQuirkSessionId))
|
if (nextServerM && nextServerM->Quirk(cSatipServer::eSatipQuirkSessionId))
|
||||||
rtspM->SetSession(SkipZeroes(*sessionM));
|
rtspM.SetSession(SkipZeroes(*sessionM));
|
||||||
if (rtspM->Setup(*uri, rtpM->Port(), rtcpM->Port())) {
|
if (rtspM.Setup(*uri, rtpM.Port(), rtcpM.Port())) {
|
||||||
if (nextServerM) {
|
if (nextServerM) {
|
||||||
cSatipDiscover::GetInstance()->UseServer(nextServerM, true);
|
cSatipDiscover::GetInstance()->UseServer(nextServerM, true);
|
||||||
currentServerM = nextServerM;
|
currentServerM = nextServerM;
|
||||||
@ -213,7 +208,7 @@ bool cSatipTuner::Disconnect(void)
|
|||||||
|
|
||||||
if ((tunerStatusM >= tsTuned) && !isempty(*streamAddrM) && (streamIdM >= 0)) {
|
if ((tunerStatusM >= tsTuned) && !isempty(*streamAddrM) && (streamIdM >= 0)) {
|
||||||
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
||||||
rtspM->Teardown(*uri);
|
rtspM.Teardown(*uri);
|
||||||
}
|
}
|
||||||
tunerStatusM = tsIdle;
|
tunerStatusM = tsIdle;
|
||||||
|
|
||||||
@ -324,10 +319,10 @@ bool cSatipTuner::SetSource(cSatipServer *serverP, const char *parameterP, const
|
|||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
if (serverP) {
|
if (serverP) {
|
||||||
nextServerM = cSatipDiscover::GetInstance()->GetServer(serverP);
|
nextServerM = cSatipDiscover::GetInstance()->GetServer(serverP);
|
||||||
if (rtspM && nextServerM && !isempty(nextServerM->Address()) && !isempty(parameterP)) {
|
if (nextServerM && !isempty(nextServerM->Address()) && !isempty(parameterP)) {
|
||||||
// Update stream address and parameter
|
// Update stream address and parameter
|
||||||
streamAddrM = rtspM->RtspUnescapeString(nextServerM->Address());
|
streamAddrM = rtspM.RtspUnescapeString(nextServerM->Address());
|
||||||
streamParamM = rtspM->RtspUnescapeString(parameterP);
|
streamParamM = rtspM.RtspUnescapeString(parameterP);
|
||||||
tunerStatusM = tsSet;
|
tunerStatusM = tsSet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -384,7 +379,7 @@ bool cSatipTuner::UpdatePids(bool forceP)
|
|||||||
uri = cString::sprintf("%s%d%s", *uri, delPidsM[i], (i == (delPidsM.Size() - 1)) ? "" : ",");
|
uri = cString::sprintf("%s%d%s", *uri, delPidsM[i], (i == (delPidsM.Size() - 1)) ? "" : ",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!rtspM->Play(*uri))
|
if (!rtspM.Play(*uri))
|
||||||
return false;
|
return false;
|
||||||
addPidsM.Clear();
|
addPidsM.Clear();
|
||||||
delPidsM.Clear();
|
delPidsM.Clear();
|
||||||
@ -403,7 +398,7 @@ bool cSatipTuner::KeepAlive(bool forceP)
|
|||||||
}
|
}
|
||||||
if (forceP && !isempty(*streamAddrM) && (streamIdM > 0)) {
|
if (forceP && !isempty(*streamAddrM) && (streamIdM > 0)) {
|
||||||
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
||||||
if (!rtspM->Options(*uri))
|
if (!rtspM.Options(*uri))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,7 +415,7 @@ bool cSatipTuner::ReadReceptionStatus(bool forceP)
|
|||||||
}
|
}
|
||||||
if (forceP && !isempty(*streamAddrM) && (streamIdM > 0)) {
|
if (forceP && !isempty(*streamAddrM) && (streamIdM > 0)) {
|
||||||
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
||||||
if (rtspM->Describe(*uri))
|
if (rtspM.Describe(*uri))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
tuner.h
6
tuner.h
@ -61,9 +61,9 @@ private:
|
|||||||
cCondWait sleepM;
|
cCondWait sleepM;
|
||||||
cSatipDeviceIf* deviceM;
|
cSatipDeviceIf* deviceM;
|
||||||
int deviceIdM;
|
int deviceIdM;
|
||||||
cSatipRtsp *rtspM;
|
cSatipRtsp rtspM;
|
||||||
cSatipRtp *rtpM;
|
cSatipRtp rtpM;
|
||||||
cSatipRtcp *rtcpM;
|
cSatipRtcp rtcpM;
|
||||||
cString streamAddrM;
|
cString streamAddrM;
|
||||||
cString streamParamM;
|
cString streamParamM;
|
||||||
cSatipServer *currentServerM;
|
cSatipServer *currentServerM;
|
||||||
|
Loading…
Reference in New Issue
Block a user