From 29eaf994f826a3cb9f4d67e51c12bde3f656a571 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Sun, 21 Dec 2014 16:31:38 +0200 Subject: [PATCH] Added a multicast mode for the RTSP setup. --- rtsp.c | 15 ++++++++++++++- rtsp.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/rtsp.c b/rtsp.c index fdf22aa..e437d6b 100644 --- a/rtsp.c +++ b/rtsp.c @@ -15,6 +15,7 @@ cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP) : tunerM(tunerP), + modeM(cmUnicast), handleM(NULL), headerListM(NULL) { @@ -191,10 +192,22 @@ bool cSatipRtsp::Setup(const char *uriP, int rtpPortP, int rtcpPortP) bool result = false; if (handleM && !isempty(uriP)) { + cString transport; long rc = 0; cTimeMs processing(0); CURLcode res = CURLE_OK; - cString transport = cString::sprintf("RTP/AVP;unicast;client_port=%d-%d", rtpPortP, rtcpPortP); + + switch (modeM) { + case cmMulticast: + // RTP/AVP;multicast;destination=;port=-;ttl= + transport = cString::sprintf("RTP/AVP;multicast;port=%d-%d", rtpPortP, rtcpPortP); + break; + default: + case cmUnicast: + // RTP/AVP;unicast;client_port=- + transport = cString::sprintf("RTP/AVP;unicast;client_port=%d-%d", rtpPortP, rtcpPortP); + break; + } // Setup media stream SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_STREAM_URI, uriP); diff --git a/rtsp.h b/rtsp.h index 659c644..1d1be4d 100644 --- a/rtsp.h +++ b/rtsp.h @@ -26,8 +26,10 @@ private: enum { eConnectTimeoutMs = 1500, // in milliseconds }; + enum eCommunicationMode { cmUnicast, cmMulticast }; cSatipTunerIf &tunerM; + eCommunicationMode modeM; CURL *handleM; struct curl_slist *headerListM;