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 BD0FB423FB for ; Tue, 15 Mar 2022 20:43:05 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 840A768B11B; Tue, 15 Mar 2022 22:43:03 +0200 (EET) Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3B8C568A8E7 for ; Tue, 15 Mar 2022 22:42:57 +0200 (EET) Received: by mail-oo1-f42.google.com with SMTP id k13-20020a4a948d000000b003172f2f6bdfso442720ooi.1 for ; Tue, 15 Mar 2022 13:42:57 -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=zb5WDHdz7S5FcCDKP8KXp2fp5gGnsFUgscnX7u4WABk=; b=qkUPhykbOQweVd9tkDWzun02Oq2hus77EPBfxGCu634e7nhPu9JPYIq3zvQKLVEbve fI6ynUR9U+ReIvkzcZFGZtpTjiWC1uB6VngfKEyMF9KiOMtduD6DqqsrypmDfyqKWcv9 Y9gAsxKPXsbVk7HlzvrmckchGSsomsJ+rB3g8uaqugm4DJWvpAPhedMnPWmIPIJmupkj XU8fpk+f2ZD/XwQRb575m8RVWInYL/Ed6hJ8IbdOrCBmlZXXG8bKUI6YkgqFVlh8Hnxc u86LneI7PU3w+qlehE/NoB1R/BdAXWerGE9MWo9kPMOfneLI/cAL4UPoUcAq6WN0f4Ai 4PDQ== 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=zb5WDHdz7S5FcCDKP8KXp2fp5gGnsFUgscnX7u4WABk=; b=rg6dooostv5hDlxr2qlSBOg9hP/LyhbC3aBVdRhD039FjFBG4YG5Cwojgm/CiaQLiu mNN6dinm0O7LsYIZ5AKFDwmoaMM/9jBkcna4Urtog3jQmIW8Cf0zKr3KFZlYAo9roy5M 1Bxm+rLt41ExzDMap6zLEUIPugdW7rsv3craRb7MdG0wV0Uohz/tq7eLzqjWB5wsrVJn K1WNiJdoPpjQa5ALV/A7IGRRNNYqEGV18BTTZsTZC99tTK51rRsq7wesfnK4klY9Z8qW 5BEGl6mBiOhDr5fjH2lZ1P/tUm51d0fnfF0QOOOpL5gCPTZcqLfca9E/8VA6wMEz9ZxI Vv0g== X-Gm-Message-State: AOAM532I3kEfO/cRez4ZFLuhdH363sLE7SXMwRgNHk9mPlr/MUfQ/XQd 3BD2COu5bp+HSf2RmNZMb8XDbOWXOGQWKA== X-Google-Smtp-Source: ABdhPJxvqUH8TkF22f0f9qMofYGtahm0X/Oo3CzAeLmzlURkI+xFcMLNqYh0rDn8GXVxwahZnpe/xQ== X-Received: by 2002:a05:6870:c0cb:b0:da:2bcc:aa09 with SMTP id e11-20020a056870c0cb00b000da2bccaa09mr2367856oad.63.1647376975395; Tue, 15 Mar 2022 13:42:55 -0700 (PDT) Received: from [192.168.0.13] ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id c9-20020a4a8ec9000000b0032438ba79b0sm72488ool.0.2022.03.15.13.42.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Mar 2022 13:42:54 -0700 (PDT) Message-ID: <578bb821-a381-e939-6793-1520a23855fb@gmail.com> Date: Tue, 15 Mar 2022 17:42:53 -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: <20220315203013.14304-1-cus@passwd.hu> <20220315203013.14304-4-cus@passwd.hu> From: James Almer In-Reply-To: <20220315203013.14304-4-cus@passwd.hu> Subject: Re: [FFmpeg-devel] [PATCH 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 5:30 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 | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c > index 8406089fe0..be511dcf68 100644 > --- a/libavutil/channel_layout.c > +++ b/libavutil/channel_layout.c > @@ -687,14 +687,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); > > @@ -736,7 +736,7 @@ 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) > + if (res >= 0) > return res; return 0. The doxy for av_channel_layout_describe_bprint() does not define values > 0. > } > if (channel_layout->nb_channels) _______________________________________________ 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".