node: Add ParamBegin/End

Use these commands to mark the begin and end of a series of Param
enumerations and configuration, like when doing format negotiation. The
idea is that the device can remain open while we do this.
Use this in adapter when negotiating a format.
This commit is contained in:
Wim Taymans 2020-12-09 17:10:52 +01:00
parent ccfe439786
commit 4e7be858e4
8 changed files with 55 additions and 10 deletions

View file

@ -459,6 +459,9 @@ static int negotiate_format(struct impl *this)
state = 0;
format = NULL;
spa_node_send_command(this->follower,
&SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_ParamBegin));
if (this->have_format)
format = spa_format_audio_raw_build(&b, SPA_PARAM_Format, &this->follower_current_format.info.raw);
@ -471,7 +474,7 @@ static int negotiate_format(struct impl *this)
else {
debug_params(this, this->follower, this->direction, 0,
SPA_PARAM_EnumFormat, format, "follower format", res);
return res;
goto done;
}
}
@ -484,16 +487,23 @@ static int negotiate_format(struct impl *this)
debug_params(this, this->convert,
SPA_DIRECTION_REVERSE(this->direction), 0,
SPA_PARAM_EnumFormat, format, "convert format", res);
return -ENOTSUP;
res = -ENOTSUP;
goto done;
}
}
if (format == NULL)
return -ENOTSUP;
if (format == NULL) {
res = -ENOTSUP;
goto done;
}
spa_pod_fixate(format);
res = configure_format(this, 0, format);
done:
spa_node_send_command(this->follower,
&SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_ParamEnd));
return res;
}