diff options
author | James Almer <jamrial@gmail.com> | 2021-08-31 11:03:14 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-15 09:42:46 -0300 |
commit | 1f96db959c1235bb7079d354e09914a0a2608f62 (patch) | |
tree | 21ac480d5b148c0524761853e6badb3a90a7ca3f /libavfilter/avf_showspectrum.c | |
parent | 8a5896ec1f635ccf0d726f7ba7a06649ebeebf25 (diff) |
avfilter: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavfilter/avf_showspectrum.c')
-rw-r--r-- | libavfilter/avf_showspectrum.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c index 237b5955bb..30ee701c12 100644 --- a/libavfilter/avf_showspectrum.c +++ b/libavfilter/avf_showspectrum.c @@ -758,8 +758,7 @@ static int draw_legend(AVFilterContext *ctx, uint64_t samples) uint8_t *dst; char chlayout_str[128]; - av_get_channel_layout_string(chlayout_str, sizeof(chlayout_str), inlink->channels, - inlink->channel_layout); + av_channel_layout_describe(&inlink->ch_layout, chlayout_str, sizeof(chlayout_str)); text = av_asprintf("%d Hz | %s", inlink->sample_rate, chlayout_str); if (!text) @@ -1061,8 +1060,8 @@ static int config_output(AVFilterLink *outlink) outlink->h += s->start_y * 2; } - h = (s->mode == COMBINED || s->orientation == HORIZONTAL) ? s->h : s->h / inlink->channels; - w = (s->mode == COMBINED || s->orientation == VERTICAL) ? s->w : s->w / inlink->channels; + h = (s->mode == COMBINED || s->orientation == HORIZONTAL) ? s->h : s->h / inlink->ch_layout.nb_channels; + w = (s->mode == COMBINED || s->orientation == VERTICAL) ? s->w : s->w / inlink->ch_layout.nb_channels; s->channel_height = h; s->channel_width = w; @@ -1078,14 +1077,14 @@ static int config_output(AVFilterLink *outlink) s->buf_size = FFALIGN(s->win_size << (!!s->stop), av_cpu_max_align()); if (!s->fft) { - s->fft = av_calloc(inlink->channels, sizeof(*s->fft)); + s->fft = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->fft)); if (!s->fft) return AVERROR(ENOMEM); } if (s->stop) { if (!s->ifft) { - s->ifft = av_calloc(inlink->channels, sizeof(*s->ifft)); + s->ifft = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->ifft)); if (!s->ifft) return AVERROR(ENOMEM); } @@ -1111,7 +1110,7 @@ static int config_output(AVFilterLink *outlink) } av_freep(&s->fft_data); - s->nb_display_channels = inlink->channels; + s->nb_display_channels = inlink->ch_layout.nb_channels; for (i = 0; i < s->nb_display_channels; i++) { float scale; @@ -1728,7 +1727,7 @@ static int showspectrumpic_request_frame(AVFilterLink *outlink) acc_samples += nb_samples; av_samples_copy(fin->extended_data, cur_frame->extended_data, dst_offset, src_offset, nb_samples, - cur_frame->channels, AV_SAMPLE_FMT_FLTP); + cur_frame->ch_layout.nb_channels, AV_SAMPLE_FMT_FLTP); } src_offset += nb_samples; |