From: Karthick Jeyapal <kjeya...@akamai.com> Right now there is no explicit way to signal end of chunk, when http_multiple is set. ff_http_do_new_request() function implicitly signals end of chunk. But that could be too late for certain applications. Hence added a new function ff_http_signal_end_of_chunk() which could be used internally within libavformat. --- libavformat/http.c | 17 ++++++++++++++--- libavformat/http.h | 9 +++++++++ 2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/libavformat/http.c b/libavformat/http.c index cf86adc..d8224de 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -307,9 +307,11 @@ int ff_http_do_new_request(URLContext *h, const char *uri) AVDictionary *options = NULL; int ret; - ret = http_shutdown(h, h->flags); - if (ret < 0) - return ret; + if (!s->end_chunked_post) { + ret = http_shutdown(h, h->flags); + if (ret < 0) + return ret; + } s->end_chunked_post = 0; s->chunkend = 0; @@ -325,6 +327,15 @@ int ff_http_do_new_request(URLContext *h, const char *uri) return ret; } +int ff_http_signal_end_of_chunk(URLContext *h) { + HTTPContext *s = h->priv_data; + int ret = 0; + if (!s->end_chunked_post) { + ret = http_shutdown(h, h->flags); + } + return ret; +} + int ff_http_averror(int status_code, int default_averror) { switch (status_code) { diff --git a/libavformat/http.h b/libavformat/http.h index 7d02713..0eaeb48 100644 --- a/libavformat/http.h +++ b/libavformat/http.h @@ -47,6 +47,15 @@ void ff_http_init_auth_state(URLContext *dest, const URLContext *src); */ int ff_http_do_new_request(URLContext *h, const char *uri); +/** + * Send a end of chunk signal(sends a string "0\r\n\r\n"), if applicable. + * + * @param h pointer to the resource + * @return a negative value if an error condition occurred, 0 + * otherwise + */ +int ff_http_signal_end_of_chunk(URLContext *h); + int ff_http_averror(int status_code, int default_averror); #endif /* AVFORMAT_HTTP_H */ -- 1.9.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel