From patchwork Fri Apr 5 16:12:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 47848 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:24a8:b0:1a3:b6bb:3029 with SMTP id m40csp1070990pzd; Fri, 5 Apr 2024 09:16:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUPxRi5bo44tF+LTkfMj4C4gnb/rnvnry+Iw410/1g41/rbHGdR5yZUXMM2R5/Nb0N3AZh/EXowOva+1nICT/cqAku9ISwoOq+zpA== X-Google-Smtp-Source: AGHT+IEH/gJCUUmhc/5kRlBvGJZxBPXrGxMee3z9NdKFYUo00iZwn4ClNMc2I9ZKB50VnTft7Kp8 X-Received: by 2002:ac2:4c17:0:b0:515:d445:6c13 with SMTP id t23-20020ac24c17000000b00515d4456c13mr1575172lfq.32.1712333783944; Fri, 05 Apr 2024 09:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712333783; cv=none; d=google.com; s=arc-20160816; b=s+0FczNT1I63mPU13d/P4BkRXMchd1xklqU9y9LWtayL62V6LzgUnxKHI7AgI/eHe9 uWiPhOeD4Sf4+YbypUOdTZjYzDyandIFiTtwsJrC1yu4a68Vc15lCLXcwPwV0wYX61c0 Y3knsxruGTl3KOvNweqJVHs3lpZBhPd7Zes07p2bipqACq3B6N1Zlt+pRGDGnf/FbAyw YwPgdCTh0NBQzvfJZj87n11J5WGcykpVX959ZqiX+7xhmvoAc7U+8D3dEXOrQ4b3B0rJ 97Axg6fJFCdUTfPoYExMi7EBoIfZZNa8ov1CWxglqgqpJFJmZ0PaJtjjMHT6Q5fy4Cls mojw== 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:dkim-signature:delivered-to; bh=Q+hpcdOL7iAvaKjpS0agIcY/x7bMFl03Zjzi6ZZdi5w=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=QCBDfJDP74/VUWQMX6VZ0xzAqsSzrvNJu+yFA0x6qYWhqp+vPjh4OvspQncvzroxJn UTxPB8YJCgXg+WyAptZCEANG5sNT9ku3cybT5nwE/USNX+qCn72BAKePFbGXbILwnN2A kPTT7MYoXr/DtcbXMonDBUhQa5WWC2h6OUNZNkqk5aB1QdD7XbIHjBbYNbRXq4Tc4XT9 RzDvMqCZ0ZJwVpRannmEdNPuRxSBEQjtWW0Gj5axGDoskX8wl5O2SONqf4O3XVhtMcQi x5BOO1zs+JSWdWUvqoWgdmSQieFFBFXqMcd3Jop2L5XvrQvdbj7maB+u9K+f9fbGST/x 7MUA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=N5vns9T9; 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 m6-20020a056402510600b0056c264a3a42si884950edd.527.2024.04.05.09.16.08; Fri, 05 Apr 2024 09:16:23 -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=@khirnov.net header.s=mail header.b=N5vns9T9; 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 0A12168D2B3; Fri, 5 Apr 2024 19:13:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5EABC68D19E for ; Fri, 5 Apr 2024 19:13:10 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=N5vns9T9; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 152544D76 for ; Fri, 5 Apr 2024 18:13:08 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id x6kCimKyi1C7 for ; Fri, 5 Apr 2024 18:13:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1712333583; bh=065deIZngOF2mLGtJeqvHqpRWXpBKhcVww4ldJQuZe4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=N5vns9T9YMvR9kkV8zUb5AWIPuhK6WS+4wV/aHP2csP8dr178psh3X3Jv8U90cA4Z mTWQC2IQo2xk2jpKnOXOl09wEDS4n/Kg50fH96WGTbOj/ttb+iEj3KKqum2jBMx+nu 4N+lJ2ueDn23m66ag9dButZ7WVcvxw0Q+T7kEAFbF+04qMr60xIhaXSpE1GKH0/MRf yBBs+ybDx9eSNgWFeLUUicTzEAIWPKNoxhX71IeN6k3ayvCTB5AGJvMNJt5wY48haU Z/ypua89TNcbT4CjUnrhY31HfWcgBBY/Uc/v1VuoFvsv+YaPtXsA77NVGJtcI3XlB4 mwLb7ZL9AcRlA== 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 mail1.khirnov.net (Postfix) with ESMTPS id 99B734D9D for ; Fri, 5 Apr 2024 18:13:03 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 818643A1774 for ; Fri, 5 Apr 2024 18:12:56 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 5 Apr 2024 18:12:04 +0200 Message-ID: <20240405161212.26167-23-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240405161212.26167-1-anton@khirnov.net> References: <20240405161212.26167-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 23/31] fftools/ffmpeg_mux: drop OutputFile.shortest 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: 9Mz1Z4uSTx5J It is no longer needed outside of of_open() and its children. --- fftools/ffmpeg.h | 1 - fftools/ffmpeg_mux_init.c | 17 +++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 26b42a3fcd..1d32009f90 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -620,7 +620,6 @@ typedef struct OutputFile { int64_t recording_time; ///< desired length of the resulting file in microseconds == AV_TIME_BASE units int64_t start_time; ///< start time in microseconds == AV_TIME_BASE units - int shortest; int bitexact; } OutputFile; diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index a483fffa6e..9aad19a85d 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -1886,7 +1886,7 @@ static int create_streams(Muxer *mux, const OptionsContext *o) } // handle -apad - if (mux->of.shortest) { + if (o->shortest) { int have_video = 0; for (unsigned i = 0; i < mux->of.nb_streams; i++) @@ -1921,7 +1921,8 @@ static int create_streams(Muxer *mux, const OptionsContext *o) return 0; } -static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_us) +static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, + int64_t buf_size_us, int shortest) { OutputFile *of = &mux->of; int nb_av_enc = 0, nb_audio_fs = 0, nb_interleaved = 0; @@ -1947,7 +1948,7 @@ static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_u limit_frames_av_enc |= (ms->max_frames < INT64_MAX) && IS_AV_ENC(ost, type); } - if (!((nb_interleaved > 1 && of->shortest) || + if (!((nb_interleaved > 1 && shortest) || (nb_interleaved > 0 && limit_frames) || nb_audio_fs)) return 0; @@ -1963,7 +1964,7 @@ static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_u * different encoders run in different threads and need external * synchronization, while muxer sync queues can be handled inside the muxer */ - if ((of->shortest && nb_av_enc > 1) || limit_frames_av_enc || nb_audio_fs) { + if ((shortest && nb_av_enc > 1) || limit_frames_av_enc || nb_audio_fs) { int sq_idx, ret; sq_idx = sch_add_sq_enc(mux->sch, buf_size_us, mux); @@ -1979,7 +1980,7 @@ static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_u continue; ret = sch_sq_add_enc(mux->sch, sq_idx, ms->sch_idx_enc, - of->shortest || ms->max_frames < INT64_MAX, + shortest || ms->max_frames < INT64_MAX, ms->max_frames); if (ret < 0) return ret; @@ -2006,7 +2007,7 @@ static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_u continue; ms->sq_idx_mux = sq_add_stream(mux->sq_mux, - of->shortest || ms->max_frames < INT64_MAX); + shortest || ms->max_frames < INT64_MAX); if (ms->sq_idx_mux < 0) return ms->sq_idx_mux; @@ -3043,7 +3044,6 @@ int of_open(const OptionsContext *o, const char *filename, Scheduler *sch) of->recording_time = recording_time; of->start_time = o->start_time; - of->shortest = o->shortest; mux->limit_filesize = o->limit_filesize; av_dict_copy(&mux->opts, o->g->format_opts, 0); @@ -3159,7 +3159,8 @@ int of_open(const OptionsContext *o, const char *filename, Scheduler *sch) return err; } - err = setup_sync_queues(mux, oc, o->shortest_buf_duration * AV_TIME_BASE); + err = setup_sync_queues(mux, oc, o->shortest_buf_duration * AV_TIME_BASE, + o->shortest); if (err < 0) { av_log(mux, AV_LOG_FATAL, "Error setting up output sync queues\n"); return err;