From patchwork Sat Feb 11 07:44:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 40365 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp1975091pzk; Fri, 10 Feb 2023 23:44:46 -0800 (PST) X-Google-Smtp-Source: AK7set/zB3O7CMKZiexnsNuaslcUblO5wGT67agbaNiKagm+tw5+PhlMNlMFJYBg9oZamRRyY5h5 X-Received: by 2002:a17:906:a194:b0:877:a7ec:5ff with SMTP id s20-20020a170906a19400b00877a7ec05ffmr18023447ejy.10.1676101486532; Fri, 10 Feb 2023 23:44:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676101486; cv=none; d=google.com; s=arc-20160816; b=KrASWqYuAcyAALZalrDK/tEQvIkqhpiiyd6/Gnh7Yvi16st1vcxr2g2Ap3aecpfkQY XjzW/SS3YXhKfVI8NznTiB7P/8pSB7QfBxVfAol7wZICppxaIuQGS9+JRocOvHsX37Nv lndc6CaE3s5jQrftwiVQY2mhZWUHtfdhUOEOX5YQ9h+ccuqZNtwTzzwPOfJMcD9wipKB O2HupZayQPqUIfsdlhmk5tDYR5Jd41B2S5xdzLXrvR5EOs2y9dhWBX/CvqECR5dCfqtC vioOYXwHn9bTi9OMeqku4f/42MkeaVGMWzJdQ3ZN4ItzOI0jANY/0QjI+gJGOKgiaxdn i1tA== 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=dB8bQra2Y2W+i1IJRjEFZsVJkdaZIbgT3YMd1B9cKh0=; b=03lU/OZHbhGlxfu/+VRS859qAaAE92gvUxUyb/aT/TpzAMy+VqwrokKLisEFG0IRlz rUGYWGX6ZXU/Z/e30fsCH8XmHYoGiY1Dqg7Qctiq41Fi71j4EO3dCeVkeDx6N2ocvBQV 9CIt3ulZsMRraVI8TDI7pkOG1PKkzw0Ee6sUnluun2aneJKueHSF44B1WCJU2oH3VDNl mAZZRwKdi+3i3caDzHAq4W7i9PXIIFDmmWW9ORenrbSCebg7UjNJgcjuHPwLoAzWzU0l 4Tzu+9r5qOH/inLNk1lCiOZjX3/2SUmeCL+f2IYHb+wq09VvWL5MePDLvodIcAlI+Kvb j2Xw== 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 wg1-20020a1709078f0100b008779b708a5bsi6585394ejc.288.2023.02.10.23.44.46; Fri, 10 Feb 2023 23:44:46 -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 D5D4868BDBC; Sat, 11 Feb 2023 09:44:33 +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 BA0F168B611 for ; Sat, 11 Feb 2023 09:44:26 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 79AAC2404F5 for ; Sat, 11 Feb 2023 08:44:26 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id fLUTeHM1Xpol for ; Sat, 11 Feb 2023 08:44:24 +0100 (CET) Received: from libav.khirnov.net (unknown [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 E084B2404EE for ; Sat, 11 Feb 2023 08:44:24 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id A32943A0317 for ; Sat, 11 Feb 2023 08:44:16 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 Feb 2023 08:44:10 +0100 Message-Id: <20230211074412.29495-3-anton@khirnov.net> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230211074412.29495-1-anton@khirnov.net> References: <20230211074412.29495-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/5] fftools/ffmpeg_demux: move InputStream.guess_layout_max to stack 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: W+zhfNTm8akG It is only needed while processing the stream in add_input_streams(), no reason to store it in the context. --- fftools/ffmpeg.h | 1 - fftools/ffmpeg_demux.c | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 2d48a147b8..66dda45f70 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -388,7 +388,6 @@ typedef struct InputStream { AVDictionary *decoder_opts; AVRational framerate; /* framerate forced with -r */ int top_field_first; - int guess_layout_max; int autorotate; diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index b6b6b21271..ac0431233e 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -552,14 +552,14 @@ static const AVCodec *choose_decoder(const OptionsContext *o, AVFormatContext *s } } -static int guess_input_channel_layout(InputStream *ist) +static int guess_input_channel_layout(InputStream *ist, int guess_layout_max) { AVCodecContext *dec = ist->dec_ctx; if (dec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) { char layout_name[256]; - if (dec->ch_layout.nb_channels > ist->guess_layout_max) + if (dec->ch_layout.nb_channels > guess_layout_max) return 0; av_channel_layout_default(&dec->ch_layout, dec->ch_layout.nb_channels); if (dec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) @@ -800,11 +800,12 @@ static void add_input_streams(const OptionsContext *o, Demuxer *d) ist->framerate_guessed = av_guess_frame_rate(ic, st, NULL); break; - case AVMEDIA_TYPE_AUDIO: - ist->guess_layout_max = INT_MAX; - MATCH_PER_STREAM_OPT(guess_layout_max, i, ist->guess_layout_max, ic, st); - guess_input_channel_layout(ist); + case AVMEDIA_TYPE_AUDIO: { + int guess_layout_max = INT_MAX; + MATCH_PER_STREAM_OPT(guess_layout_max, i, guess_layout_max, ic, st); + guess_input_channel_layout(ist, guess_layout_max); break; + } case AVMEDIA_TYPE_DATA: case AVMEDIA_TYPE_SUBTITLE: { char *canvas_size = NULL;