RTSP client: handle also different RTSP port than 554

This commit is contained in:
Jaroslav Kysela 2015-03-03 16:00:33 +01:00
parent 1c9b527011
commit cbf1b15d00

View 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);
}