From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 1990B42429 for ; Tue, 15 Mar 2022 21:28:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8261668AF8B; Tue, 15 Mar 2022 23:28:37 +0200 (EET) Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5444768067F for ; Tue, 15 Mar 2022 23:28:31 +0200 (EET) Received: by mail-ot1-f52.google.com with SMTP id k25-20020a056830151900b005b25d8588dbso190540otp.4 for ; Tue, 15 Mar 2022 14:28:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=vrFBt5EtZsWmm9tKg0sA5zhAuELSV7z3zpWlL4OVBdI=; b=D7trKMytm34nFpUpaeq+XlugUnpwlrxGMtD5yVLUt9nByD5JKQ0hyqd/Eyo+/rUDjm eomu/zjT1Iu/bPtT8z5djt4WYd3TV8lyzCKdrcbxjx1kble4/bxyWSrYeFqc1m1PwJWW al7BkxmngKKCRXbpZGMUncnXG79rD4+TNGpB17WMy7HQQ8QmIdy9U/yV6rchzjZjYa9O EU/bv6o9mjD3IaO2j1wkpS0hMRGQkaCddZwRwp+TBNNEwKlB2z/sHZ7CsXxTF+9GfKxX gJF8/+lK2t6rLI/ayHIr8CgReLQKEj5AH8F5JoXaA0IXMH8yRoqAIx/kbkyeR34o83er 4bNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=vrFBt5EtZsWmm9tKg0sA5zhAuELSV7z3zpWlL4OVBdI=; b=OBGOlbnOowxAQLUZeuaoMP1fLzWFBOvVg0L3/fGKPNxR/m+p4+LOHqKjsn0+bL2a5M Z17CexHSOQfAJewpygksS2/0F+RsTCsADQNnnhV+ZVASgDQVSm+62Rc4DYgn7QkiN5yC SaGHP6VivJaObpkq7or5KM81wDvZ8bmgbn7GOk/Lw4V2dcvRCQA5Tqfdch1wmGxYIBIB DVduoN0aOdcKZXNhpJv6WL9ODQBuE2OIFgCQC2HmN7sT3UEb4S86vV8bRZykXfabeYcl ggNkGbJfw4Sd46sk8oHf9HB8IlNRpcu1mOV3nlUjYWrP2XJBN82dQKEmQZKr3KRzPw/q 9kVw== X-Gm-Message-State: AOAM533rbG1LLINii0xGD8W54JlbskhlogRK0W6E0q+f6CKiIAaDQYS8 4vp8AWCFQ9gD0/434c2i1/SO45TWkm2k0Q== X-Google-Smtp-Source: ABdhPJyrOJFS09Nf/tHzKng+yqQF0ta2qX9FXUpxEmVT2hhSNNBK1DwMO0XjmIS9Gm5FFbtx6LQMXA== X-Received: by 2002:a05:6830:3110:b0:5c9:3e56:c814 with SMTP id b16-20020a056830311000b005c93e56c814mr8873173ots.198.1647379709603; Tue, 15 Mar 2022 14:28:29 -0700 (PDT) Received: from [192.168.0.13] ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id n3-20020a9d4d03000000b005b236de8911sm63123otf.24.2022.03.15.14.28.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Mar 2022 14:28:29 -0700 (PDT) Message-ID: <514579be-d414-0f50-50c5-511d37a5e276@gmail.com> Date: Tue, 15 Mar 2022 18:28:27 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <1382f5bd-673f-f429-0ce9-ce39c3f9b586@gmail.com> <20220315211858.26800-1-cus@passwd.hu> <20220315211858.26800-4-cus@passwd.hu> From: James Almer In-Reply-To: <20220315211858.26800-4-cus@passwd.hu> Subject: Re: [FFmpeg-devel] [PATCH v2 4/4] avutil/channel_layout: fix av_channel_layout_describe_bprint with custom and ambisonic channels 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 3/15/2022 6:18 PM, Marton Balint wrote: > bp->len cannot be used to detect if try_describe_ambisonic was successful > because the bprint buffer might contain other data as well. > > Also describing an invalid ambisonic layout should not return 0 but > AVERROR(EINVAL) instead, so change try_describe_ambisonic to actually return > error on invalid ambisonics. This also allows us to fix the first issue. > > Signed-off-by: Marton Balint > --- > libavutil/channel_layout.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c > index fb1f72737f..1a141d4a6a 100644 > --- a/libavutil/channel_layout.c > +++ b/libavutil/channel_layout.c > @@ -689,14 +689,14 @@ static int ambisonic_order(const AVChannelLayout *channel_layout) > /** > * If the custom layout is n-th order standard-order ambisonic, with optional > * extra non-diegetic channels at the end, write its string description in bp. > - * Return a negative error code on error. > + * Return a negative error code otherwise. > */ > static int try_describe_ambisonic(AVBPrint *bp, const AVChannelLayout *channel_layout) > { > int nb_ambi_channels; > int order = ambisonic_order(channel_layout); > if (order < 0) > - return 0; > + return order; > > av_bprintf(bp, "ambisonic %d", order); > > @@ -739,8 +739,8 @@ int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout, > case AV_CHANNEL_ORDER_CUSTOM: > if (channel_layout->order == AV_CHANNEL_ORDER_CUSTOM) { > int res = try_describe_ambisonic(bp, channel_layout); > - if (res < 0 || bp->len) > - return res; > + if (res >= 0) > + return 0; > } > if (channel_layout->nb_channels) > av_bprintf(bp, "%d channels (", channel_layout->nb_channels); LGTM. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".