From 50e9e11316064ecdee889b18a0b6681a248edcf4 Mon Sep 17 00:00:00 2001 From: James Almer Date: Thu, 20 Jan 2022 16:38:44 -0300 Subject: [PATCH] tools: convert to new channel layout-API Signed-off-by: James Almer --- tools/graph2dot.c | 3 +-- tools/ismindex.c | 2 +- tools/sidxindex.c | 2 +- tools/uncoded_frame.c | 5 +++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/graph2dot.c b/tools/graph2dot.c index fd7ea2848e..d96bfd8126 100644 --- a/tools/graph2dot.c +++ b/tools/graph2dot.c @@ -91,8 +91,7 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph) link->time_base.num, link->time_base.den); } else if (link->type == AVMEDIA_TYPE_AUDIO) { char buf[255]; - av_get_channel_layout_string(buf, sizeof(buf), -1, - link->channel_layout); + av_channel_layout_describe(&link->ch_layout, buf, sizeof(buf)); fprintf(outfile, "fmt:%s sr:%d cl:%s tb:%d/%d", av_get_sample_fmt_name(link->format), diff --git a/tools/ismindex.c b/tools/ismindex.c index d355cffe38..39b5378190 100644 --- a/tools/ismindex.c +++ b/tools/ismindex.c @@ -574,7 +574,7 @@ static int handle_file(struct Tracks *tracks, const char *file, int split, if (tracks->audio_track < 0) tracks->audio_track = tracks->nb_tracks; tracks->nb_audio_tracks++; - track->channels = st->codecpar->channels; + track->channels = st->codecpar->ch_layout.nb_channels; track->sample_rate = st->codecpar->sample_rate; if (st->codecpar->codec_id == AV_CODEC_ID_AAC) { track->fourcc = "AACL"; diff --git a/tools/sidxindex.c b/tools/sidxindex.c index a4f95515e4..88aea6bcb9 100644 --- a/tools/sidxindex.c +++ b/tools/sidxindex.c @@ -191,7 +191,7 @@ static int handle_file(struct Tracks *tracks, const char *file) track->timescale, AV_ROUND_UP)); if (track->is_audio) { - track->channels = st->codecpar->channels; + track->channels = st->codecpar->ch_layout.nb_channels; track->sample_rate = st->codecpar->sample_rate; } if (track->is_video) { diff --git a/tools/uncoded_frame.c b/tools/uncoded_frame.c index f441d3fbdc..edea2367c4 100644 --- a/tools/uncoded_frame.c +++ b/tools/uncoded_frame.c @@ -173,8 +173,9 @@ int main(int argc, char **argv) st->stream->codecpar->format = av_buffersink_get_format(st->sink); break; case AVMEDIA_TYPE_AUDIO: - st->stream->codecpar->channel_layout = av_buffersink_get_channel_layout(st->sink); - st->stream->codecpar->channels = av_buffersink_get_channels(st->sink); + ret = av_buffersink_get_ch_layout(st->sink, &st->stream->codecpar->ch_layout); + if (ret < 0) + goto fail; st->stream->codecpar->sample_rate = av_buffersink_get_sample_rate(st->sink); st->stream->codecpar->format = av_buffersink_get_format(st->sink); st->stream->codecpar->codec_id = av_get_pcm_codec(st->stream->codecpar->format, -1);