From f2081c4f007de836f41225429ba0dc28bfcd6ee2 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Sun, 6 Apr 2014 13:37:45 +0300 Subject: [PATCH] Fixed the OPTIONS URL and enchanced the user agent string. --- device.c | 6 ++++++ device.h | 1 + deviceif.h | 1 + tuner.c | 10 ++++++---- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/device.c b/device.c index 7c59fbb..e19b260 100644 --- a/device.c +++ b/device.c @@ -381,6 +381,12 @@ unsigned int cSatipDevice::CheckData(void) return 0; } +int cSatipDevice::GetId(void) +{ + //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); + return deviceIndexM; +} + uchar *cSatipDevice::GetData(int *availableP) { //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM); diff --git a/device.h b/device.h index 53c7873..4e0cc1c 100644 --- a/device.h +++ b/device.h @@ -107,6 +107,7 @@ public: public: virtual void WriteData(u_char *bufferP, int lengthP); virtual unsigned int CheckData(void); + virtual int GetId(void); }; #endif // __SATIP_DEVICE_H diff --git a/deviceif.h b/deviceif.h index 36774fb..db60d32 100644 --- a/deviceif.h +++ b/deviceif.h @@ -14,6 +14,7 @@ public: virtual ~cSatipDeviceIf() {} virtual void WriteData(u_char *bufferP, int lengthP) = 0; virtual unsigned int CheckData(void) = 0; + virtual int GetId(void) = 0; private: cSatipDeviceIf(const cSatipDeviceIf&); diff --git a/tuner.c b/tuner.c index e796f54..f676eb6 100644 --- a/tuner.c +++ b/tuner.c @@ -205,7 +205,7 @@ bool cSatipTuner::Connect(void) SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_CONNECTTIMEOUT_MS, (long)eConnectTimeoutMs); // Set user-agent - SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_USERAGENT, *cString::sprintf("vdr-%s/%s", PLUGIN_NAME_I18N, VERSION)); + SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_USERAGENT, *cString::sprintf("vdr-%s/%s (device %d)", PLUGIN_NAME_I18N, VERSION, deviceM->GetId())); // Set URL char *p = curl_easy_unescape(handleM, *streamAddrM, 0, NULL); @@ -227,16 +227,18 @@ bool cSatipTuner::Connect(void) return false; } - // Request server options: "&pids=all" for the whole mux + // Request server options keepAliveM.Set(timeoutM); - uri = cString::sprintf("rtsp://%s/?%s&pids=0", *streamAddrM, *streamParamM); + uri = cString::sprintf("rtsp://%s/", *streamAddrM); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_STREAM_URI, *uri); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_OPTIONS); SATIP_CURL_EASY_PERFORM(handleM); if (!ValidateLatestResponse()) return false; - // Setup media stream + // Setup media stream: "&pids=all" for the whole mux + uri = cString::sprintf("rtsp://%s/?%s&pids=0", *streamAddrM, *streamParamM); + SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_STREAM_URI, *uri); transport = cString::sprintf("RTP/AVP;unicast;client_port=%d-%d", rtpSocketM->Port(), rtcpSocketM->Port()); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_TRANSPORT, *transport); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_SETUP);