]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
RTSP client: handle also different RTSP port than 554
authorJaroslav Kysela <perex@perex.cz>
Tue, 3 Mar 2015 15:00:33 +0000 (16:00 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 11 Mar 2015 20:41:12 +0000 (21:41 +0100)
src/rtsp.c

index 54ec03861d508a79f87734545eab6956fe31bfc7..c453b7e99ab773c37d6faf7738266a67a0fdf3e7 100644 (file)
@@ -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);
 }