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 5369240401 for ; Wed, 23 Feb 2022 11:52:11 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2FD5F68B2BB; Wed, 23 Feb 2022 13:52:09 +0200 (EET) Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7F28F68B276 for ; Wed, 23 Feb 2022 13:52:03 +0200 (EET) Received: by mail-oi1-f174.google.com with SMTP id k2so14150866oia.2 for ; Wed, 23 Feb 2022 03:52:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:content-language:to :references:from:subject:in-reply-to:content-transfer-encoding; bh=uUDud1StzlPx6qyOMUoUfj5GK84ZnFmq+Dpyb1mQlFo=; b=h1cAzbs+HJDU6s8p7HOC9Z2PD1WawRZJLKZdf12X1UDB7EhS0ICiZKzAZi2hddBpWO G817qAMG3i1zrXo81Ewa4K7gYpKZ3dA01TczY0tPu6waYzY8c6f9ziPbIZ2RoVVkfyKu QddRovzp9BozidvFpJnk3nbXWPUxT46sYGqlKBRRNRTIw3wafxf7o0tS8+N2rMW6t59R KHE6H1dzc4kLBSU3qPZyLoQauxMptmsvBse/ofqT4G6mjbTdskaiyA8mXu3n35jRBR7a Hw1o0IHA+TuFwCvQLN7ZtpC6EHQD0BMH4iX1kv4Mscbpfk+61HnJnxewiFLsEP147JoT gt4Q== 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 :content-language:to:references:from:subject:in-reply-to :content-transfer-encoding; bh=uUDud1StzlPx6qyOMUoUfj5GK84ZnFmq+Dpyb1mQlFo=; b=BwRuXCYTMiGE1usOzu5eEHU3uBsAr5x7KcAeZ0ReLmZJES2qyiIzZwe+qafI01yIce aOQ1NPf8YNEaWm4t3LgsssSIasykJWjXxxvff7tqJmcS5ZjF/I7pSI5tUVbFilgm52PY 1ebOpvfwy2lr/q2ntJHh56c3K4Cs9S//NtM+IvyidQ1ks7BaXg6WFk+tWUga+04ZGHEn Tu8GQDpfl7Cb+CW78J5O+Rgaq7FYpO0A7tZ+KgUL+0wO6285eUZqyDT275WjwNZRx4WZ F3pguo/PTeD/dTVdEz5DsGunaDNhPJuP67JW1b1l6296HFwjHzA9q4zYKNRZw4/2Lmx7 JXmA== X-Gm-Message-State: AOAM532yg4BCaTbg8kMcGGPxH5q2wQBQ7siOjF8ofEuWSlNnL+8Dnvh6 pwNPCLhneMA0Pwaag/VgT6OC0q76zsvKoQ== X-Google-Smtp-Source: ABdhPJyMEwvX22hYNgXA90jh83tYodDYEw8OhhGTinH3cLPJgFQJRqkxbmUKAVnohjWCfj1STyBKgw== X-Received: by 2002:a05:6808:3022:b0:2d3:13c4:2bb8 with SMTP id ay34-20020a056808302200b002d313c42bb8mr4295815oib.323.1645617121418; Wed, 23 Feb 2022 03:52:01 -0800 (PST) Received: from [192.168.0.10] ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id a4sm27552016oaa.42.2022.02.23.03.52.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Feb 2022 03:52:00 -0800 (PST) Message-ID: <440748d3-4793-d98f-96b5-c9514429d53a@gmail.com> Date: Wed, 23 Feb 2022 08:51:58 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220113015101.4-1-jamrial@gmail.com> <20220113020518.730-2-jamrial@gmail.com> <164561189248.19727.3918458142864400379@lain.red.khirnov.net> From: James Almer In-Reply-To: <164561189248.19727.3918458142864400379@lain.red.khirnov.net> Subject: Re: [FFmpeg-devel] [PATCH 211/281] flac: convert to new channel layout API 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 2/23/2022 7:24 AM, Anton Khirnov wrote: > Quoting James Almer (2022-01-13 03:04:50) >> From: Anton Khirnov >> >> Signed-off-by: Vittorio Giovara >> Signed-off-by: Anton Khirnov >> Signed-off-by: James Almer >> --- >> libavcodec/flac.c | 39 +++++++++++++++++++++------------------ >> libavcodec/flac.h | 2 +- >> libavcodec/flac_parser.c | 7 ++----- >> libavcodec/flacdec.c | 9 ++++----- >> libavcodec/flacenc.c | 26 +++++++++++++------------- >> 5 files changed, 41 insertions(+), 42 deletions(-) >> >> diff --git a/libavcodec/flac.c b/libavcodec/flac.c >> index 7b075d4bd3..51014faea1 100644 >> --- a/libavcodec/flac.c >> +++ b/libavcodec/flac.c >> @@ -29,15 +29,15 @@ >> >> static const int8_t sample_size_table[] = { 0, 8, 12, 0, 16, 20, 24, 0 }; >> >> -static const uint64_t flac_channel_layouts[8] = { >> - AV_CH_LAYOUT_MONO, >> - AV_CH_LAYOUT_STEREO, >> - AV_CH_LAYOUT_SURROUND, >> - AV_CH_LAYOUT_QUAD, >> - AV_CH_LAYOUT_5POINT0, >> - AV_CH_LAYOUT_5POINT1, >> - AV_CH_LAYOUT_6POINT1, >> - AV_CH_LAYOUT_7POINT1 >> +static const AVChannelLayout flac_channel_layouts[8] = { >> + AV_CHANNEL_LAYOUT_MONO, >> + AV_CHANNEL_LAYOUT_STEREO, >> + AV_CHANNEL_LAYOUT_SURROUND, >> + AV_CHANNEL_LAYOUT_QUAD, >> + AV_CHANNEL_LAYOUT_5POINT0, >> + AV_CHANNEL_LAYOUT_5POINT1, >> + AV_CHANNEL_LAYOUT_6POINT1, >> + AV_CHANNEL_LAYOUT_7POINT1 >> }; >> >> static int64_t get_utf8(GetBitContext *gb) >> @@ -193,12 +193,19 @@ int ff_flac_is_extradata_valid(AVCodecContext *avctx, >> return 1; >> } >> >> -void ff_flac_set_channel_layout(AVCodecContext *avctx) >> +void ff_flac_set_channel_layout(AVCodecContext *avctx, int channels) >> { >> - if (avctx->channels <= FF_ARRAY_ELEMS(flac_channel_layouts)) >> - avctx->channel_layout = flac_channel_layouts[avctx->channels - 1]; >> + if (channels == avctx->ch_layout.nb_channels && >> + avctx->ch_layout.order == AV_CHANNEL_ORDER_NATIVE && >> + avctx->ch_layout.u.mask) > > Not sure why I wrote this check like this originally, now it seems > better to check for order != UNSPEC, so that a user-supplied custom > layout is preserved. You didn't write that, i did it to prevent the failure of fate-matroska-flac-extradata-update (a very recent test). Changing it to != UNSPEC also works, so I'll do that. _______________________________________________ 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".