From patchwork Fri Jul 7 09:48:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 42494 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1e:b0:12b:9ae3:586d with SMTP id c30csp7162971pzh; Fri, 7 Jul 2023 02:52:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlEk1lZ44JZycJzRpc8q/Tj4oAUd1YwvCKlURIzmHvdQVLUFXMcVSmFzadpnSH0bzBfRfTlM X-Received: by 2002:aa7:d055:0:b0:51d:8a55:6c11 with SMTP id n21-20020aa7d055000000b0051d8a556c11mr4216773edo.8.1688723531241; Fri, 07 Jul 2023 02:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688723531; cv=none; d=google.com; s=arc-20160816; b=NbpVMBfttMs7ZBaMo3jr0r5TsXSRK2541R25HOrrGYoo1+XWDBTTwouXElFT1xKRfn RuYXsvCBTHAugC6UYZod9od0ooIODOIsER+yejbIPWNnHWhmn8NvsQdZKA2/xeaMqv9P 0LMs2r6pyyz5geJ5p1yQD77c++CgX1bof7W5zvlepCc7PJNiwQQT0SuUd7kBmk+zLwDy pPkbtSQSS1Z1x50WbPgupjWKhS326F0WOIdE9ZbU/5/0S6ZGPD8B7U7NYoGXqVTZDofv lVjkeJ1uvnuG9NJzTxpQ9G/yMp2EBrTaXDrJU+mdTYmHZU1L95XrHM1PCGCXDqrXIQmd 6caQ== 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=nwJN4niwWiMygiiiB14mt5vVzBGIVFUKndjIqhp30oY=; fh=8ZF2QtiKOjBtyn9wuO2cMeZaLsE4aq02Bq77gGK61E8=; b=jozBPFNiPOXXcLmPUmlj9jlWkuAQEAm7dZei/bQFJeW5xC1k89AGJn4x4T+SBXKcq4 CuN7+HjlfsXJkZEeaWO3dDtzzqunSwkjAWGfN2wkljCXFtgTCLVK8kjqkcXDJhviKiS1 AfTg/sdsRpkFIVSPabC5zXxMoiPpLcT+OlwL+38ZigCz50GWj6asIW40PcbVxExGSyOA qDSpc7XncLgY0f9QCG20W6KBGM8lazegiBHuddvbo25yaZWFJc7h16B2iVKcU4YS6CWx ZtzkJi9kRuygSNivwTbGWz7H4vSn8hy+uO242gr5SiQOPoyqPJQRJlmn7SLZPfR5CXRg rVeA== 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 u20-20020a056402065400b0051e065bbc1dsi2189042edx.36.2023.07.07.02.52.10; Fri, 07 Jul 2023 02:52:11 -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 B6C8668C84E; Fri, 7 Jul 2023 12:49:29 +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 7AC2A68C7E2 for ; Fri, 7 Jul 2023 12:49:07 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 605902404F8 for ; Fri, 7 Jul 2023 11:49:04 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id w4K20OEJAxcl for ; Fri, 7 Jul 2023 11:49:03 +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 D25C92405EC for ; Fri, 7 Jul 2023 11:49:00 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 978D63A12EC for ; Fri, 7 Jul 2023 11:48:54 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 7 Jul 2023 11:48:34 +0200 Message-Id: <20230707094847.25324-9-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230707094847.25324-1-anton@khirnov.net> References: <20230707094847.25324-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/22] fftools/ffmpeg_filter: make OutputFile.ch_layout private 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: /5gaOZLXuDfi It is not used outside of the filtering code. --- fftools/ffmpeg.h | 1 - fftools/ffmpeg_filter.c | 17 ++++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 5b4117eeea..b789233a08 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -296,7 +296,6 @@ typedef struct OutputFilter { /* desired output stream properties */ int width, height; - AVChannelLayout ch_layout; // those are only set if no format is specified and the encoder gives us multiple options // They point directly to the relevant lists of the encoder. diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index b1fda7b9e8..0272b0a96b 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -139,6 +139,7 @@ typedef struct OutputFilterPriv { /* desired output stream properties */ int format; int sample_rate; + AVChannelLayout ch_layout; } OutputFilterPriv; static OutputFilterPriv *ofp_from_ofilter(OutputFilter *ofilter) @@ -375,9 +376,10 @@ DEF_CHOOSE_FORMAT(sample_rates, int, sample_rate, sample_rates, 0, static void choose_channel_layouts(OutputFilter *ofilter, AVBPrint *bprint) { - if (av_channel_layout_check(&ofilter->ch_layout)) { + OutputFilterPriv *ofp = ofp_from_ofilter(ofilter); + if (av_channel_layout_check(&ofp->ch_layout)) { av_bprintf(bprint, "channel_layouts="); - av_channel_layout_describe_bprint(&ofilter->ch_layout, bprint); + av_channel_layout_describe_bprint(&ofp->ch_layout, bprint); } else if (ofilter->ch_layouts) { const AVChannelLayout *p; @@ -630,7 +632,7 @@ static int ifilter_bind_ist(InputFilter *ifilter, InputStream *ist) return 0; } -static void set_channel_layout(OutputFilter *f, OutputStream *ost) +static void set_channel_layout(OutputFilterPriv *f, OutputStream *ost) { const AVCodec *c = ost->enc_ctx->codec; int i, err; @@ -701,7 +703,7 @@ void ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost) ofilter->sample_rates = c->supported_samplerates; } if (ost->enc_ctx->ch_layout.nb_channels) { - set_channel_layout(ofilter, ost); + set_channel_layout(ofp, ost); } else if (c->ch_layouts) { ofilter->ch_layouts = c->ch_layouts; } @@ -782,10 +784,11 @@ void fg_free(FilterGraph **pfg) av_freep(&fg->inputs); for (int j = 0; j < fg->nb_outputs; j++) { OutputFilter *ofilter = fg->outputs[j]; + OutputFilterPriv *ofp = ofp_from_ofilter(ofilter); av_freep(&ofilter->linklabel); av_freep(&ofilter->name); - av_channel_layout_uninit(&ofilter->ch_layout); + av_channel_layout_uninit(&ofp->ch_layout); av_freep(&fg->outputs[j]); } av_freep(&fg->outputs); @@ -1597,8 +1600,8 @@ static int configure_filtergraph(FilterGraph *fg) ofilter->height = av_buffersink_get_h(sink); ofp->sample_rate = av_buffersink_get_sample_rate(sink); - av_channel_layout_uninit(&ofilter->ch_layout); - ret = av_buffersink_get_ch_layout(sink, &ofilter->ch_layout); + av_channel_layout_uninit(&ofp->ch_layout); + ret = av_buffersink_get_ch_layout(sink, &ofp->ch_layout); if (ret < 0) goto fail; }