summaryrefslogtreecommitdiff
path: root/libavfilter/avfilter.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/avfilter.c
parent8a5896ec1f635ccf0d726f7ba7a06649ebeebf25 (diff)
avfilter: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r--libavfilter/avfilter.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 1f37a70179..9a6ba0695f 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -204,6 +204,7 @@ void avfilter_link_free(AVFilterLink **link)
ff_framequeue_free(&(*link)->fifo);
ff_frame_pool_uninit((FFFramePool**)&(*link)->frame_pool);
+ av_channel_layout_uninit(&(*link)->ch_layout);
av_freep(link);
}
@@ -405,7 +406,7 @@ void ff_tlog_link(void *ctx, AVFilterLink *link, int end)
end ? "\n" : "");
} else {
char buf[128];
- av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
+ av_channel_layout_describe(&link->ch_layout, buf, sizeof(buf));
ff_tlog(ctx,
"link[%p r:%d cl:%s fmt:%s %s->%s]%s",
@@ -1036,11 +1037,7 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
av_log(link->dst, AV_LOG_ERROR, "Format change is not supported\n");
goto error;
}
- if (frame->channels != link->channels) {
- av_log(link->dst, AV_LOG_ERROR, "Channel count change is not supported\n");
- goto error;
- }
- if (frame->channel_layout != link->channel_layout) {
+ if (av_channel_layout_compare(&frame->ch_layout, &link->ch_layout)) {
av_log(link->dst, AV_LOG_ERROR, "Channel layout change is not supported\n");
goto error;
}
@@ -1117,7 +1114,7 @@ static int take_samples(AVFilterLink *link, unsigned min, unsigned max,
for (i = 0; i < nb_frames; i++) {
frame = ff_framequeue_take(&link->fifo);
av_samples_copy(buf->extended_data, frame->extended_data, p, 0,
- frame->nb_samples, link->channels, link->format);
+ frame->nb_samples, link->ch_layout.nb_channels, link->format);
p += frame->nb_samples;
av_frame_free(&frame);
}
@@ -1125,7 +1122,7 @@ static int take_samples(AVFilterLink *link, unsigned min, unsigned max,
unsigned n = nb_samples - p;
frame = ff_framequeue_peek(&link->fifo, 0);
av_samples_copy(buf->extended_data, frame->extended_data, p, 0, n,
- link->channels, link->format);
+ link->ch_layout.nb_channels, link->format);
ff_framequeue_skip_samples(&link->fifo, n, link->time_base);
}