spa: add SPA_IO_AsyncBuffers

This structure has 2 io_buffers. Readers and writers operate on different
io_buffers to implement an asynchronous transfer.
This commit is contained in:
Wim Taymans 2024-04-17 16:05:18 +02:00
parent 84ed9c0fe9
commit e8ac4e6a34
3 changed files with 9 additions and 0 deletions

View file

@ -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 */
};
/**
* \}
*/

View file

@ -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 },
};

View file

@ -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);