From patchwork Thu Nov 17 10:16:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39317 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp997593pzb; Thu, 17 Nov 2022 02:17:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf7XjQ0Ginov3zkSLWkxWckuPqttKP7G+GNz9TdNBwFfPFDbyROLnMp5KcVGrlLW+rT0XMoq X-Received: by 2002:a05:6402:d6a:b0:467:6dbf:e3e8 with SMTP id ec42-20020a0564020d6a00b004676dbfe3e8mr1543669edb.291.1668680277674; Thu, 17 Nov 2022 02:17:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668680277; cv=none; d=google.com; s=arc-20160816; b=m636X2eeOdsZIaw/UeXsQya399t5IUFiEMNMgReNWRv8/Rxdx6JmL8knBlwRM6maIy Y2TVRHHyUkYJBo+tO+HLcj4GmzSq+Wjjl35PKoVRHbcmb5hU5mp2mtDWCqxXJVEx5lMu wl2mjJ/39+cL8eESawV2P04a+5Zv9ToUHUwzsbkoX3BAAmsUh7YTHRoJJ30Z8Zdc0Jnp DDU48FRQnyP3vBGHcN3HqR/1TSTNchSbjnmd7gD+fuI4mS6hSUwoKkzNSvz4fek/2D5K XkMR18XAsH77RbfODEPkgt3JdBUMGC/K2TZLYKNxc8uDR+pozXSN2ci8GYuJ9l+919wd UkCQ== 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=n+vQAUrZYdXe8X6/08r6Kk8ZFMG7eTRnedzRNjfGVD8=; b=bqwVMCYz+huV64wttyf94YiOeNHFp1VZUsqOFm2FrQjsaAMRjQWHJHxoI42U74uOkl q+try4gm0uDQnvdeNCAkdiJws7xg5jw5mpPnCeW0zPKl41R+yW5+VuTZv6M8WcuDT+eL 7K0mgW2astzJcoNxNUF6cybibOtoamD3kZHl0tLCsU69JmygNfVk6O1iMsY20SDeYdUW nVKgsFqr0PH4X8uKdr64ePcAU14ZOqPmffRp3g4AguXtM8fXG07d/DG9Xh1lBGAya1fx ZtR7vx0S8cQeHrEH+il2l4woOTTcyeMSvQ8oM3VWhwu8KJkXcAp2pBNpuBRdNZr6bMZC dN1Q== 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 n18-20020aa7c692000000b00453b9f11b56si503126edq.261.2022.11.17.02.17.57; Thu, 17 Nov 2022 02:17:57 -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; 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 7D17668BCE2; Thu, 17 Nov 2022 12:16:58 +0200 (EET) 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 C310068BD58 for ; Thu, 17 Nov 2022 12:16:49 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id C900F2405EC for ; Thu, 17 Nov 2022 11:16:47 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id lVTn-5KzDXdH for ; Thu, 17 Nov 2022 11:16:46 +0100 (CET) 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 5929D2406C7 for ; Thu, 17 Nov 2022 11:16:43 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 497EA3A02FD for ; Thu, 17 Nov 2022 11:16:43 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 17 Nov 2022 11:16:38 +0100 Message-Id: <20221117101640.6789-8-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221117101640.6789-1-anton@khirnov.net> References: <20221117101640.6789-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 08/10] fftools/ffmpeg: declare loop variables inside loops in transcode_init() 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: vb0bi3H9wJtD --- fftools/ffmpeg.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index c43c3ca3bc..3767ab444b 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3140,21 +3140,19 @@ static int init_output_stream(OutputStream *ost, AVFrame *frame, static int transcode_init(void) { - int ret = 0, i, j, k; - OutputStream *ost; - InputStream *ist; + int ret = 0; char error[1024] = {0}; /* init framerate emulation */ - for (i = 0; i < nb_input_files; i++) { + for (int i = 0; i < nb_input_files; i++) { InputFile *ifile = input_files[i]; if (ifile->readrate || ifile->rate_emu) - for (j = 0; j < ifile->nb_streams; j++) + for (int j = 0; j < ifile->nb_streams; j++) ifile->streams[j]->start = av_gettime_relative(); } /* init input streams */ - for (ist = ist_iter(NULL); ist; ist = ist_iter(ist)) + for (InputStream *ist = ist_iter(NULL); ist; ist = ist_iter(ist)) if ((ret = init_input_stream(ist, error, sizeof(error))) < 0) goto dump_format; @@ -3167,7 +3165,7 @@ static int transcode_init(void) * to be configured with the correct audio frame size, which is only * known after the encoder is initialized. */ - for (ost = ost_iter(NULL); ost; ost = ost_iter(ost)) { + for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) { if (ost->enc_ctx && (ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)) @@ -3179,13 +3177,13 @@ static int transcode_init(void) } /* discard unused programs */ - for (i = 0; i < nb_input_files; i++) { + for (int i = 0; i < nb_input_files; i++) { InputFile *ifile = input_files[i]; - for (j = 0; j < ifile->ctx->nb_programs; j++) { + for (int j = 0; j < ifile->ctx->nb_programs; j++) { AVProgram *p = ifile->ctx->programs[j]; int discard = AVDISCARD_ALL; - for (k = 0; k < p->nb_stream_indexes; k++) + for (int k = 0; k < p->nb_stream_indexes; k++) if (!ifile->streams[p->stream_index[k]]->discard) { discard = AVDISCARD_DEFAULT; break; @@ -3197,8 +3195,8 @@ static int transcode_init(void) dump_format: /* dump the stream mapping */ av_log(NULL, AV_LOG_INFO, "Stream mapping:\n"); - for (ist = ist_iter(NULL); ist; ist = ist_iter(ist)) { - for (j = 0; j < ist->nb_filters; j++) { + for (InputStream *ist = ist_iter(NULL); ist; ist = ist_iter(ist)) { + for (int j = 0; j < ist->nb_filters; j++) { if (!filtergraph_is_simple(ist->filters[j]->graph)) { av_log(NULL, AV_LOG_INFO, " Stream #%d:%d (%s) -> %s", ist->file_index, ist->st->index, ist->dec ? ist->dec->name : "?", @@ -3210,7 +3208,7 @@ static int transcode_init(void) } } - for (ost = ost_iter(NULL); ost; ost = ost_iter(ost)) { + for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) { if (ost->attachment_filename) { /* an attached file */ av_log(NULL, AV_LOG_INFO, " File %s -> Stream #%d:%d\n",