From ed80d72d516b758f608fedc2026b4e8af3b3c00c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 14 Jun 2021 12:11:10 +0200 Subject: [PATCH] audioconvert: also set io_position on channelmix Also make the channelmix node aware of the io_position so that is can use this later to get the default rate. --- spa/plugins/audioconvert/audioconvert.c | 1 + spa/plugins/audioconvert/channelmix.c | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index 7d4abfb00..558dad2a3 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -557,6 +557,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size) switch (id) { case SPA_IO_Position: res = spa_node_set_io(this->resample, id, data, size); + res = spa_node_set_io(this->channelmix, id, data, size); res = spa_node_set_io(this->fmt[0], id, data, size); res = spa_node_set_io(this->fmt[1], id, data, size); break; diff --git a/spa/plugins/audioconvert/channelmix.c b/spa/plugins/audioconvert/channelmix.c index 7cfe7193e..f17ab25f9 100644 --- a/spa/plugins/audioconvert/channelmix.c +++ b/spa/plugins/audioconvert/channelmix.c @@ -144,6 +144,8 @@ struct impl { struct spa_log *log; struct spa_cpu *cpu; + struct spa_io_position *io_position; + struct spa_hook_list hooks; uint64_t info_all; @@ -595,7 +597,20 @@ static int apply_midi(struct impl *this, const struct spa_pod *value) static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size) { - return -ENOTSUP; + struct impl *this = object; + + spa_return_val_if_fail(this != NULL, -EINVAL); + + spa_log_debug(this->log, NAME " %p: io %d %p/%zd", this, id, data, size); + + switch (id) { + case SPA_IO_Position: + this->io_position = data; + break; + default: + return -ENOENT; + } + return 0; } static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,