From 9f2d99435d612709c3bcb59510f07ec7c8e065e7 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Sun, 23 Mar 2014 17:59:08 +0200 Subject: [PATCH] Added support for cDevice::Ready() and preliminary RTP packet sequence check. --- HISTORY | 4 ++++ README | 3 +++ device.c | 6 ++++++ device.h | 1 + discover.c | 7 +++++++ discover.h | 1 + po/de_DE.po | 2 +- po/fi_FI.po | 2 +- satip.c | 2 +- server.c | 4 ++-- socket.c | 9 ++++++++- socket.h | 1 + tuner.c | 2 +- 13 files changed, 37 insertions(+), 7 deletions(-) diff --git a/HISTORY b/HISTORY index 69fded5..cd203eb 100644 --- a/HISTORY +++ b/HISTORY @@ -19,3 +19,7 @@ VDR Plugin 'satip' Revision History - Refactored the session code. - Fixed EIT scan functionality. - Updated for vdr-2.1.6. + +2014-xx-xx: Version 0.2.0 + +- Added support for cDevice::Ready(). diff --git a/README b/README index 7a04940..1692f8b 100644 --- a/README +++ b/README @@ -112,6 +112,9 @@ Notes: patched VDR providing channel configuration for pilot, T2 system id, and SISO/MISO values. +- If you're using Triax TSS400, you'll need the libcurl from 2013-03-20 + or newer. + Acknowledgements: - Big thanks to Digital Devices GmbH for providing the Octopus Net diff --git a/device.c b/device.c index 4d48e24..b24f699 100644 --- a/device.c +++ b/device.c @@ -144,6 +144,12 @@ cString cSatipDevice::GetInformation(unsigned int pageP) return s; } +bool cSatipDevice::Ready(void) +{ + //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + return (cSatipDiscover::GetInstance()->GetServerCount() > 0); +} + cString cSatipDevice::DeviceType(void) const { //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); diff --git a/device.h b/device.h index f086e37..0514448 100644 --- a/device.h +++ b/device.h @@ -54,6 +54,7 @@ private: // for channel info public: + virtual bool Ready(void); virtual cString DeviceType(void) const; virtual cString DeviceName(void) const; virtual bool AvoidRecording(void) const; diff --git a/discover.c b/discover.c index 167df3a..fcaa9d0 100644 --- a/discover.c +++ b/discover.c @@ -251,6 +251,13 @@ void cSatipDiscover::AddServer(const char *addrP, const char *descP, const char } } +int cSatipDiscover::GetServerCount(void) +{ + //debug("cSatipDiscover::%s()", __FUNCTION__); + cMutexLock MutexLock(&mutexM); + return serversM ? serversM->Count() : -1; +} + cSatipServer *cSatipDiscover::GetServer(int sourceP, int systemP) { //debug("cSatipDiscover::%s(%d, %d)", __FUNCTION__, sourceP, systemP); diff --git a/discover.h b/discover.h index f49f085..8b34a59 100644 --- a/discover.h +++ b/discover.h @@ -56,6 +56,7 @@ public: static void Destroy(void); virtual ~cSatipDiscover(); void TriggerScan(void) { probeIntervalM.Set(0); } + int GetServerCount(void); cSatipServer *GetServer(int sourceP, int systemP = -1); cSatipServer *GetServer(cSatipServer *serverP); cSatipServers *GetServers(void); diff --git a/po/de_DE.po b/po/de_DE.po index 95ccfce..a3dbb6e 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: vdr-satip 0.1.1\n" +"Project-Id-Version: vdr-satip 0.2.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2014-03-16 03:16+0200\n" "PO-Revision-Date: 2014-03-16 03:16+0200\n" diff --git a/po/fi_FI.po b/po/fi_FI.po index de790de..b3c7b95 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: vdr-satip 0.1.1\n" +"Project-Id-Version: vdr-satip 0.2.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2014-03-16 03:16+0200\n" "PO-Revision-Date: 2014-03-16 03:16+0200\n" diff --git a/satip.c b/satip.c index 58d2641..894b30f 100644 --- a/satip.c +++ b/satip.c @@ -21,7 +21,7 @@ #define GITVERSION "" #endif - const char VERSION[] = "0.1.1" GITVERSION; + const char VERSION[] = "0.2.0" GITVERSION; static const char DESCRIPTION[] = trNOOP("SAT>IP Devices"); class cPluginSatip : public cPlugin { diff --git a/server.c b/server.c index 126ed3d..1ad111f 100644 --- a/server.c +++ b/server.c @@ -149,7 +149,7 @@ cString cSatipServers::GetString(cSatipServer *serverP) cString list = ""; for (cSatipServer *s = First(); s; s = Next(s)) { if (s == serverP) { - list = cString::sprintf("%s:%s:%s", s->Address(), s->Model(), s->Description()); + list = cString::sprintf("%s|%s|%s", s->Address(), s->Model(), s->Description()); break; } } @@ -160,7 +160,7 @@ cString cSatipServers::List(void) { cString list = ""; for (cSatipServer *s = First(); s; s = Next(s)) - list = cString::sprintf("%s%s:%s:%s\n", *list, s->Address(), s->Model(), s->Description()); + list = cString::sprintf("%s%s|%s|%s\n", *list, s->Address(), s->Model(), s->Description()); return list; } diff --git a/socket.c b/socket.c index bccd32e..bd79e58 100644 --- a/socket.c +++ b/socket.c @@ -20,7 +20,8 @@ cSatipSocket::cSatipSocket() : socketPortM(0), - socketDescM(-1) + socketDescM(-1), + sequenceNumberM(-1) { debug("cSatipSocket::%s()", __FUNCTION__); memset(&sockAddrM, 0, sizeof(sockAddrM)); @@ -72,6 +73,7 @@ void cSatipSocket::Close(void) close(socketDescM); socketDescM = -1; socketPortM = 0; + sequenceNumberM = -1; memset(&sockAddrM, 0, sizeof(sockAddrM)); } } @@ -150,6 +152,11 @@ int cSatipSocket::ReadVideo(unsigned char *bufferAddrP, unsigned int bufferLenP) unsigned int cc = bufferAddrP[0] & 0x0F; // Payload type: MPEG2 TS = 33 //unsigned int pt = bufferAddrP[1] & 0x7F; + // Sequence number + int seq = ((bufferAddrP[2] & 0xFF) << 8) | (bufferAddrP[3] & 0xFF); + if ((sequenceNumberM >= 0) && (((sequenceNumberM + 1) % 0xFFFF) != seq)) + error("missed %d RTP packets", seq - sequenceNumberM - 1); + sequenceNumberM = seq; // Header lenght unsigned int headerlen = (3 + cc) * (unsigned int)sizeof(uint32_t); // Check if extension diff --git a/socket.h b/socket.h index 6e39eb5..41b1ecd 100644 --- a/socket.h +++ b/socket.h @@ -15,6 +15,7 @@ private: int socketPortM; int socketDescM; struct sockaddr_in sockAddrM; + int sequenceNumberM; public: cSatipSocket(); diff --git a/tuner.c b/tuner.c index dcbe15f..004c395 100644 --- a/tuner.c +++ b/tuner.c @@ -247,7 +247,7 @@ bool cSatipTuner::Connect(void) // Start playing uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_STREAM_URI, *uri); - SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_SESSION_ID, *sessionM); + //SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_SESSION_ID, *sessionM); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_PLAY); SATIP_CURL_EASY_PERFORM(handleM); if (!ValidateLatestResponse())