aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-10 21:28:50 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-10 21:29:10 +0200
commit7028475f75336a11ca7bbfd30405d342eaa63354 (patch)
tree5b5765448ed3ffba7a02bae983e6aee3e8cf340a
parentc9791925a1bfad19d47a3ca611c5f1b602d67c16 (diff)
parentc839b0439f0b01c72a6d253920d2e342b30f8bcb (diff)
downloadffmpeg-7028475f75336a11ca7bbfd30405d342eaa63354.tar.gz
Merge commit 'c839b0439f0b01c72a6d253920d2e342b30f8bcb'
* commit 'c839b0439f0b01c72a6d253920d2e342b30f8bcb': rtsp: Support tls when in listen mode Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/rtspdec.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index bb27a76763..39fe1da4d1 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -611,10 +611,12 @@ int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply)
static int rtsp_listen(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
- char host[128], path[512], auth[128];
+ char proto[128], host[128], path[512], auth[128];
char uri[500];
int port;
+ int default_port = RTSP_DEFAULT_PORT;
char tcpname[500];
+ const char *lower_proto = "tcp";
unsigned char rbuf[4096];
unsigned char method[10];
int rbuflen = 0;
@@ -622,18 +624,23 @@ static int rtsp_listen(AVFormatContext *s)
enum RTSPMethod methodcode;
/* extract hostname and port */
- av_url_split(NULL, 0, auth, sizeof(auth), host, sizeof(host), &port,
- path, sizeof(path), s->filename);
+ av_url_split(proto, sizeof(proto), auth, sizeof(auth), host, sizeof(host),
+ &port, path, sizeof(path), s->filename);
/* ff_url_join. No authorization by now (NULL) */
- ff_url_join(rt->control_uri, sizeof(rt->control_uri), "rtsp", NULL, host,
+ ff_url_join(rt->control_uri, sizeof(rt->control_uri), proto, NULL, host,
port, "%s", path);
+ if (!strcmp(proto, "rtsps")) {
+ lower_proto = "tls";
+ default_port = RTSPS_DEFAULT_PORT;
+ }
+
if (port < 0)
- port = RTSP_DEFAULT_PORT;
+ port = default_port;
/* Create TCP connection */
- ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port,
+ ff_url_join(tcpname, sizeof(tcpname), lower_proto, NULL, host, port,
"?listen&listen_timeout=%d", rt->initial_timeout * 1000);
if (ret = ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,