[FFmpeg-devel] [PATCH 1/4] avutil/channel_layout: print channels using av_channel_name_bprint in av_channel_layout_describe_bprint
James Almer
jamrial at gmail.com
Tue Mar 15 22:44:55 EET 2022
On 3/15/2022 5:30 PM, Marton Balint wrote:
> 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 <cus at passwd.hu>
> ---
> 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);
Should be ok.
More information about the ffmpeg-devel
mailing list