From patchwork Wed Sep 28 09:55:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 38416 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp93820pzh; Wed, 28 Sep 2022 02:58:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7kL7waeILANR/B0HqQddSkeCYdkEQZW3PnlNO3CGhgBa8fSs7hl4DMTPwlRV6ymktAWiLK X-Received: by 2002:a17:907:608f:b0:787:a1ae:1d3b with SMTP id ht15-20020a170907608f00b00787a1ae1d3bmr149274ejc.431.1664359127393; Wed, 28 Sep 2022 02:58:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664359127; cv=none; d=google.com; s=arc-20160816; b=t4Q/qrXw7nmCC7fwURMYnOu0EzgKXB2kl6hiKAUJA6hfyGkWMdXKR77uepWWh2fYYr j/MjKa5Z/R61JIu2iOrHkP/na/vdGwcue6NRIN3YfqhTMVA//uYlcrHL9TaesWBgO3VQ 8AFoy969N98/q387uHQKYgTuaHBjx0LLuBv5dHXn8NjYSgOQgBD6hq6iD9UBJ4Q5Mrew MoLDMhEVIELPcezjbAz7/pVuWRHHbji19+9dSNnVUcnzSErM8RzvNXxE5KFWZg+XeLBg Rjaz+Ujp3y/NfjHOrL5nupb8Igjp/rLx7hItFqozMd0n1N7CJQpcT8i4stNgAokKGycA ShJA== 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=vtrbvm2+BEVU41TEs0QWX1OEcn7IEI7hwaMWW63Vg30=; b=eAZ6wyolpbuT7S0BX2qgfS4zyoFFwv38aA8qsk0uF14CIcCHg60PKfUMdczL71Moir kSZ2RsOg5hNMRULuHRlFvxT0eEHEmCRC6MAu6dqWW5H84uA/7ImOoJey8PgGsmMi9nGN XbueOrw2PwlNPYZxTiekrmL64P+qS1eiry2knVC5Rdqg9v91f0PKKNZqkX9xAm+n+nmX fTCq6x2OxcFzpAtAgYe+Sa3d4fe0NGU4fQvIg5t1xmb/3x1T/r3zUoKF8hbgaDV4CFgP dqAIu8zNneaF3B990TvnQprgZvdnbsi3GzJdoIiM0MLDMMg709McE6gi/O98iWeYcZHp jaIA== 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 bx12-20020a170906a1cc00b007804e2f5bf5si3844515ejb.193.2022.09.28.02.58.46; Wed, 28 Sep 2022 02:58:47 -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 1724F68BC0D; Wed, 28 Sep 2022 12:58:14 +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 E544368BBF1 for ; Wed, 28 Sep 2022 12:58:03 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 317872404F8 for ; Wed, 28 Sep 2022 11:58:03 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 3_o7F2cH8b6N for ; Wed, 28 Sep 2022 11:58:01 +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 F236F2404E4 for ; Wed, 28 Sep 2022 11:58:00 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 438F13A0DA0 for ; Wed, 28 Sep 2022 11:58:01 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Sep 2022 11:55:51 +0200 Message-Id: <20220928095556.28209-4-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220928095556.28209-1-anton@khirnov.net> References: <20220928095556.28209-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/9] fftools/ffmpeg: cosmetics 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: Et0JvQ7Xtj8U Reindent after previous commit, apply some style fixes. --- fftools/ffmpeg.c | 85 ++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 833df0b167..697971167c 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1137,51 +1137,50 @@ static enum AVPictureType forced_kf_apply(OutputStream *ost, const AVFrame *in_picture, int dup_idx) { AVCodecContext *enc = ost->enc_ctx; - double pts_time; - - if (ost->forced_kf_ref_pts == AV_NOPTS_VALUE) - ost->forced_kf_ref_pts = in_picture->pts; - - pts_time = (in_picture->pts - ost->forced_kf_ref_pts) * av_q2d(enc->time_base); - if (ost->forced_kf_index < ost->forced_kf_count && - in_picture->pts >= ost->forced_kf_pts[ost->forced_kf_index]) { - ost->forced_kf_index++; - goto force_keyframe; - } else if (ost->forced_keyframes_pexpr) { - double res; - ost->forced_keyframes_expr_const_values[FKF_T] = pts_time; - res = av_expr_eval(ost->forced_keyframes_pexpr, - ost->forced_keyframes_expr_const_values, NULL); - ff_dlog(NULL, "force_key_frame: n:%f n_forced:%f prev_forced_n:%f t:%f prev_forced_t:%f -> res:%f\n", - ost->forced_keyframes_expr_const_values[FKF_N], - ost->forced_keyframes_expr_const_values[FKF_N_FORCED], - ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N], - ost->forced_keyframes_expr_const_values[FKF_T], - ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_T], - res); - - ost->forced_keyframes_expr_const_values[FKF_N] += 1; - - if (res) { - ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N] = - ost->forced_keyframes_expr_const_values[FKF_N] - 1; - ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_T] = - ost->forced_keyframes_expr_const_values[FKF_T]; - ost->forced_keyframes_expr_const_values[FKF_N_FORCED] += 1; - goto force_keyframe; - } - } else if ( ost->forced_keyframes - && !strncmp(ost->forced_keyframes, "source", 6) - && in_picture->key_frame==1 - && !dup_idx) { + double pts_time; + + if (ost->forced_kf_ref_pts == AV_NOPTS_VALUE) + ost->forced_kf_ref_pts = in_picture->pts; + + pts_time = (in_picture->pts - ost->forced_kf_ref_pts) * av_q2d(enc->time_base); + if (ost->forced_kf_index < ost->forced_kf_count && + in_picture->pts >= ost->forced_kf_pts[ost->forced_kf_index]) { + ost->forced_kf_index++; + goto force_keyframe; + } else if (ost->forced_keyframes_pexpr) { + double res; + ost->forced_keyframes_expr_const_values[FKF_T] = pts_time; + res = av_expr_eval(ost->forced_keyframes_pexpr, + ost->forced_keyframes_expr_const_values, NULL); + ff_dlog(NULL, "force_key_frame: n:%f n_forced:%f prev_forced_n:%f t:%f prev_forced_t:%f -> res:%f\n", + ost->forced_keyframes_expr_const_values[FKF_N], + ost->forced_keyframes_expr_const_values[FKF_N_FORCED], + ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N], + ost->forced_keyframes_expr_const_values[FKF_T], + ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_T], + res); + + ost->forced_keyframes_expr_const_values[FKF_N] += 1; + + if (res) { + ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N] = + ost->forced_keyframes_expr_const_values[FKF_N] - 1; + ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_T] = + ost->forced_keyframes_expr_const_values[FKF_T]; + ost->forced_keyframes_expr_const_values[FKF_N_FORCED] += 1; goto force_keyframe; - } else if ( ost->forced_keyframes - && !strncmp(ost->forced_keyframes, "source_no_drop", 14) - && !dup_idx) { - ost->dropped_keyframe = 0; - if ((in_picture->key_frame == 1) || ost->dropped_keyframe) - goto force_keyframe; } + } else if (ost->forced_keyframes && + !strncmp(ost->forced_keyframes, "source", 6) && + in_picture->key_frame == 1 && !dup_idx) { + goto force_keyframe; + } else if (ost->forced_keyframes && + !strncmp(ost->forced_keyframes, "source_no_drop", 14) && + !dup_idx) { + ost->dropped_keyframe = 0; + if ((in_picture->key_frame == 1) || ost->dropped_keyframe) + goto force_keyframe; + } return AV_PICTURE_TYPE_NONE;