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 2C45F423DE for ; Mon, 17 Jan 2022 13:33:08 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 785B068AFDF; Mon, 17 Jan 2022 15:33:06 +0200 (EET) Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 24D0D68AEF0 for ; Mon, 17 Jan 2022 15:33:00 +0200 (EET) Received: by mail-oi1-f181.google.com with SMTP id s127so23416210oig.2 for ; Mon, 17 Jan 2022 05:33:00 -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:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=DFKffswxXccpF6budeYe8U+pJvjrnN23UL/YJzoROto=; b=fQKUSaUs47u1Xp5jZBbRAg5TdnJfk30YH7oAkN5qhdpwx7fScqjWWhcqBaC5mYk+V0 vB1fwkGpMlIEfycgW66PkdMmnqW2KsWy2BIhLjyQymxx/EaVMLIEW9F+kko2yQG4Pum/ E4TCFjbJj3KjFz22bJ7bCZ9uOpt6TzG/KqTfd45sMT3T5wwlp9zgrh73oMldxohnNKg7 /ZPD58EJVSgBBfogw9pvWYeFIg+DalKcyDOt/gZK/MVXhrw6Kq97LFb9qJuHPeMsCOfW SpjIbaoBnHBczCeDggA8xz7RlsLYMk4abvFKmmYgobblpv216ZBxPGqlPeCCZmkdcf9H NC1w== 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=DFKffswxXccpF6budeYe8U+pJvjrnN23UL/YJzoROto=; b=OGny9VgCizQg/J7anir64UBdXZxDVQEA3W39SyRxNJZfDkCg7PG4rrzSaekrH3ipTI 1OK8Iw4ksS/3KK47OFgxAXUWKXfc3HLWoMAByf5aUSGSgXzOjZ+w0HICCBJinUoB4wfK 3b1JHdaP+MmKpQZmnxiOfGRb9UFELma86r8gDVvrIC1Rix6gVToUNyTIyLwzLPieNpEo M0hbhZReApevAn6bMOuFUo1bAm7kZh+eutXmh0S8QkhVgSwPJuGd7iT/w0X5pSQjVoCT DlPWn8gzBUpEuFXOL8pGvzsJchZ0Pxc2jG0R5deGuDf8nJODvJoTI29cQaAd5N/G0V2h /2/g== X-Gm-Message-State: AOAM532cxFQN3KjnDHe80nx9VEvu1oLSs4HB20sEUITJq+UdNbp0wdmA 3MKvmWBkgS7xOP4hG7lA9wjmgrAIt3Y= X-Google-Smtp-Source: ABdhPJzJIm/oANPLZKQpiFcjN18URIV1oFSmcXa6w/BCounHY1m+VRViJax7YTyqh0Zp+z8Crt5N0A== X-Received: by 2002:a05:6808:3b3:: with SMTP id n19mr13320578oie.41.1642426378111; Mon, 17 Jan 2022 05:32:58 -0800 (PST) Received: from [192.168.0.13] ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id bk20sm6359661oib.19.2022.01.17.05.32.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Jan 2022 05:32:57 -0800 (PST) Message-ID: Date: Mon, 17 Jan 2022 10:32:54 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220113015101.4-1-jamrial@gmail.com> <20220113015101.4-2-jamrial@gmail.com> From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 001/281] Add a 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 1/16/2022 8:27 AM, Nicolas George wrote: > James Almer (12022-01-12): >> From: Anton Khirnov >> >> The new API is more extensible and allows for custom layouts. >> More accurate information is exported, eg for decoders that do not >> set a channel layout, lavc will not make one up for them. >> >> Deprecate the old API working with just uint64_t bitmasks. >> >> Expanded and completed by Vittorio Giovara >> and James Almer . >> Signed-off-by: Vittorio Giovara >> Signed-off-by: James Almer >> --- >> libavutil/channel_layout.c | 629 ++++++++++++++++++++++++++++++++----- >> libavutil/channel_layout.h | 542 ++++++++++++++++++++++++++++++-- >> libavutil/version.h | 1 + >> 3 files changed, 1069 insertions(+), 103 deletions(-) > > Thank you. I have no fundamental objection to the design of the API as > it is, but the user interface and documentation is still missing, that > needs to be addressed before the patch goes in. > > (But IIRC, Marton had other requirements, so let us wait for him to > weigh in.) > >> +/** >> + * Initialize a channel layout from a given string description. >> + * The input string can be represented by: >> + * - the formal channel layout name (returned by av_channel_layout_describe()) >> + * - single or multiple channel names (returned by av_channel_name() >> + * or concatenated with "+") >> + * - a hexadecimal value of a channel layout (eg. "0x4") >> + * - the number of channels with default layout (eg. "5c") >> + * - the number of unordered channels (eg. "4", "4C", or "4 channels") >> + * >> + * @param channel_layout input channel layout >> + * @param str string describing the channel layout >> + * @return 0 channel layout was detected, AVERROR_INVALIDATATA otherwise >> + */ >> +int av_channel_layout_from_string(AVChannelLayout *channel_layout, >> + const char *str); > > The documentation for the syntax needs to be in the user documentation, > with examples, not just in the API documentation. I'll look into it. > >> +/** >> + * This is the inverse function of @ref av_channel_name(). >> + * >> + * @return the channel with the given name >> + * AV_CHAN_NONE when name does not identify a known channel >> + */ >> +enum AVChannel av_channel_from_string(const char *name); > >> +/** >> + * Get a channel described by the given string. >> + * >> + * This function accepts channel names in the same format as >> + * @ref av_channel_from_string(). >> + * >> + * @param channel_layout input channel layout >> + * @return a channel described by the given string, or a negative AVERROR value. >> + */ >> +int av_channel_layout_channel_from_string(const AVChannelLayout *channel_layout, >> + const char *name); > > This looks to be the preferred function for when the user will specify a > channel in a layout. > > First, this fact should be stated clearly in the introduction of the > documentation. Otherwise, people will likely use other functions, > probably av_channel_layout_channel_from_index(). And they can if they want to. It has a very specific purpose and it fulfills it. > > Second, the "name" argument cannot be just a name argument: the user > must be able to say "the third FC channel" or "the FC channel with name > 'piano'". And probably both at once. > > idx = av_channel_layout_channel_from_string(layout, "FC"); > idx = av_channel_layout_channel_from_string(layout, "FC#2"); > idx = av_channel_layout_channel_from_string(layout, "FC[piano]"); > idx = av_channel_layout_channel_from_string(layout, "FC[piano]#2"); Please, stop asking for this. It's an incredibly niche usecase you want for libavfilter, so you can and should implement it there. The API is there and you can use it, you don't need to overdesign these general purpose helpers to create these bizarre scenarios just to remove one or two filters from your chain. You have the opaque field in both the layout and each channel. You can store a pointer there to anything you want at any point in your chain, like an internal and refcounted lavfi struct that stores all this information filters in the chain can parse and use. This is a layout of speaker positions. If you want metadata, use metadata. > > (I think it would be acceptable to limit the name, for example "names > with non-alphanumeric ASCII characters are not supported.) > > And this need to go in the user documentation. > > I am not sure if we also need a function to extract "all the FL channels > with name 'piano'". > > Regards, > > > _______________________________________________ > 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". _______________________________________________ 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".