diff options
author | Steven Liu <lq@chinaffmpeg.org> | 2019-08-30 07:14:27 +0800 |
---|---|---|
committer | Steven Liu <lq@chinaffmpeg.org> | 2019-09-06 10:26:16 +0800 |
commit | 6c593fee6335b8dda62eaa54d40504aa366b0696 (patch) | |
tree | 67eedd5b1b1417feb78252d54405ca354ca038ee /libavformat/http.c | |
parent | 2b66c757d6aa3a9feee4d25b587becd366c868f1 (diff) | |
download | ffmpeg-6c593fee6335b8dda62eaa54d40504aa366b0696.tar.gz |
avformat/http: add ff_http_get_shutdown_status api for check the status of shutdown
this function is used to get the previous shutdown status
when reusing the old connection in block mode.
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavformat/http.c')
-rw-r--r-- | libavformat/http.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libavformat/http.c b/libavformat/http.c index 579debcd35..71dd6c2b1f 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -304,6 +304,22 @@ fail: return location_changed; return ff_http_averror(s->http_code, AVERROR(EIO)); } +int ff_http_get_shutdown_status(URLContext *h) +{ + int ret = 0; + HTTPContext *s = h->priv_data; + + /* flush the receive buffer when it is write only mode */ + char buf[1024]; + int read_ret; + read_ret = ffurl_read(s->hd, buf, sizeof(buf)); + if (read_ret < 0) { + ret = read_ret; + } + + return ret; +} + int ff_http_do_new_request(URLContext *h, const char *uri) { |