[FFmpeg-devel] [PATCH] lavf/http.c: Add listen_timeout option.

Stephan Holljes klaxa1337 at googlemail.com
Tue Oct 18 03:09:43 EEST 2016


---
 libavformat/http.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index d48958d..3b0d6ab 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -115,6 +115,7 @@ typedef struct HTTPContext {
     int reconnect_delay;
     int reconnect_delay_max;
     int listen;
+    int listen_timeout;
     char *resource;
     int reply_code;
     int is_multi_client;
@@ -158,6 +159,7 @@ static const AVOption options[] = {
     { "reconnect_streamed", "auto reconnect streamed / non seekable streams", OFFSET(reconnect_streamed), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, D },
     { "reconnect_delay_max", "max reconnect delay in seconds after which to give up", OFFSET(reconnect_delay_max), AV_OPT_TYPE_INT, { .i64 = 120 }, 0, UINT_MAX/1000/1000, D },
     { "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, D | E },
+    { "listen_timeout",  "Connection awaiting timeout (in milliseconds)",      OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1 },         -1, INT_MAX, .flags = D|E },
     { "resource", "The resource requested by a client", OFFSET(resource), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
     { "reply_code", "The http status code to return to a client", OFFSET(reply_code), AV_OPT_TYPE_INT, { .i64 = 200}, INT_MIN, 599, E},
     { NULL }
@@ -463,6 +465,9 @@ static int http_listen(URLContext *h, const char *uri, int flags,
                 NULL);
     if ((ret = av_dict_set_int(options, "listen", s->listen, 0)) < 0)
         goto fail;
+    if ((ret = av_dict_set_int(options, "listen_timeout", s->listen_timeout, 0)) < 0)
+        goto fail;
+
     if ((ret = ffurl_open_whitelist(&s->hd, lower_url, AVIO_FLAG_READ_WRITE,
                                     &h->interrupt_callback, options,
                                     h->protocol_whitelist, h->protocol_blacklist, h
-- 
2.5.5



More information about the ffmpeg-devel mailing list