From: Jaroslav Kysela Date: Tue, 3 Mar 2015 15:00:33 +0000 (+0100) Subject: RTSP client: handle also different RTSP port than 554 X-Git-Tag: v4.1~305 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cbf1b15d00e699671ce92b43612d8eb13d5fbb31;p=thirdparty%2Ftvheadend.git RTSP client: handle also different RTSP port than 554 --- diff --git a/src/rtsp.c b/src/rtsp.c index 54ec03861..c453b7e99 100644 --- a/src/rtsp.c +++ b/src/rtsp.c @@ -33,8 +33,11 @@ rtsp_send( http_client_t *hc, http_cmd_t cmd, http_arg_list_t *hdr ) { http_arg_list_t h; - size_t blen = 7 + strlen(hc->hc_host) + (path ? strlen(path) : 1) + 1; + size_t blen = 7 + strlen(hc->hc_host) + + (hc->hc_port != 554 ? 7 : 0) + + (path ? strlen(path) : 1) + 1; char *buf = alloca(blen); + char buf2[7]; if (hc->hc_rtsp_session) { if (hdr == NULL) { @@ -43,7 +46,11 @@ rtsp_send( http_client_t *hc, http_cmd_t cmd, } http_arg_set(hdr, "Session", hc->hc_rtsp_session); } - snprintf(buf, blen, "rtsp://%s%s", hc->hc_host, path ? path : "/"); + if (hc->hc_port != 554) + snprintf(buf2, sizeof(buf2), ":%d", hc->hc_port); + else + buf2[0] = '\0'; + snprintf(buf, blen, "rtsp://%s%s%s", hc->hc_host, buf2, path ? path : "/"); return http_client_send(hc, cmd, buf, query, hdr, NULL, 0); }