summaryrefslogtreecommitdiff
path: root/libavfilter/af_ashowinfo.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2021-08-31 11:03:14 -0300
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:46 -0300
commit1f96db959c1235bb7079d354e09914a0a2608f62 (patch)
tree21ac480d5b148c0524761853e6badb3a90a7ca3f /libavfilter/af_ashowinfo.c
parent8a5896ec1f635ccf0d726f7ba7a06649ebeebf25 (diff)
downloadffmpeg-1f96db959c1235bb7079d354e09914a0a2608f62.tar.gz
avfilter: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavfilter/af_ashowinfo.c')
-rw-r--r--libavfilter/af_ashowinfo.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c
index c76756db63..36ba38b478 100644
--- a/libavfilter/af_ashowinfo.c
+++ b/libavfilter/af_ashowinfo.c
@@ -178,9 +178,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
{
AVFilterContext *ctx = inlink->dst;
AShowInfoContext *s = ctx->priv;
+#if FF_API_OLD_CHANNEL_LAYOUT
+ AVChannelLayout layout = { 0 };
+#endif
char chlayout_str[128];
uint32_t checksum = 0;
- int channels = inlink->channels;
+ int channels = inlink->ch_layout.nb_channels;
int planar = av_sample_fmt_is_planar(buf->format);
int block_align = av_get_bytes_per_sample(buf->format) * (planar ? 1 : channels);
int data_size = buf->nb_samples * block_align;
@@ -200,8 +203,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
s->plane_checksums[0];
}
- av_get_channel_layout_string(chlayout_str, sizeof(chlayout_str), buf->channels,
- buf->channel_layout);
+#if FF_API_OLD_CHANNEL_LAYOUT
+FF_DISABLE_DEPRECATION_WARNINGS
+ if (av_channel_layout_from_mask(&layout, buf->channel_layout)) {
+ av_channel_layout_describe(&layout, chlayout_str, sizeof(chlayout_str));
+FF_ENABLE_DEPRECATION_WARNINGS
+ } else if (buf->ch_layout.nb_channels)
+#endif
+ av_channel_layout_describe(&buf->ch_layout, chlayout_str, sizeof(chlayout_str));
av_log(ctx, AV_LOG_INFO,
"n:%"PRId64" pts:%s pts_time:%s pos:%"PRId64" "
@@ -210,7 +219,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
inlink->frame_count_out,
av_ts2str(buf->pts), av_ts2timestr(buf->pts, &inlink->time_base),
buf->pkt_pos,
- av_get_sample_fmt_name(buf->format), buf->channels, chlayout_str,
+ av_get_sample_fmt_name(buf->format), buf->ch_layout.nb_channels, chlayout_str,
buf->sample_rate, buf->nb_samples,
checksum);