From e8ac4e6a3414a40f47685ab128993b70413eb190 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 17 Apr 2024 16:05:18 +0200 Subject: [PATCH] spa: add SPA_IO_AsyncBuffers This structure has 2 io_buffers. Readers and writers operate on different io_buffers to implement an asynchronous transfer. --- spa/include/spa/node/io.h | 7 +++++++ spa/include/spa/node/type-info.h | 1 + test/test-spa-node.c | 1 + 3 files changed, 9 insertions(+) diff --git a/spa/include/spa/node/io.h b/spa/include/spa/node/io.h index 35661e0b7..a0a2c90f7 100644 --- a/spa/include/spa/node/io.h +++ b/spa/include/spa/node/io.h @@ -40,6 +40,7 @@ enum spa_io_type { SPA_IO_Position, /**< position information in the graph, struct spa_io_position */ SPA_IO_RateMatch, /**< rate matching between nodes, struct spa_io_rate_match */ SPA_IO_Memory, /**< memory pointer, struct spa_io_memory (currently not used in PipeWire) */ + SPA_IO_AsyncBuffers, /**< async area to exchange buffers, struct spa_io_async_buffers */ }; /** @@ -307,6 +308,12 @@ struct spa_io_rate_match { uint32_t padding[7]; }; +/** async buffers */ +struct spa_io_async_buffers { + struct spa_io_buffers buffers[2]; /**< async buffers, writers write to current (cycle+1)&1, + * readers read from (cycle)&1 */ +}; + /** * \} */ diff --git a/spa/include/spa/node/type-info.h b/spa/include/spa/node/type-info.h index 1f3ce8d0d..5b956348b 100644 --- a/spa/include/spa/node/type-info.h +++ b/spa/include/spa/node/type-info.h @@ -34,6 +34,7 @@ static const struct spa_type_info spa_type_io[] = { { SPA_IO_Position, SPA_TYPE_Int, SPA_TYPE_INFO_IO_BASE "Position", NULL }, { SPA_IO_RateMatch, SPA_TYPE_Int, SPA_TYPE_INFO_IO_BASE "RateMatch", NULL }, { SPA_IO_Memory, SPA_TYPE_Int, SPA_TYPE_INFO_IO_BASE "Memory", NULL }, + { SPA_IO_AsyncBuffers, SPA_TYPE_Int, SPA_TYPE_INFO_IO_BASE "AsyncBuffers", NULL }, { 0, 0, NULL, NULL }, }; diff --git a/test/test-spa-node.c b/test/test-spa-node.c index 72ffe64da..4b91d3c76 100644 --- a/test/test-spa-node.c +++ b/test/test-spa-node.c @@ -71,6 +71,7 @@ PWTEST(node_io_abi) pwtest_int_eq(SPA_IO_Position, 7); pwtest_int_eq(SPA_IO_RateMatch, 8); pwtest_int_eq(SPA_IO_Memory, 9); + pwtest_int_eq(SPA_IO_AsyncBuffers, 10); /* position state */ pwtest_int_eq(SPA_IO_POSITION_STATE_STOPPED, 0);