From patchwork Tue Mar 15 21:18:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 34785 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6838:3486:0:0:0:0 with SMTP id ek6csp3356330nkb; Tue, 15 Mar 2022 14:19:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPVQ0W8nxP23m0rHaqLkXg9oupUL3rolNjbKxs1wJfWeq01FBMEpKSwtQ6yqkoHt1q4Pim X-Received: by 2002:a17:907:7da6:b0:6db:2e12:b85f with SMTP id oz38-20020a1709077da600b006db2e12b85fmr23168156ejc.312.1647379160583; Tue, 15 Mar 2022 14:19:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647379160; cv=none; d=google.com; s=arc-20160816; b=zQ+CYurGTXhaUeXdorJXPotFhHb7Xx2XdLBf5hDVZ0JrsGxRIp7Qhw0YR6+EGbX/Mr gfj+5BLEJ6cuE/H/b6f047QCp4OH7l1pYm6KKWIzYGJXuNZymWtzjGk9mXOFRKJzEw6U X+e1h+EwiZ4mwBXmLAQbgWUt2mlH3KTxO4OpmJgp0HxwXOhPJ4f6MMgZEoS8KViiKBq0 C8yRg8TteotjNyvRivtH8iN3L+gpsjkx3PMs9q3o9y3Mz3Dha4gv/tr8+oFYFvDtjiTo nVTkvKGBu0RC4Hl4wp9d5Jugn2PDWHAfC0kNfVWoes1wT/MsDd/tMuu64D9kErWSiuyH POIA== 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:references:in-reply-to :message-id:date:to:from:delivered-to; bh=vvst9EgM6Y2HmZVBuRJELN2DVBIaqbYXvyTV18RBAz8=; b=oYBCIiuPbYfFVgsZdyCX6JpFWWd3n4WLojHZ0plrEHRcd9cQEBQ/C46PFQYJEPNkgB UkhVR4iTZq/kod6aYQ3gyks+t4kp4R3lBrn3sVfyGpPHDVbqp7P0O+xRoUE9IhtgoYnv vd1DlEiY1h6BDC9/vmYQONeD/OqqFZ2GwTFRH8b3xDdfZCXVOfJ8wElDK3jt9rE76Gm0 nSdutWoCTUxp3W2imD6B4mr1uyQC3r6oKO0dQ1KXrASey6SVoPOAGZRIwp0t+PQLYJ9Q WFt6Gf66S8VpC4vHfm7TvprINTaJ4jzLStmo97DhU7XlyO6FM47bZ/LEPu/xe99+5d5Z Vvsg== 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 a17-20020aa7d751000000b00416c32c28bcsi122888eds.278.2022.03.15.14.19.20; Tue, 15 Mar 2022 14:19:20 -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 41DA168B178; Tue, 15 Mar 2022 23:19:18 +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 5AD8268B0B4 for ; Tue, 15 Mar 2022 23:19:12 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id B6D59E4DF2; Tue, 15 Mar 2022 22:19:12 +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 PxglZsWcdVvM; Tue, 15 Mar 2022 22:19:10 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 682A1E12AE; Tue, 15 Mar 2022 22:19:10 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Tue, 15 Mar 2022 22:18:55 +0100 Message-Id: <20220315211858.26800-1-cus@passwd.hu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <1382f5bd-673f-f429-0ce9-ce39c3f9b586@gmail.com> References: <1382f5bd-673f-f429-0ce9-ce39c3f9b586@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/4] avutil/channel_layout: print channels using av_channel_name_bprint in av_channel_layout_describe_bprint 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: ThkIV4X4yaGp This reduces code duplication an allows printing AMBI%d channel names for custom layouts for non-standard or partial ambisonic layouts. Signed-off-by: Marton Balint --- libavutil/channel_layout.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c index 8cc4efe4cf..c60ccf368f 100644 --- a/libavutil/channel_layout.c +++ b/libavutil/channel_layout.c @@ -737,14 +737,10 @@ int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout, av_bprintf(bp, "%d channels (", channel_layout->nb_channels); for (i = 0; i < channel_layout->nb_channels; i++) { enum AVChannel ch = av_channel_layout_channel_from_index(channel_layout, i); - const char *channel = get_channel_name(ch); if (i) av_bprintf(bp, "+"); - if (channel) - av_bprintf(bp, "%s", channel); - else - av_bprintf(bp, "USR%d", ch); + av_channel_name_bprint(bp, ch); if (channel_layout->order == AV_CHANNEL_ORDER_CUSTOM && channel_layout->u.map[i].name[0]) av_bprintf(bp, "@%s", channel_layout->u.map[i].name);