From patchwork Tue Aug 2 13:24:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sebechlebskyjan@gmail.com X-Patchwork-Id: 62 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.67 with SMTP id o64csp217710vsd; Tue, 2 Aug 2016 06:38:13 -0700 (PDT) X-Received: by 10.194.186.231 with SMTP id fn7mr56754087wjc.164.1470145093389; Tue, 02 Aug 2016 06:38:13 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p184si21447815wmp.85.2016.08.02.06.38.13; Tue, 02 Aug 2016 06:38:13 -0700 (PDT) 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=@gmail.com; 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=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0D9AA689F1F; Tue, 2 Aug 2016 16:38:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3AFD6689A74 for ; Tue, 2 Aug 2016 16:37:58 +0300 (EEST) Received: by mail-wm0-f68.google.com with SMTP id x83so30832470wma.3 for ; Tue, 02 Aug 2016 06:38:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FZzCoak/GCK0AW5pa2j8RT321/mAZC4lVpYJrvaEWac=; b=p6/ME+wx2CFrARbZOrK3RSh/flzX9lv4OiC5UXEW+wEVDvKaYgVFxKU9LO4H8wded6 PN4jvuCRoTDA+gBNpo9wF/9+YPxDe23oosHD48oIAXoevLKAd85jLuKwpnJ7VYG5s+K/ 5Jk4h0F00GucKA2oSyO11e88O7vpA26fFGO5CIUyEEwDbvMof+ybr57VgFwlV9aWOwMY LlUZ97ta0GNmF/fIxWbXJV4Ixh8428vOcFtenaW38p7YszyUjSulgHhuMPhQyEb0+Qlq KkmQg6NhH44JhBoVnSoGkP4++EAMpngI556xlYnHbqsKn9CwMUpDFIRZoAQ4LnprluP9 Gocw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FZzCoak/GCK0AW5pa2j8RT321/mAZC4lVpYJrvaEWac=; b=fCyAobXW0Vi3IlBzlM2I22xEfJajrvj9G2w6fQsUW/kZ04JkikwjuavJokRfjZDKFt 4ThpWc5F62i8q3PXApG0uVgqH8k3lT0ZuXiaKSvxd89PezCP1OjoFKfLipCUF6Y68Gtv d2lcJYwTceXyd2q5dXYc1a7ZeK+BHj/lBZvmW3INshuX2MhsQAlboG/RL1y9FRIBGo+o lFOlQyW7jXripKQpu5kaiiW0rZ8p0p1KGj/2DhkEMoDt/O2QTsjWRhhfzNxdKBouw4nV XohUsyQYZCxeLb8job9c/V84oajMPUzTxlEJCaFW2ofn1b0qyt6n3dRFQU4WAz+XeHgq 1V1g== X-Gm-Message-State: AEkoouuHdwRvWVp/itZARhEtAkuEunA9WCqpVCvKNTEa66Fer8PgbunYB0kvG0nja9/LYg== X-Received: by 10.194.65.170 with SMTP id y10mr56466612wjs.26.1470144276154; Tue, 02 Aug 2016 06:24:36 -0700 (PDT) Received: from localhost.localdomain (157.174.broadband3.iol.cz. [85.70.174.157]) by smtp.gmail.com with ESMTPSA id n131sm22060902wmd.3.2016.08.02.06.24.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Aug 2016 06:24:35 -0700 (PDT) From: sebechlebskyjan@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 2 Aug 2016 15:24:15 +0200 Message-Id: <1470144262-13167-5-git-send-email-sebechlebskyjan@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470144262-13167-1-git-send-email-sebechlebskyjan@gmail.com> References: <1470144262-13167-1-git-send-email-sebechlebskyjan@gmail.com> Subject: [FFmpeg-devel] [PATCH 04/11] avformat/muxers: Add non-blocking mode support for av_write_trailer 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: Jan Sebechlebsky MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Jan Sebechlebsky This makes av_write_trailer not to free the resources if write_trailer call returns AVERROR(EAGAIN) allowing repeated calls of write_trailer of non-blocking muxer. Signed-off-by: Jan Sebechlebsky --- libavformat/avformat.h | 6 +++++- libavformat/mux.c | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 818184e..9191c69 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2508,8 +2508,12 @@ int av_write_uncoded_frame_query(AVFormatContext *s, int stream_index); * * May only be called after a successful call to avformat_write_header. * + * If AVFMT_FLAG_NONBLOCK is set, this call may return AVERROR(EAGAIN) + * meaning the operation is pending and the call should be repeated. + * * @param s media file handle - * @return 0 if OK, AVERROR_xxx on error + * @return 0 if OK, AVERROR(EAGAIN) in case call should be repeated, + * other AVERROR on error */ int av_write_trailer(AVFormatContext *s); diff --git a/libavformat/mux.c b/libavformat/mux.c index e9973ed..b58e4c1 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -1238,6 +1238,9 @@ fail: } } + if (ret == AVERROR(EAGAIN)) + return ret; + if (s->oformat->deinit) s->oformat->deinit(s);