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

Added support for X-SATIP-RTSP-Port header.

This commit is contained in:
Rolf Ahrenberg 2016-02-22 17:58:33 +02:00
parent b755dbf318
commit ae8298d19a
8 changed files with 118 additions and 25 deletions

View File

@ -13,6 +13,8 @@
#include <vdr/config.h> #include <vdr/config.h>
#include <vdr/i18n.h> #include <vdr/i18n.h>
#define SATIP_DEFAULT_RTSP_PORT 554
#define SATIP_MAX_DEVICES MAXDEVICES #define SATIP_MAX_DEVICES MAXDEVICES
#define SATIP_BUFFER_SIZE KILOBYTE(1024) #define SATIP_BUFFER_SIZE KILOBYTE(1024)

View File

@ -32,7 +32,7 @@ bool cSatipDiscover::Initialize(cSatipDiscoverServers *serversP)
if (instanceS) { if (instanceS) {
if (serversP) { if (serversP) {
for (cSatipDiscoverServer *s = serversP->First(); s; s = serversP->Next(s)) for (cSatipDiscoverServer *s = serversP->First(); s; s = serversP->Next(s))
instanceS->AddServer(s->IpAddress(), s->Model(), s->Description()); instanceS->AddServer(s->IpAddress(), s->IpPort(), s->Model(), s->Description());
} }
else else
instanceS->Activate(); instanceS->Activate();
@ -47,6 +47,18 @@ void cSatipDiscover::Destroy(void)
instanceS->Deactivate(); instanceS->Deactivate();
} }
size_t cSatipDiscover::HeaderCallback(char *ptrP, size_t sizeP, size_t nmembP, void *dataP)
{
cSatipDiscover *obj = reinterpret_cast<cSatipDiscover *>(dataP);
size_t len = sizeP * nmembP;
debug16("%s len=%zu", __PRETTY_FUNCTION__, len);
if (obj && (len > 0))
obj->headerBufferM.Add(ptrP, len);
return len;
}
size_t cSatipDiscover::DataCallback(char *ptrP, size_t sizeP, size_t nmembP, void *dataP) size_t cSatipDiscover::DataCallback(char *ptrP, size_t sizeP, size_t nmembP, void *dataP)
{ {
cSatipDiscover *obj = reinterpret_cast<cSatipDiscover *>(dataP); cSatipDiscover *obj = reinterpret_cast<cSatipDiscover *>(dataP);
@ -91,6 +103,7 @@ int cSatipDiscover::DebugCallback(CURL *handleP, curl_infotype typeP, char *data
cSatipDiscover::cSatipDiscover() cSatipDiscover::cSatipDiscover()
: cThread("SATIP discover"), : cThread("SATIP discover"),
mutexM(), mutexM(),
headerBufferM(),
dataBufferM(), dataBufferM(),
msearchM(*this), msearchM(*this),
probeUrlListM(), probeUrlListM(),
@ -176,7 +189,9 @@ void cSatipDiscover::Fetch(const char *urlP)
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGFUNCTION, cSatipDiscover::DebugCallback); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGFUNCTION, cSatipDiscover::DebugCallback);
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGDATA, this); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGDATA, this);
// Set callback // Set header and data callbacks
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_HEADERFUNCTION, cSatipDiscover::HeaderCallback);
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_WRITEHEADER, this);
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_WRITEFUNCTION, cSatipDiscover::DataCallback); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_WRITEFUNCTION, cSatipDiscover::DataCallback);
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_WRITEDATA, this); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_WRITEDATA, this);
@ -199,7 +214,8 @@ void cSatipDiscover::Fetch(const char *urlP)
SATIP_CURL_EASY_GETINFO(handleM, CURLINFO_RESPONSE_CODE, &rc); SATIP_CURL_EASY_GETINFO(handleM, CURLINFO_RESPONSE_CODE, &rc);
SATIP_CURL_EASY_GETINFO(handleM, CURLINFO_PRIMARY_IP, &addr); SATIP_CURL_EASY_GETINFO(handleM, CURLINFO_PRIMARY_IP, &addr);
if (rc == 200) { if (rc == 200) {
ParseDeviceInfo(addr); ParseDeviceInfo(addr, ParseRtspPort());
headerBufferM.Reset();
dataBufferM.Reset(); dataBufferM.Reset();
} }
else else
@ -207,9 +223,32 @@ void cSatipDiscover::Fetch(const char *urlP)
} }
} }
void cSatipDiscover::ParseDeviceInfo(const char *addrP) int cSatipDiscover::ParseRtspPort(void)
{ {
debug1("%s (%s)", __PRETTY_FUNCTION__, addrP); debug1("%s", __PRETTY_FUNCTION__);
char *s, *p = headerBufferM.Data();
char *r = strtok_r(p, "\r\n", &s);
int port = SATIP_DEFAULT_RTSP_PORT;
while (r) {
debug16("%s (%zu): %s", __PRETTY_FUNCTION__, headerBufferM.Size(), r);
r = skipspace(r);
if (strstr(r, "X-SATIP-RTSP-Port")) {
int tmp = -1;
if (sscanf(r, "X-SATIP-RTSP-Port:%11d", &tmp) == 1) {
port = tmp;
break;
}
}
r = strtok_r(NULL, "\r\n", &s);
}
return port;
}
void cSatipDiscover::ParseDeviceInfo(const char *addrP, const int portP)
{
debug1("%s (%s, %d)", __PRETTY_FUNCTION__, addrP, portP);
const char *desc = NULL, *model = NULL; const char *desc = NULL, *model = NULL;
#ifdef USE_TINYXML #ifdef USE_TINYXML
TiXmlDocument doc; TiXmlDocument doc;
@ -232,12 +271,12 @@ void cSatipDiscover::ParseDeviceInfo(const char *addrP)
model = modelNode.text().as_string("DVBS2-1"); model = modelNode.text().as_string("DVBS2-1");
} }
#endif #endif
AddServer(addrP, model, desc); AddServer(addrP, portP, model, desc);
} }
void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char * descP) void cSatipDiscover::AddServer(const char *addrP, const int portP, const char *modelP, const char * descP)
{ {
debug1("%s (%s, %s, %s)", __PRETTY_FUNCTION__, addrP, modelP, descP); debug1("%s (%s, %d, %s, %s)", __PRETTY_FUNCTION__, addrP, portP, modelP, descP);
cMutexLock MutexLock(&mutexM); cMutexLock MutexLock(&mutexM);
if (SatipConfig.GetUseSingleModelServers() && modelP && !isempty(modelP)) { if (SatipConfig.GetUseSingleModelServers() && modelP && !isempty(modelP)) {
int n = 0; int n = 0;
@ -246,7 +285,7 @@ void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char
while (r) { while (r) {
r = skipspace(r); r = skipspace(r);
cString desc = cString::sprintf("%s #%d", !isempty(descP) ? descP : "MyBrokenHardware", n++); cString desc = cString::sprintf("%s #%d", !isempty(descP) ? descP : "MyBrokenHardware", n++);
cSatipServer *tmp = new cSatipServer(addrP, r, desc); cSatipServer *tmp = new cSatipServer(addrP, portP, r, desc);
if (!serversM.Update(tmp)) { if (!serversM.Update(tmp)) {
info("Adding server '%s|%s|%s' CI: %s Quirks: %s", tmp->Address(), tmp->Model(), tmp->Description(), tmp->HasCI() ? "yes" : "no", tmp->HasQuirk() ? tmp->Quirks() : "none"); info("Adding server '%s|%s|%s' CI: %s Quirks: %s", tmp->Address(), tmp->Model(), tmp->Description(), tmp->HasCI() ? "yes" : "no", tmp->HasQuirk() ? tmp->Quirks() : "none");
serversM.Add(tmp); serversM.Add(tmp);
@ -258,7 +297,7 @@ void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char
FREE_POINTER(p); FREE_POINTER(p);
} }
else { else {
cSatipServer *tmp = new cSatipServer(addrP, modelP, descP); cSatipServer *tmp = new cSatipServer(addrP, portP, modelP, descP);
if (!serversM.Update(tmp)) { if (!serversM.Update(tmp)) {
info("Adding server '%s|%s|%s' CI: %s Quirks: %s", tmp->Address(), tmp->Model(), tmp->Description(), tmp->HasCI() ? "yes" : "no", tmp->HasQuirk() ? tmp->Quirks() : "none"); info("Adding server '%s|%s|%s' CI: %s Quirks: %s", tmp->Address(), tmp->Model(), tmp->Description(), tmp->HasCI() ? "yes" : "no", tmp->HasQuirk() ? tmp->Quirks() : "none");
serversM.Add(tmp); serversM.Add(tmp);
@ -352,6 +391,13 @@ cString cSatipDiscover::GetServerAddress(cSatipServer *serverP)
return serversM.GetAddress(serverP); return serversM.GetAddress(serverP);
} }
int cSatipDiscover::GetServerPort(cSatipServer *serverP)
{
debug16("%s", __PRETTY_FUNCTION__);
cMutexLock MutexLock(&mutexM);
return serversM.GetPort(serverP);
}
int cSatipDiscover::NumProvidedSystems(void) int cSatipDiscover::NumProvidedSystems(void)
{ {
debug16("%s", __PRETTY_FUNCTION__); debug16("%s", __PRETTY_FUNCTION__);

View File

@ -21,14 +21,16 @@
class cSatipDiscoverServer : public cListObject { class cSatipDiscoverServer : public cListObject {
private: private:
int ipPortM;
cString ipAddressM; cString ipAddressM;
cString descriptionM; cString descriptionM;
cString modelM; cString modelM;
public: public:
cSatipDiscoverServer(const char *ipAddressP, const char *modelP, const char *descriptionP) cSatipDiscoverServer(const char *ipAddressP, const int ipPortP, const char *modelP, const char *descriptionP)
{ {
ipAddressM = ipAddressP; modelM = modelP; descriptionM = descriptionP; ipAddressM = ipAddressP; ipPortM = ipPortP; modelM = modelP; descriptionM = descriptionP;
} }
int IpPort(void) { return ipPortM; }
const char *IpAddress(void) { return *ipAddressM; } const char *IpAddress(void) { return *ipAddressM; }
const char *Model(void) { return *modelM; } const char *Model(void) { return *modelM; }
const char *Description(void) { return *descriptionM; } const char *Description(void) { return *descriptionM; }
@ -47,9 +49,11 @@ private:
eCleanupTimeoutMs = 124000 // in milliseoonds eCleanupTimeoutMs = 124000 // in milliseoonds
}; };
static cSatipDiscover *instanceS; static cSatipDiscover *instanceS;
static size_t HeaderCallback(char *ptrP, size_t sizeP, size_t nmembP, void *dataP);
static size_t DataCallback(char *ptrP, size_t sizeP, size_t nmembP, void *dataP); static size_t DataCallback(char *ptrP, size_t sizeP, size_t nmembP, void *dataP);
static int DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, size_t sizeP, void *userPtrP); static int DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, size_t sizeP, void *userPtrP);
cMutex mutexM; cMutex mutexM;
cSatipMemoryBuffer headerBufferM;
cSatipMemoryBuffer dataBufferM; cSatipMemoryBuffer dataBufferM;
cSatipMsearch msearchM; cSatipMsearch msearchM;
cStringList probeUrlListM; cStringList probeUrlListM;
@ -59,8 +63,9 @@ private:
cSatipServers serversM; cSatipServers serversM;
void Activate(void); void Activate(void);
void Deactivate(void); void Deactivate(void);
void ParseDeviceInfo(const char *addrP); int ParseRtspPort(void);
void AddServer(const char *addrP, const char *modelP, const char *descP); void ParseDeviceInfo(const char *addrP, const int portP);
void AddServer(const char *addrP, const int portP, const char *modelP, const char *descP);
void Fetch(const char *urlP); void Fetch(const char *urlP);
// constructor // constructor
cSatipDiscover(); cSatipDiscover();
@ -88,6 +93,7 @@ public:
bool IsServerQuirk(cSatipServer *serverP, int quirkP); bool IsServerQuirk(cSatipServer *serverP, int quirkP);
bool HasServerCI(cSatipServer *serverP); bool HasServerCI(cSatipServer *serverP);
cString GetServerAddress(cSatipServer *serverP); cString GetServerAddress(cSatipServer *serverP);
int GetServerPort(cSatipServer *serverP);
cString GetServerList(void); cString GetServerList(void);
int NumProvidedSystems(void); int NumProvidedSystems(void);

14
satip.c
View File

@ -84,7 +84,7 @@ const char *cPluginSatip::CommandLineHelp(void)
// Return a string that describes all known command line options. // Return a string that describes all known command line options.
return " -d <num>, --devices=<number> set number of devices to be created\n" return " -d <num>, --devices=<number> set number of devices to be created\n"
" -t <mode>, --trace=<mode> set the tracing mode\n" " -t <mode>, --trace=<mode> set the tracing mode\n"
" -s <ipaddr>|<model>|<desc>, --server=<ipaddr1>|<model1>|<desc1>;<ipaddr2>|<model2>|<desc2>\n" " -s <ipaddr>|<model>|<desc>, --server=<ipaddr1>|<model1>|<desc1>;<ipaddr2:port>|<model2>|<desc2>\n"
" define hard-coded SAT>IP server(s)\n" " define hard-coded SAT>IP server(s)\n"
" -D, --detach set the detached mode on\n" " -D, --detach set the detached mode on\n"
" -S, --single set the single model server mode on\n" " -S, --single set the single model server mode on\n"
@ -233,6 +233,7 @@ void cPluginSatip::ParseServer(const char *paramP)
r = skipspace(r); r = skipspace(r);
debug3("%s server[%d]=%s", __PRETTY_FUNCTION__, n, r); debug3("%s server[%d]=%s", __PRETTY_FUNCTION__, n, r);
cString serverAddr, serverModel, serverDescription; cString serverAddr, serverModel, serverDescription;
int serverPort = SATIP_DEFAULT_RTSP_PORT;
int n2 = 0; int n2 = 0;
char *s2, *p2 = r; char *s2, *p2 = r;
char *r2 = strtok_r(p2, "|", &s2); char *r2 = strtok_r(p2, "|", &s2);
@ -240,7 +241,14 @@ void cPluginSatip::ParseServer(const char *paramP)
debug3("%s param[%d]=%s", __PRETTY_FUNCTION__, n2, r2); debug3("%s param[%d]=%s", __PRETTY_FUNCTION__, n2, r2);
switch (n2++) { switch (n2++) {
case 0: case 0:
{
serverAddr = r2; serverAddr = r2;
char *r3 = strchr(r2, ':');
if (r3) {
serverPort = strtol(r3 + 1, NULL, 0);
serverAddr = serverAddr.Truncate(r3 - r2);
}
}
break; break;
case 1: case 1:
serverModel = r2; serverModel = r2;
@ -254,10 +262,10 @@ void cPluginSatip::ParseServer(const char *paramP)
r2 = strtok_r(NULL, "|", &s2); r2 = strtok_r(NULL, "|", &s2);
} }
if (*serverAddr && *serverModel && *serverDescription) { if (*serverAddr && *serverModel && *serverDescription) {
debug1("%s ipaddr=%s model=%s desc=%s", __PRETTY_FUNCTION__, *serverAddr, *serverModel, *serverDescription); debug1("%s ipaddr=%s port=%d model=%s desc=%s", __PRETTY_FUNCTION__, *serverAddr, serverPort, *serverModel, *serverDescription);
if (!serversM) if (!serversM)
serversM = new cSatipDiscoverServers(); serversM = new cSatipDiscoverServers();
serversM->Add(new cSatipDiscoverServer(*serverAddr, *serverModel, *serverDescription)); serversM->Add(new cSatipDiscoverServer(*serverAddr, serverPort, *serverModel, *serverDescription));
} }
++n; ++n;
r = strtok_r(NULL, ";", &s); r = strtok_r(NULL, ";", &s);

View File

@ -80,11 +80,12 @@ bool cSatipFrontends::Detach(int deviceIdP, int transponderP)
// --- cSatipServer ----------------------------------------------------------- // --- cSatipServer -----------------------------------------------------------
cSatipServer::cSatipServer(const char *addressP, const char *modelP, const char *descriptionP) cSatipServer::cSatipServer(const char *addressP, const int portP, const char *modelP, const char *descriptionP)
: addressM((addressP && *addressP) ? addressP : "0.0.0.0"), : addressM((addressP && *addressP) ? addressP : "0.0.0.0"),
modelM((modelP && *modelP) ? modelP : "DVBS-1"), modelM((modelP && *modelP) ? modelP : "DVBS-1"),
descriptionM(!isempty(descriptionP) ? descriptionP : "MyBrokenHardware"), descriptionM(!isempty(descriptionP) ? descriptionP : "MyBrokenHardware"),
quirksM(""), quirksM(""),
portM(portP),
quirkM(eSatipQuirkNone), quirkM(eSatipQuirkNone),
hasCiM(false), hasCiM(false),
createdM(time(NULL)), createdM(time(NULL)),
@ -374,6 +375,18 @@ cString cSatipServers::GetAddress(cSatipServer *serverP)
return address; return address;
} }
int cSatipServers::GetPort(cSatipServer *serverP)
{
int port = SATIP_DEFAULT_RTSP_PORT;
for (cSatipServer *s = First(); s; s = Next(s)) {
if (s == serverP) {
port = s->Port();
break;
}
}
return port;
}
cString cSatipServers::GetString(cSatipServer *serverP) cString cSatipServers::GetString(cSatipServer *serverP)
{ {
cString list = ""; cString list = "";

View File

@ -59,6 +59,7 @@ private:
cString descriptionM; cString descriptionM;
cString quirksM; cString quirksM;
cSatipFrontends frontendsM[eSatipFrontendCount]; cSatipFrontends frontendsM[eSatipFrontendCount];
int portM;
int quirkM; int quirkM;
bool hasCiM; bool hasCiM;
time_t createdM; time_t createdM;
@ -72,7 +73,7 @@ public:
eSatipQuirkForceLock = 0x04, eSatipQuirkForceLock = 0x04,
eSatipQuirkMask = 0x0F eSatipQuirkMask = 0x0F
}; };
cSatipServer(const char *addressP, const char *modelP, const char *descriptionP); cSatipServer(const char *addressP, const int portP, const char *modelP, const char *descriptionP);
virtual ~cSatipServer(); virtual ~cSatipServer();
virtual int Compare(const cListObject &listObjectP) const; virtual int Compare(const cListObject &listObjectP) const;
bool Assign(int deviceIdP, int sourceP, int systemP, int transponderP); bool Assign(int deviceIdP, int sourceP, int systemP, int transponderP);
@ -89,6 +90,7 @@ public:
const char *Model(void) { return *modelM; } const char *Model(void) { return *modelM; }
const char *Description(void) { return *descriptionM; } const char *Description(void) { return *descriptionM; }
const char *Quirks(void) { return *quirksM; } const char *Quirks(void) { return *quirksM; }
int Port(void) { return portM; }
bool Quirk(int quirkP) { return ((quirkP & eSatipQuirkMask) & quirkM); } bool Quirk(int quirkP) { return ((quirkP & eSatipQuirkMask) & quirkM); }
bool HasQuirk(void) { return (quirkM != eSatipQuirkNone); } bool HasQuirk(void) { return (quirkM != eSatipQuirkNone); }
bool HasCI(void) { return hasCiM; } bool HasCI(void) { return hasCiM; }
@ -112,6 +114,7 @@ public:
void Cleanup(uint64_t intervalMsP = 0); void Cleanup(uint64_t intervalMsP = 0);
cString GetAddress(cSatipServer *serverP); cString GetAddress(cSatipServer *serverP);
cString GetString(cSatipServer *serverP); cString GetString(cSatipServer *serverP);
int GetPort(cSatipServer *serverP);
cString List(void); cString List(void);
int NumProvidedSystems(void); int NumProvidedSystems(void);
}; };

24
tuner.c
View File

@ -25,6 +25,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
rtcpM(*this), rtcpM(*this),
streamAddrM(""), streamAddrM(""),
streamParamM(""), streamParamM(""),
streamPortM(SATIP_DEFAULT_RTSP_PORT),
currentServerM(NULL, deviceP.GetId(), 0), currentServerM(NULL, deviceP.GetId(), 0),
nextServerM(NULL, deviceP.GetId(), 0), nextServerM(NULL, deviceP.GetId(), 0),
mutexM(), mutexM(),
@ -208,7 +209,7 @@ bool cSatipTuner::Connect(void)
debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
if (!isempty(*streamAddrM)) { if (!isempty(*streamAddrM)) {
cString connectionUri = cString::sprintf("rtsp://%s/", *streamAddrM); cString connectionUri = GetBaseUrl(*streamAddrM, streamPortM);
// Just retune // Just retune
if (streamIdM >= 0) { if (streamIdM >= 0) {
cString uri = cString::sprintf("%sstream=%d?%s", *connectionUri, streamIdM, *streamParamM); cString uri = cString::sprintf("%sstream=%d?%s", *connectionUri, streamIdM, *streamParamM);
@ -247,7 +248,7 @@ bool cSatipTuner::Disconnect(void)
debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
if (!isempty(*streamAddrM) && (streamIdM >= 0)) { if (!isempty(*streamAddrM) && (streamIdM >= 0)) {
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM); cString uri = cString::sprintf("%sstream=%d", *GetBaseUrl(*streamAddrM, streamPortM), streamIdM);
rtspM.Teardown(*uri); rtspM.Teardown(*uri);
// some devices requires a teardown for TCP connection also // some devices requires a teardown for TCP connection also
rtspM.Reset(); rtspM.Reset();
@ -362,6 +363,16 @@ void cSatipTuner::SetSessionTimeout(const char *sessionP, int timeoutP)
timeoutM = (timeoutP > eMinKeepAliveIntervalMs) ? timeoutP : eMinKeepAliveIntervalMs; timeoutM = (timeoutP > eMinKeepAliveIntervalMs) ? timeoutP : eMinKeepAliveIntervalMs;
} }
cString cSatipTuner::GetBaseUrl(const char *addressP, const int portP)
{
debug16("%s (%s, %d) [device %d]", __PRETTY_FUNCTION__, addressP, portP, deviceIdM);
if (portP != SATIP_DEFAULT_RTSP_PORT)
return cString::sprintf("rtsp://%s:%d/", addressP, portP);
return cString::sprintf("rtsp://%s/", addressP);
}
int cSatipTuner::GetId(void) int cSatipTuner::GetId(void)
{ {
debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
@ -378,6 +389,7 @@ bool cSatipTuner::SetSource(cSatipServer *serverP, const int transponderP, const
// Update stream address and parameter // Update stream address and parameter
streamAddrM = rtspM.RtspUnescapeString(*nextServerM.GetAddress()); streamAddrM = rtspM.RtspUnescapeString(*nextServerM.GetAddress());
streamParamM = rtspM.RtspUnescapeString(parameterP); streamParamM = rtspM.RtspUnescapeString(parameterP);
streamPortM = nextServerM.GetPort();
// Reconnect // Reconnect
RequestState(tsSet, smExternal); RequestState(tsSet, smExternal);
} }
@ -416,7 +428,7 @@ bool cSatipTuner::UpdatePids(bool forceP)
cMutexLock MutexLock(&mutexM); cMutexLock MutexLock(&mutexM);
if (((forceP && pidsM.Size()) || (pidUpdateCacheM.TimedOut() && (addPidsM.Size() || delPidsM.Size()))) && if (((forceP && pidsM.Size()) || (pidUpdateCacheM.TimedOut() && (addPidsM.Size() || delPidsM.Size()))) &&
!isempty(*streamAddrM) && (streamIdM > 0)) { !isempty(*streamAddrM) && (streamIdM > 0)) {
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM); cString uri = cString::sprintf("%sstream=%d", *GetBaseUrl(*streamAddrM, streamPortM), streamIdM);
bool useci = (SatipConfig.GetCIExtension() && currentServerM.HasCI()); bool useci = (SatipConfig.GetCIExtension() && currentServerM.HasCI());
bool usedummy = currentServerM.IsQuirk(cSatipServer::eSatipQuirkPlayPids); bool usedummy = currentServerM.IsQuirk(cSatipServer::eSatipQuirkPlayPids);
if (forceP || usedummy) { if (forceP || usedummy) {
@ -466,7 +478,7 @@ bool cSatipTuner::KeepAlive(bool forceP)
forceP = true; forceP = true;
} }
if (forceP && !isempty(*streamAddrM)) { if (forceP && !isempty(*streamAddrM)) {
cString uri = cString::sprintf("rtsp://%s/", *streamAddrM); cString uri = GetBaseUrl(*streamAddrM, streamPortM);
if (!rtspM.Options(*uri)) if (!rtspM.Options(*uri))
return false; return false;
} }
@ -483,7 +495,7 @@ bool cSatipTuner::ReadReceptionStatus(bool forceP)
forceP = true; forceP = true;
} }
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("%sstream=%d", *GetBaseUrl(*streamAddrM, streamPortM), streamIdM);
if (rtspM.Describe(*uri)) if (rtspM.Describe(*uri))
return true; return true;
} }
@ -618,5 +630,5 @@ cString cSatipTuner::GetSignalStatus(void)
cString cSatipTuner::GetInformation(void) cString cSatipTuner::GetInformation(void)
{ {
debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM); debug16("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
return (currentStateM >= tsTuned) ? cString::sprintf("rtsp://%s/?%s [stream=%d]", *streamAddrM, *streamParamM, streamIdM) : "connection failed"; return (currentStateM >= tsTuned) ? cString::sprintf("%s?%s [stream=%d]", *GetBaseUrl(*streamAddrM, streamPortM), *streamParamM, streamIdM) : "connection failed";
} }

View File

@ -69,6 +69,7 @@ public:
void Set(cSatipServer *serverP, const int transponderP) { serverM = serverP; transponderM = transponderP; } void Set(cSatipServer *serverP, const int transponderP) { serverM = serverP; transponderM = transponderP; }
void Reset(void) { serverM = NULL; transponderM = 0; } void Reset(void) { serverM = NULL; transponderM = 0; }
cString GetAddress(void) { return serverM ? cSatipDiscover::GetInstance()->GetServerAddress(serverM) : ""; } cString GetAddress(void) { return serverM ? cSatipDiscover::GetInstance()->GetServerAddress(serverM) : ""; }
int GetPort(void) { return serverM ? cSatipDiscover::GetInstance()->GetServerPort(serverM) : SATIP_DEFAULT_RTSP_PORT; }
cString GetInfo(void) { return cString::sprintf("server=%s deviceid=%d transponder=%d", serverM ? "assigned" : "null", deviceIdM, transponderM); } cString GetInfo(void) { return cString::sprintf("server=%s deviceid=%d transponder=%d", serverM ? "assigned" : "null", deviceIdM, transponderM); }
}; };
@ -98,6 +99,7 @@ private:
cSatipRtcp rtcpM; cSatipRtcp rtcpM;
cString streamAddrM; cString streamAddrM;
cString streamParamM; cString streamParamM;
int streamPortM;
cSatipTunerServer currentServerM; cSatipTunerServer currentServerM;
cSatipTunerServer nextServerM; cSatipTunerServer nextServerM;
cMutex mutexM; cMutex mutexM;
@ -130,6 +132,7 @@ private:
bool RequestState(eTunerState stateP, eStateMode modeP); bool RequestState(eTunerState stateP, eStateMode modeP);
const char *StateModeString(eStateMode modeP); const char *StateModeString(eStateMode modeP);
const char *TunerStateString(eTunerState stateP); const char *TunerStateString(eTunerState stateP);
cString GetBaseUrl(const char *addressP, const int portP);
protected: protected:
virtual void Action(void); virtual void Action(void);