mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-06-13 14:33:03 -04:00
port-config: add internalFormat to PortConfig
Use the Format for all possible formats on the EnumPortConfig and the configured external format on PortConfig. Make a new internalFormat that contains the configured format of the adapter follower. Make pw-top use the PortConfig internalFormat in the FORMAT view and fall back to Format, when not available (for older clients).
This commit is contained in:
parent
d780f4f535
commit
b5555cc3f6
5 changed files with 23 additions and 10 deletions
|
|
@ -40,6 +40,7 @@ static const struct spa_type_info spa_type_param_port_config[] = {
|
|||
{ SPA_PARAM_PORT_CONFIG_control, SPA_TYPE_Bool, SPA_TYPE_INFO_PARAM_PORT_CONFIG_BASE "control", NULL },
|
||||
{ SPA_PARAM_PORT_CONFIG_format, SPA_TYPE_OBJECT_Format, SPA_TYPE_INFO_PARAM_PORT_CONFIG_BASE "format", NULL },
|
||||
{ SPA_PARAM_PORT_CONFIG_group, SPA_TYPE_String, SPA_TYPE_INFO_PARAM_PORT_CONFIG_BASE "group", NULL },
|
||||
{ SPA_PARAM_PORT_CONFIG_internalFormat, SPA_TYPE_OBJECT_Format, SPA_TYPE_INFO_PARAM_PORT_CONFIG_BASE "internalFormat", NULL },
|
||||
{ 0, 0, NULL, NULL },
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,9 @@ enum spa_param_port_config {
|
|||
SPA_PARAM_PORT_CONFIG_mode, /**< (Id enum spa_param_port_config_mode) mode */
|
||||
SPA_PARAM_PORT_CONFIG_monitor, /**< (Bool) enable monitor output ports on input ports */
|
||||
SPA_PARAM_PORT_CONFIG_control, /**< (Bool) enable control ports */
|
||||
SPA_PARAM_PORT_CONFIG_format, /**< (Object) format filter */
|
||||
SPA_PARAM_PORT_CONFIG_format, /**< (Object) possible/external format configuration */
|
||||
SPA_PARAM_PORT_CONFIG_group, /**< (String) the port group name */
|
||||
SPA_PARAM_PORT_CONFIG_internalFormat, /**< (Object) actual internal format */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -173,16 +173,20 @@ static int convert_enum_port_config(struct impl *this,
|
|||
{
|
||||
struct spa_pod *f1, *f2 = NULL, *format = NULL;
|
||||
struct spa_pod_frame f[1];
|
||||
uint32_t fmt_id, fmt_start = 0;
|
||||
uint32_t fmt_id, fmt_start = 0, pc_id;
|
||||
int res;
|
||||
|
||||
if (this->convert == NULL)
|
||||
return 0;
|
||||
|
||||
if (id == SPA_PARAM_EnumPortConfig)
|
||||
if (id == SPA_PARAM_EnumPortConfig) {
|
||||
fmt_id = SPA_PARAM_EnumFormat;
|
||||
else
|
||||
pc_id = SPA_PARAM_PORT_CONFIG_format;
|
||||
}
|
||||
else {
|
||||
fmt_id = SPA_PARAM_Format;
|
||||
pc_id = SPA_PARAM_PORT_CONFIG_internalFormat;
|
||||
}
|
||||
|
||||
res = spa_node_port_enum_params_sync(this->follower,
|
||||
this->direction, 0,
|
||||
|
|
@ -195,7 +199,7 @@ static int convert_enum_port_config(struct impl *this,
|
|||
0);
|
||||
if (res > 0) {
|
||||
spa_pod_builder_add(builder,
|
||||
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(format),
|
||||
pc_id, SPA_POD_Pod(format),
|
||||
0);
|
||||
}
|
||||
f1 = spa_pod_builder_pop(builder, &f[0]);
|
||||
|
|
@ -253,7 +257,8 @@ next:
|
|||
SPA_PARAM_PORT_CONFIG_direction, SPA_POD_Id(this->direction),
|
||||
SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(
|
||||
SPA_PARAM_PORT_CONFIG_MODE_passthrough),
|
||||
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(format));
|
||||
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(format),
|
||||
SPA_PARAM_PORT_CONFIG_internalFormat, SPA_POD_Pod(format));
|
||||
result.next++;
|
||||
res = 1;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -558,7 +558,7 @@ static int node_param_port_config(struct impl *this, uint32_t id, uint32_t index
|
|||
}
|
||||
if (dir->have_format) {
|
||||
spa_pod_builder_prop(b, SPA_PARAM_PORT_CONFIG_format, 0);
|
||||
spa_format_audio_raw_build(b, id, &dir->format.info.raw);
|
||||
spa_format_audio_build(b, id, &dir->format);
|
||||
}
|
||||
*param = spa_pod_builder_pop(b, &f[0]);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -326,14 +326,20 @@ static void node_param(void *data, int seq,
|
|||
struct node *n = data;
|
||||
|
||||
switch (id) {
|
||||
case SPA_PARAM_Format:
|
||||
{
|
||||
handle_format(n, param);
|
||||
break;
|
||||
}
|
||||
case SPA_PARAM_PortConfig:
|
||||
{
|
||||
const struct spa_pod *format = NULL;
|
||||
if (spa_pod_parse_object(param,
|
||||
SPA_TYPE_OBJECT_ParamPortConfig, NULL,
|
||||
SPA_PARAM_PORT_CONFIG_format, SPA_POD_OPT_Pod(&format)) < 0)
|
||||
SPA_PARAM_PORT_CONFIG_internalFormat, SPA_POD_OPT_Pod(&format)) < 0)
|
||||
return;
|
||||
handle_format(n, format);
|
||||
if (format != NULL)
|
||||
handle_format(n, format);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -361,7 +367,7 @@ static struct node *add_node(struct data *d, uint32_t id, const char *name)
|
|||
|
||||
n->proxy = pw_registry_bind(d->registry, id, PW_TYPE_INTERFACE_Node, PW_VERSION_NODE, 0);
|
||||
if (n->proxy) {
|
||||
uint32_t ids[] = { SPA_PARAM_PortConfig };
|
||||
uint32_t ids[] = { SPA_PARAM_Format, SPA_PARAM_PortConfig };
|
||||
|
||||
pw_proxy_add_listener(n->proxy,
|
||||
&n->proxy_listener, &proxy_events, n);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue