summaryrefslogtreecommitdiff
path: root/libavformat/tcp.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2013-12-24 16:48:45 +0100
committerStefano Sabatini <stefasab@gmail.com>2013-12-25 18:42:20 +0100
commit702d9a23b3d3309fbc7bc7b09ac3271c42dc72dc (patch)
treefcbd70b310973a9c6396b1206e843c3fbc57a90d /libavformat/tcp.c
parentb80cf460903ff69ab62e8f4db95a58675f61e767 (diff)
lavf/tcp: honor listen option value in a tag
Consistent with what is done in udp.c, allow to explicitly disable listen with listen=0.
Diffstat (limited to 'libavformat/tcp.c')
-rw-r--r--libavformat/tcp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 634d99d0d0..07026e3ede 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -79,8 +79,13 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
}
p = strchr(uri, '?');
if (p) {
- if (av_find_info_tag(buf, sizeof(buf), "listen", p))
- s->listen = 1;
+ if (av_find_info_tag(buf, sizeof(buf), "listen", p)) {
+ char *endptr = NULL;
+ s->listen = strtol(buf, &endptr, 10);
+ /* assume if no digits were found it is a request to enable it */
+ if (buf == endptr)
+ s->listen = 1;
+ }
if (av_find_info_tag(buf, sizeof(buf), "timeout", p)) {
s->rw_timeout = strtol(buf, NULL, 10);
}