From patchwork Sat Jul 15 10:45:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 42700 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp4239491pzb; Sat, 15 Jul 2023 03:48:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlE8H2XoNXV/bv8UetMRjFrNge+GvY6NT5hmyz8qdukqyJqw1kyoEtdxAyDAvicKoRZDMzrU X-Received: by 2002:a05:6402:3451:b0:51e:1af0:3a90 with SMTP id l17-20020a056402345100b0051e1af03a90mr6170053edc.37.1689418082950; Sat, 15 Jul 2023 03:48:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689418082; cv=none; d=google.com; s=arc-20160816; b=e208gHM4CuPPTMeHtrEIkaHZwGk1FSUQJU4KNqaoRXd16Kd7Jb8t8sMAzQcC7mHorY PUTnelTjAqSTKbppIViqOv/m3ESq29Osg7UMPdieAaRFKNz0Gubhx5ybhXfN01KvtslG bFdfbu7K/LYQb4ct0YzIQ/idrY6HqoVqjcBgSFwiza0K6BVa7o1h6vBGAihqnCznaI4K gPgDYfa5+qoZHTw5L4Eqb2CfeXRpthnT2pUq6SCnnvzSfCgT74oUuHPSN/nRL9E/bN+n 0RL2p4TvoQZlUqwfoXv8n+9ad1AJRWuzvGs0Y179cY46vqR9TtByjQV7PeN0MzlYHbzF hFKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=jjK9ueX0i0G4LyxHiuKrFFPqeP/d6w4p6NS+PkTbY8E=; fh=8ZF2QtiKOjBtyn9wuO2cMeZaLsE4aq02Bq77gGK61E8=; b=cUdrT7LxtRzX8/i26trJXDsTcLhUb1+ftu7tStqOyhY8SngPqr+0tAO0zaZ2SOBP6C b2t4iX+KWwPHDpL4/a7Tofj7qUyRGqGq4+HPcx296rrs+agbFleSeitWdpRrtEbjrCm/ yIGPUER9Mqs8OVUhFntEYHoYpiZhnRZi+e3t5wJOJRhXUDYWLYqQU4OEOFwy3Pt0C+pO NBFgjZKfJslJYm1oA9K5Mwp9AVQiNH0eDvaxUJXD7TPCWmKYKkqF5ziS4fZYzz3yT6aq m9++aInSc3f0NYRETUu0JEswSZSDxnfdq7KMbGoapQ5dWHnVi5fRatSpI0yILvcmkFBo 1krA== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l24-20020aa7d958000000b0051de00fc4f2si10612711eds.179.2023.07.15.03.48.02; Sat, 15 Jul 2023 03:48:02 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B56DC68C6C9; Sat, 15 Jul 2023 13:46:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 947C668C654 for ; Sat, 15 Jul 2023 13:46:33 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 5C5612405EC for ; Sat, 15 Jul 2023 12:46:31 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id vF9E0sBCe1QD for ; Sat, 15 Jul 2023 12:46:30 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id A73C02406CA for ; Sat, 15 Jul 2023 12:46:26 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 716E33A1531 for ; Sat, 15 Jul 2023 12:46:20 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 15 Jul 2023 12:45:35 +0200 Message-Id: <20230715104611.17902-11-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230715104611.17902-1-anton@khirnov.net> References: <20230715104611.17902-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 11/47] fftools/ffmpeg_enc: return errors from enc_flush() instead of aborting X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: PDz8p+MEi3Wu --- fftools/ffmpeg.c | 2 +- fftools/ffmpeg.h | 2 +- fftools/ffmpeg_enc.c | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 27c4e7ef26..926fdea23a 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1250,7 +1250,7 @@ static int transcode(int *err_rate_exceeded) } else if (err_rate) av_log(ist, AV_LOG_VERBOSE, "Decode error rate %g\n", err_rate); } - enc_flush(); + ret = err_merge(ret, enc_flush()); term_exit(); diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 38f2b1ef66..7329df6607 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -816,7 +816,7 @@ void enc_free(Encoder **penc); int enc_open(OutputStream *ost, AVFrame *frame); int enc_subtitle(OutputFile *of, OutputStream *ost, const AVSubtitle *sub); int enc_frame(OutputStream *ost, AVFrame *frame); -void enc_flush(void); +int enc_flush(void); /* * Initialize muxing state for the given stream, should be called diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index 72ba56a03d..728c09dcad 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -1151,7 +1151,7 @@ int enc_frame(OutputStream *ost, AVFrame *frame) do_video_out(of, ost, frame) : do_audio_out(of, ost, frame); } -void enc_flush(void) +int enc_flush(void) { int ret; @@ -1172,6 +1172,8 @@ void enc_flush(void) ret = submit_encode_frame(of, ost, NULL); if (ret != AVERROR_EOF) - exit_program(1); + return ret; } + + return 0; }