From patchwork Fri Dec 22 07:04:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jeyapal, Karthick" X-Patchwork-Id: 6903 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.79.195 with SMTP id r64csp1939111jad; Thu, 21 Dec 2017 23:05:15 -0800 (PST) X-Google-Smtp-Source: ACJfBovufbZDUrnqYaG0nJQJgxJJGwA/oav0xOTLx7p8UZq+QfS5IEVuLEkmp8g9rpZqISNt9GpR X-Received: by 10.223.174.174 with SMTP id y43mr13905985wrc.196.1513926315691; Thu, 21 Dec 2017 23:05:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513926315; cv=none; d=google.com; s=arc-20160816; b=TdMGWuOfRDUINe7bGF81GlryWc3XvuktxRWZNyvgTr7ppiPo5zrnmm6C5SkPeJv382 UjJPOlagQ7r1W0ex+ENbBSDIcNV5MMkqXhSCGnJUx6XD0nUgRgWYVFOXDjImHUYjYSQ2 iIR69PWSwY6VVyJ9NVtHauNK0VFqaiZWfMytF6e0G349nCug7/KqN1jFuZbCuJnwLOms UzzTW1NqCcZUxcGjY543E/23zbr3sH/nd6IXryJJzA1qT1I9ZF2COBxmU8q3EaNeaSvV CqYKC1MLrHWRCyJRnvo9O2UIxQUC8baQRi6ffPvLD08pO7T40L8QeMWN78hvPC9CEeVL MkpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:message-id:date:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=pstDl27mywBKoovdvJvatOpCtR4ZVB/AAjZZ9evYucs=; b=zpiY8LzXoz6iqx3P/XYgmhHChctTbEIavNKZrqbjY9bgt7MEiFEtxmkde6a1I8pw/h s6eXT58gVqRh9ufXemHmLdznlOFvYA0AE+itPHmcquadXMkn06OSk12Rx+oGz59jn4qy TrMcDjIBVBMd1NX2l/YUy5E7CRACB5clFAVpMzgDx6yiGgl5kpO7N77tO/H6+VeojLGE yHGjr8aQACSjMUIWMYHZjszb8Dc9FovFbUEt1qH0plVONHqXi7d7wDlbF0qFj75hVvjy 8ULyARQzNKJfoOVgiBp6BYlfW0YsDun7XqJBSbGc8GprufUFh65gHYS3V1wsjp2JRwSR 4Egw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@smtpservice.net header.s=m78bu0.a1-4.dyn header.b=gBI6oSh9; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a138si7861830wma.5.2017.12.21.23.05.15; Thu, 21 Dec 2017 23:05:15 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@smtpservice.net header.s=m78bu0.a1-4.dyn header.b=gBI6oSh9; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8B6F3687989; Fri, 22 Dec 2017 09:04:52 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from a2i831.smtp2go.com (a2i831.smtp2go.com [103.47.207.63]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 14B86680D26 for ; Fri, 22 Dec 2017 09:04:46 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpservice.net; s=m78bu0.a1-4.dyn; x=1513927203; h=Feedback-ID: X-Smtpcorp-Track:Message-Id:Date:Subject:To:From:Reply-To:Sender: List-Unsubscribe; bh=ZCalsR33Je9VA/glV42EZ+6E7ybJKEOHDlgsYz7C8M0=; b=gBI6oSh9 BJ6xSMPRY3DUyEhPL1dXVn0JE/TP81oF96jwcfIwA9jlbe/c7AGqYxAZX/9hoJPqOzke5zdi2dzaz RceXna8SAn8MwrvJMcM+lboCvEr+H9nht4NIoR+OA/ZuRpSksXKsqU18Gw/yInun+ntPfQfZQ4Chl icP+EeI3Alxfymjm+u61NWfBnl8YhDMbiR391Z1Y6H5gQJt+kDRd0PKzejIKIF0ZFyP/AvOy7wrKw /YhcJTVcZxi38TDHv4CkAQ+8wLECumL06QeaidDDdbFRSuHfr7NlsW2oVmIYBkwrn2IRAoMv9ICcj p3Q+CQgiU3ewfbIyC+gU287+UA==; From: Karthick J To: ffmpeg-devel@ffmpeg.org Date: Fri, 22 Dec 2017 12:34:41 +0530 Message-Id: <1513926282-21191-1-git-send-email-kjeyapal@akamai.com> X-Mailer: git-send-email 1.9.1 X-Smtpcorp-Track: 1-SHO1RyIR55FC.eO6lPo9tz Feedback-ID: 337386m:337386asVRLGB:337386sCMJoC_iE6:SMTPCORP X-Report-Abuse: Please forward a copy of this message, including all headers, to Subject: [FFmpeg-devel] [PATCH 1/2] avformat/http: Added a library-internal API for signalling end of chunk X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Karthick Jeyapal MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Karthick Jeyapal 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 */