mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
add node set_io function
Also allow setting io areas on nodes. We need this to set the graph clock and period size on the nodes.
This commit is contained in:
parent
a121164df9
commit
66de372e9a
22 changed files with 157 additions and 0 deletions
|
|
@ -179,6 +179,27 @@ struct spa_node {
|
|||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param);
|
||||
|
||||
/**
|
||||
* Configure the given memory area with \a id on \a node. This
|
||||
* structure is allocated by the host and is used to exchange
|
||||
* data and parameters with the node.
|
||||
*
|
||||
* Setting an \a io of NULL will disable the node io.
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
* \param id the id of the io area, the available ids can be
|
||||
* enumerated with the node parameters.
|
||||
* \param data a io area memory
|
||||
* \param size the size of \a data
|
||||
* \return 0 on success
|
||||
* -EINVAL when invalid input is given
|
||||
* -ENOENT when \a id is unknown
|
||||
* -ENOSPC when \a size is too small
|
||||
*/
|
||||
int (*set_io) (struct spa_node *node,
|
||||
uint32_t id, void *data, size_t size);
|
||||
|
||||
/**
|
||||
* Send a command to a node.
|
||||
*
|
||||
|
|
@ -482,6 +503,7 @@ struct spa_node {
|
|||
|
||||
#define spa_node_enum_params(n,...) (n)->enum_params((n),__VA_ARGS__)
|
||||
#define spa_node_set_param(n,...) (n)->set_param((n),__VA_ARGS__)
|
||||
#define spa_node_set_io(n,...) (n)->set_io((n),__VA_ARGS__)
|
||||
#define spa_node_send_command(n,...) (n)->send_command((n),__VA_ARGS__)
|
||||
#define spa_node_set_callbacks(n,...) (n)->set_callbacks((n),__VA_ARGS__)
|
||||
#define spa_node_get_n_ports(n,...) (n)->get_n_ports((n),__VA_ARGS__)
|
||||
|
|
|
|||
|
|
@ -159,6 +159,11 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
|
|
@ -668,6 +673,7 @@ static const struct spa_node impl_node = {
|
|||
&node_info,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -157,6 +157,11 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
|
|
@ -678,6 +683,7 @@ static const struct spa_node impl_node = {
|
|||
&node_info,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -442,6 +442,11 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
|
|
@ -835,6 +840,7 @@ static const struct spa_node impl_node = {
|
|||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -519,6 +519,11 @@ static int apply_props(struct impl *this, const struct spa_pod *param)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
|
|
@ -1152,6 +1157,7 @@ static const struct spa_node impl_node = {
|
|||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -195,6 +195,11 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -883,6 +888,7 @@ static const struct spa_node impl_node = {
|
|||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -155,6 +155,11 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
|
|
@ -889,6 +894,7 @@ static const struct spa_node impl_node = {
|
|||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -156,6 +156,11 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -775,6 +780,7 @@ static const struct spa_node impl_node = {
|
|||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -159,6 +159,11 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
|
|
@ -912,6 +917,7 @@ static const struct spa_node impl_node = {
|
|||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -134,6 +134,11 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -910,6 +915,7 @@ static const struct spa_node impl_node = {
|
|||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -269,6 +269,11 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
#include "render.c"
|
||||
|
||||
static void set_timer(struct impl *this, bool enabled)
|
||||
|
|
@ -970,6 +975,7 @@ static const struct spa_node impl_node = {
|
|||
&node_info,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -229,6 +229,11 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
|
|
@ -1273,6 +1278,7 @@ static const struct spa_node impl_node = {
|
|||
&node_info,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -83,6 +83,11 @@ static int spa_ffmpeg_dec_node_set_param(struct spa_node *node,
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int spa_ffmpeg_dec_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int spa_ffmpeg_dec_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -469,6 +474,7 @@ static const struct spa_node ffmpeg_dec_node = {
|
|||
NULL,
|
||||
spa_ffmpeg_dec_node_enum_params,
|
||||
spa_ffmpeg_dec_node_set_param,
|
||||
spa_ffmpeg_dec_node_set_io,
|
||||
spa_ffmpeg_dec_node_send_command,
|
||||
spa_ffmpeg_dec_node_set_callbacks,
|
||||
spa_ffmpeg_dec_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -85,6 +85,11 @@ static int spa_ffmpeg_enc_node_set_param(struct spa_node *node, uint32_t id, uin
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int spa_ffmpeg_enc_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int spa_ffmpeg_enc_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -446,6 +451,7 @@ static const struct spa_node ffmpeg_enc_node = {
|
|||
NULL,
|
||||
spa_ffmpeg_enc_node_enum_params,
|
||||
spa_ffmpeg_enc_node_set_param,
|
||||
spa_ffmpeg_enc_node_set_io,
|
||||
spa_ffmpeg_enc_node_send_command,
|
||||
spa_ffmpeg_enc_node_set_callbacks,
|
||||
spa_ffmpeg_enc_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -141,6 +141,11 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
|
|
@ -706,6 +711,7 @@ static const struct spa_node impl_node = {
|
|||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -152,6 +152,11 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
|
|
@ -741,6 +746,7 @@ static const struct spa_node impl_node = {
|
|||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -265,6 +265,11 @@ static int impl_node_set_param(struct spa_node *node,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -910,6 +915,7 @@ static const struct spa_node impl_node = {
|
|||
&info,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -201,6 +201,11 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
|
|
@ -839,6 +844,7 @@ static const struct spa_node impl_node = {
|
|||
&node_info,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -180,6 +180,11 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
|
|
@ -794,6 +799,7 @@ static const struct spa_node impl_node = {
|
|||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -131,6 +131,11 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
{
|
||||
struct impl *this;
|
||||
|
|
@ -856,6 +861,7 @@ static const struct spa_node impl_node = {
|
|||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -396,6 +396,20 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
return SPA_RESULT_RETURN_ASYNC(this->seq++);
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
struct node *this;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct node, node);
|
||||
|
||||
if (this->resource == NULL)
|
||||
return 0;
|
||||
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
{
|
||||
struct node *this;
|
||||
|
|
@ -1129,6 +1143,7 @@ static const struct spa_node impl_node = {
|
|||
NULL,
|
||||
.enum_params = impl_node_enum_params,
|
||||
.set_param = impl_node_set_param,
|
||||
.set_io = impl_node_set_io,
|
||||
.send_command = impl_node_send_command,
|
||||
.set_callbacks = impl_node_set_callbacks,
|
||||
.get_n_ports = impl_node_get_n_ports,
|
||||
|
|
|
|||
|
|
@ -239,6 +239,11 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
|||
return res;
|
||||
}
|
||||
|
||||
static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size_t size)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
{
|
||||
struct node *this;
|
||||
|
|
@ -890,6 +895,7 @@ static const struct spa_node impl_node = {
|
|||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
impl_node_send_command,
|
||||
impl_node_set_callbacks,
|
||||
impl_node_get_n_ports,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue