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_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_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_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 },
|
{ 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_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_monitor, /**< (Bool) enable monitor output ports on input ports */
|
||||||
SPA_PARAM_PORT_CONFIG_control, /**< (Bool) enable control 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_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 *f1, *f2 = NULL, *format = NULL;
|
||||||
struct spa_pod_frame f[1];
|
struct spa_pod_frame f[1];
|
||||||
uint32_t fmt_id, fmt_start = 0;
|
uint32_t fmt_id, fmt_start = 0, pc_id;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if (this->convert == NULL)
|
if (this->convert == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (id == SPA_PARAM_EnumPortConfig)
|
if (id == SPA_PARAM_EnumPortConfig) {
|
||||||
fmt_id = SPA_PARAM_EnumFormat;
|
fmt_id = SPA_PARAM_EnumFormat;
|
||||||
else
|
pc_id = SPA_PARAM_PORT_CONFIG_format;
|
||||||
|
}
|
||||||
|
else {
|
||||||
fmt_id = SPA_PARAM_Format;
|
fmt_id = SPA_PARAM_Format;
|
||||||
|
pc_id = SPA_PARAM_PORT_CONFIG_internalFormat;
|
||||||
|
}
|
||||||
|
|
||||||
res = spa_node_port_enum_params_sync(this->follower,
|
res = spa_node_port_enum_params_sync(this->follower,
|
||||||
this->direction, 0,
|
this->direction, 0,
|
||||||
|
|
@ -195,7 +199,7 @@ static int convert_enum_port_config(struct impl *this,
|
||||||
0);
|
0);
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
spa_pod_builder_add(builder,
|
spa_pod_builder_add(builder,
|
||||||
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(format),
|
pc_id, SPA_POD_Pod(format),
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
f1 = spa_pod_builder_pop(builder, &f[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_direction, SPA_POD_Id(this->direction),
|
||||||
SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(
|
SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(
|
||||||
SPA_PARAM_PORT_CONFIG_MODE_passthrough),
|
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++;
|
result.next++;
|
||||||
res = 1;
|
res = 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -558,7 +558,7 @@ static int node_param_port_config(struct impl *this, uint32_t id, uint32_t index
|
||||||
}
|
}
|
||||||
if (dir->have_format) {
|
if (dir->have_format) {
|
||||||
spa_pod_builder_prop(b, SPA_PARAM_PORT_CONFIG_format, 0);
|
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]);
|
*param = spa_pod_builder_pop(b, &f[0]);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -326,14 +326,20 @@ static void node_param(void *data, int seq,
|
||||||
struct node *n = data;
|
struct node *n = data;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
case SPA_PARAM_Format:
|
||||||
|
{
|
||||||
|
handle_format(n, param);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SPA_PARAM_PortConfig:
|
case SPA_PARAM_PortConfig:
|
||||||
{
|
{
|
||||||
const struct spa_pod *format = NULL;
|
const struct spa_pod *format = NULL;
|
||||||
if (spa_pod_parse_object(param,
|
if (spa_pod_parse_object(param,
|
||||||
SPA_TYPE_OBJECT_ParamPortConfig, NULL,
|
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;
|
return;
|
||||||
handle_format(n, format);
|
if (format != NULL)
|
||||||
|
handle_format(n, format);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
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);
|
n->proxy = pw_registry_bind(d->registry, id, PW_TYPE_INTERFACE_Node, PW_VERSION_NODE, 0);
|
||||||
if (n->proxy) {
|
if (n->proxy) {
|
||||||
uint32_t ids[] = { SPA_PARAM_PortConfig };
|
uint32_t ids[] = { SPA_PARAM_Format, SPA_PARAM_PortConfig };
|
||||||
|
|
||||||
pw_proxy_add_listener(n->proxy,
|
pw_proxy_add_listener(n->proxy,
|
||||||
&n->proxy_listener, &proxy_events, n);
|
&n->proxy_listener, &proxy_events, n);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue