aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/tls.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2014-10-09 21:34:54 +0200
committerLuca Barbato <lu_zero@gentoo.org>2014-10-10 16:29:07 +0200
commitcd9d6399fd00f5aeacaa90cdc0b74c3570024119 (patch)
treee0ffd2b83a7590f18c30d6b85c05381ccdf57cbd /libavformat/tls.c
parent3df8d52fcdc9036b4074fdc612d487ece8bb5b7f (diff)
downloadffmpeg-cd9d6399fd00f5aeacaa90cdc0b74c3570024119.tar.gz
tls: Support passing old-style tcp options
Make tcp and tls urls near-interchangeable.
Diffstat (limited to 'libavformat/tls.c')
-rw-r--r--libavformat/tls.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libavformat/tls.c b/libavformat/tls.c
index 7c78fda285..817aedc239 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -142,6 +142,7 @@ static int tls_open(URLContext *h, const char *uri, int flags)
TLSContext *c = h->priv_data;
int ret;
int port;
+ const char *p;
char buf[200], host[200], opts[50] = "";
int numerichost = 0;
struct addrinfo hints = { 0 }, *ai = NULL;
@@ -154,7 +155,17 @@ static int tls_open(URLContext *h, const char *uri, int flags)
snprintf(opts, sizeof(opts), "?listen=1");
av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port, NULL, 0, uri);
- ff_url_join(buf, sizeof(buf), "tcp", NULL, host, port, "%s", opts);
+
+ p = strchr(uri, '?');
+
+ if (!p) {
+ p = opts;
+ } else {
+ if (av_find_info_tag(opts, sizeof(opts), "listen", p))
+ c->listen = 1;
+ }
+
+ ff_url_join(buf, sizeof(buf), "tcp", NULL, host, port, "%s", p);
hints.ai_flags = AI_NUMERICHOST;
if (!getaddrinfo(host, NULL, &hints, &ai)) {