From patchwork Fri Dec 29 18:50:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 45387 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6623:b0:194:e134:edd4 with SMTP id n35csp4948592pzh; Fri, 29 Dec 2023 10:51:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVbOsX6hJAMGPnp9nLeJZFJTTuWpiCwH7Eovkb7K0WDjcFmojp+zglKnfUkQ6nNBpOcWv8 X-Received: by 2002:a17:907:b9d7:b0:a23:748f:c3f6 with SMTP id xa23-20020a170907b9d700b00a23748fc3f6mr4869430ejc.47.1703875878954; Fri, 29 Dec 2023 10:51:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703875878; cv=none; d=google.com; s=arc-20160816; b=iIaod0YtSdaGL1ujaV6cfTZmGAQvKmS9EgF6d88SNkEpHumezyljLOrJlSMI69/Sjv tDjJ1uxF99L7RhlCaaANqU4pdcEMRUBf2ZFxZ2ahSmFKF+aXsNd4NuT9Zn2i7UXKfmvg ZP8JY3nSU5oYV774mSEpWTcQMlKK/mxXSJR272ooZNXwZokkLXWHyGXqEba/O1q824O3 LPP7POMTf3dhVNC+7dZ8Wt9AMDQfYpPY8vQ+akmytxb8K7rn9bHOL8yTSK8Zxz7iWept n83BJX/bnc3/kCLGnTEDSU9forzlJG377R9jYGKDYTrvvKMGUnHx0hQ7td5SgW1o3JDw uk8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=Ii5B3sUwQKC45z2LeRMpKjBWh49iISawg1HpELBK1Xk=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=XKOSo7iz/dQMiGmY7nqxNjdTPrWaXwXzOrpxfEa3LMnYEpl9GyDxwyUsJGbm4FF7Us yU1C7xguminRSOqGtEQy3GwUF2fcN2IkLPZHDDFNRGUkrj6V7+3VLJMSVJrws1EL2RCH K4xKciXA7xRr6dC4G1ul62klSuo0g5h77tlnk3JPEBcKknmF95Nktg4VaGo4Q6VoNTIF RUhpM58Jtn7tmS4EUeaR4hfBQYnQd6bJmUbQ561hR9p2vxNPVQSrQucY8sNdgXbb9QVC Kaspj/LdvmVGXxi/n8d6BsePjs/aHV46J6urA+oWtBZhbSTb9IhDkV9zRlE+WY2MvIRG 8Zdg== 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 e22-20020a1709067e1600b00a27b5876596si83368ejr.680.2023.12.29.10.51.18; Fri, 29 Dec 2023 10:51:18 -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 1EF8D68CB90; Fri, 29 Dec 2023 20:51:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4986668C1DF for ; Fri, 29 Dec 2023 20:51:07 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id E992EE8086; Fri, 29 Dec 2023 19:51:06 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZCHWc3qIKjAe; Fri, 29 Dec 2023 19:51:03 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 5B981E7DBB; Fri, 29 Dec 2023 19:51:03 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Fri, 29 Dec 2023 19:50:57 +0100 Message-Id: <20231229185059.18462-1-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] all: use av_channel_layout_describe_bprint instead of av_channel_layout_describe in a few places 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 Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: nor6nD7UnFM0 Where an AVBPrint buffer is used later anyway. Signed-off-by: Marton Balint --- libavcodec/avcodec.c | 7 +------ libavfilter/af_amerge.c | 7 ++----- libavfilter/graphdump.c | 4 +--- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index 2dda310e91..a6c8629f6c 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -656,12 +656,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) if (enc->sample_rate) { av_bprintf(&bprint, "%d Hz, ", enc->sample_rate); } - { - char buf[512]; - int ret = av_channel_layout_describe(&enc->ch_layout, buf, sizeof(buf)); - if (ret >= 0) - av_bprintf(&bprint, "%s", buf); - } + av_channel_layout_describe_bprint(&enc->ch_layout, &bprint); if (enc->sample_fmt != AV_SAMPLE_FMT_NONE && (str = av_get_sample_fmt_name(enc->sample_fmt))) { av_bprintf(&bprint, ", %s", str); diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c index 83318f99e4..eabd3f8262 100644 --- a/libavfilter/af_amerge.c +++ b/libavfilter/af_amerge.c @@ -153,7 +153,6 @@ static int config_output(AVFilterLink *outlink) AVFilterContext *ctx = outlink->src; AMergeContext *s = ctx->priv; AVBPrint bp; - char buf[128]; int i; s->bps = av_get_bytes_per_sample(outlink->format); @@ -162,12 +161,10 @@ static int config_output(AVFilterLink *outlink) av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC); for (i = 0; i < s->nb_inputs; i++) { av_bprintf(&bp, "%sin%d:", i ? " + " : "", i); - av_channel_layout_describe(&ctx->inputs[i]->ch_layout, buf, sizeof(buf)); - av_bprintf(&bp, "%s", buf); + av_channel_layout_describe_bprint(&ctx->inputs[i]->ch_layout, &bp); } av_bprintf(&bp, " -> out:"); - av_channel_layout_describe(&outlink->ch_layout, buf, sizeof(buf)); - av_bprintf(&bp, "%s", buf); + av_channel_layout_describe_bprint(&outlink->ch_layout, &bp); av_log(ctx, AV_LOG_VERBOSE, "%s\n", bp.str); return 0; diff --git a/libavfilter/graphdump.c b/libavfilter/graphdump.c index 80f7bf6c98..df79903c52 100644 --- a/libavfilter/graphdump.c +++ b/libavfilter/graphdump.c @@ -30,7 +30,6 @@ static int print_link_prop(AVBPrint *buf, AVFilterLink *link) { const char *format; - char layout[128]; AVBPrint dummy_buffer; if (!buf) { @@ -50,8 +49,7 @@ static int print_link_prop(AVBPrint *buf, AVFilterLink *link) format = av_x_if_null(av_get_sample_fmt_name(link->format), "?"); av_bprintf(buf, "[%dHz %s:", (int)link->sample_rate, format); - av_channel_layout_describe(&link->ch_layout, layout, sizeof(layout)); - av_bprintf(buf, "%s", layout); + av_channel_layout_describe_bprint(&link->ch_layout, buf); av_bprint_chars(buf, ']', 1); break;