mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
node: remove info from node interface
Replace with info event emited when callbacks are set. This makes it easier to implement dynamic changes.
This commit is contained in:
parent
57e94f7bc4
commit
7bc9c1ebfe
23 changed files with 69 additions and 89 deletions
|
|
@ -129,10 +129,6 @@ struct spa_node {
|
|||
* structure in the future */
|
||||
#define SPA_VERSION_NODE 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Extra information about the node
|
||||
*/
|
||||
const struct spa_dict *info;
|
||||
/**
|
||||
* Enumerate the parameters of a node.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -242,6 +242,11 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct spa_dict_item node_info_items[] = {
|
||||
{ "media.class", "Audio/Sink" },
|
||||
{ "node.driver", "true" },
|
||||
};
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
|
|
@ -256,6 +261,11 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
this->callbacks = callbacks;
|
||||
this->callbacks_data = data;
|
||||
|
||||
if (callbacks) {
|
||||
if (callbacks->info)
|
||||
callbacks->info(data, &SPA_DICT_INIT_ARRAY(node_info_items));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -675,19 +685,8 @@ static int impl_node_process(struct spa_node *node)
|
|||
return SPA_STATUS_HAVE_BUFFER;
|
||||
}
|
||||
|
||||
static const struct spa_dict_item node_info_items[] = {
|
||||
{ "media.class", "Audio/Sink" },
|
||||
{ "node.driver", "true" },
|
||||
};
|
||||
|
||||
static const struct spa_dict node_info = {
|
||||
node_info_items,
|
||||
SPA_N_ELEMENTS(node_info_items)
|
||||
};
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
&node_info,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -244,6 +244,11 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct spa_dict_item node_info_items[] = {
|
||||
{ "media.class", "Audio/Source" },
|
||||
{ "node.driver", "true" },
|
||||
};
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
|
|
@ -258,6 +263,10 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
this->callbacks = callbacks;
|
||||
this->callbacks_data = data;
|
||||
|
||||
if (callbacks) {
|
||||
if (callbacks->info)
|
||||
callbacks->info(data, &SPA_DICT_INIT_ARRAY(node_info_items));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -686,19 +695,8 @@ static int impl_node_process(struct spa_node *node)
|
|||
return SPA_STATUS_HAVE_BUFFER;
|
||||
}
|
||||
|
||||
static const struct spa_dict_item node_info_items[] = {
|
||||
{ "media.class", "Audio/Source" },
|
||||
{ "node.driver", "true" },
|
||||
};
|
||||
|
||||
static const struct spa_dict node_info = {
|
||||
node_info_items,
|
||||
SPA_N_ELEMENTS(node_info_items)
|
||||
};
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
&node_info,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -897,7 +897,6 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -1166,7 +1166,6 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -893,7 +893,6 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -914,7 +914,6 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -848,7 +848,6 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -937,7 +937,6 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -917,7 +917,6 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -448,6 +448,10 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct spa_dict_item node_info_items[] = {
|
||||
{ "media.class", "Audio/Source" },
|
||||
};
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
|
|
@ -462,6 +466,11 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
this->callbacks = callbacks;
|
||||
this->callbacks_data = data;
|
||||
|
||||
if (callbacks) {
|
||||
if (callbacks->info)
|
||||
callbacks->info(data, &SPA_DICT_INIT_ARRAY(node_info_items));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -966,15 +975,6 @@ static int impl_node_process(struct spa_node *node)
|
|||
return SPA_STATUS_OK;
|
||||
}
|
||||
|
||||
static const struct spa_dict_item node_info_items[] = {
|
||||
{ "media.class", "Audio/Source" },
|
||||
};
|
||||
|
||||
static const struct spa_dict node_info = {
|
||||
node_info_items,
|
||||
SPA_N_ELEMENTS(node_info_items)
|
||||
};
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
&node_info,
|
||||
|
|
|
|||
|
|
@ -842,6 +842,11 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct spa_dict_item node_info_items[] = {
|
||||
{ "media.class", "Audio/Sink" },
|
||||
{ "node.driver", "true" },
|
||||
};
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
|
|
@ -856,6 +861,11 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
this->callbacks = callbacks;
|
||||
this->callbacks_data = data;
|
||||
|
||||
if (callbacks) {
|
||||
if (callbacks->info)
|
||||
callbacks->info(data, &SPA_DICT_INIT_ARRAY(node_info_items));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1283,19 +1293,8 @@ static int impl_node_process(struct spa_node *node)
|
|||
return SPA_STATUS_HAVE_BUFFER;
|
||||
}
|
||||
|
||||
static const struct spa_dict_item node_info_items[] = {
|
||||
{ "media.class", "Audio/Sink" },
|
||||
{ "node.driver", "true" },
|
||||
};
|
||||
|
||||
static const struct spa_dict node_info = {
|
||||
node_info_items,
|
||||
SPA_N_ELEMENTS(node_info_items)
|
||||
};
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
&node_info,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -476,7 +476,6 @@ spa_ffmpeg_dec_node_port_send_command(struct spa_node *node,
|
|||
|
||||
static const struct spa_node ffmpeg_dec_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
spa_ffmpeg_dec_node_enum_params,
|
||||
spa_ffmpeg_dec_node_set_param,
|
||||
spa_ffmpeg_dec_node_set_io,
|
||||
|
|
|
|||
|
|
@ -453,7 +453,6 @@ static int spa_ffmpeg_enc_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node ffmpeg_enc_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
spa_ffmpeg_enc_node_enum_params,
|
||||
spa_ffmpeg_enc_node_set_param,
|
||||
spa_ffmpeg_enc_node_set_io,
|
||||
|
|
|
|||
|
|
@ -713,7 +713,6 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -748,7 +748,6 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -329,6 +329,12 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct spa_dict_item info_items[] = {
|
||||
{ "media.class", "Video/Source" },
|
||||
{ "node.pause-on-idle", "false" },
|
||||
{ "node.driver", "true" },
|
||||
};
|
||||
|
||||
static int impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
void *data)
|
||||
|
|
@ -342,6 +348,10 @@ static int impl_node_set_callbacks(struct spa_node *node,
|
|||
this->callbacks = callbacks;
|
||||
this->callbacks_data = data;
|
||||
|
||||
if (callbacks) {
|
||||
if (callbacks->info)
|
||||
callbacks->info(data, &SPA_DICT_INIT_ARRAY(info_items));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -920,20 +930,8 @@ static int impl_node_process(struct spa_node *node)
|
|||
return SPA_STATUS_HAVE_BUFFER;
|
||||
}
|
||||
|
||||
static const struct spa_dict_item info_items[] = {
|
||||
{ "media.class", "Video/Source" },
|
||||
{ "node.pause-on-idle", "false" },
|
||||
{ "node.driver", "true" },
|
||||
};
|
||||
|
||||
static const struct spa_dict info = {
|
||||
info_items,
|
||||
SPA_N_ELEMENTS(info_items)
|
||||
};
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
&info,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -387,6 +387,10 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct spa_dict_item node_info_items[] = {
|
||||
{ "media.class", "Video/Source" },
|
||||
};
|
||||
|
||||
static int
|
||||
impl_node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
|
|
@ -401,6 +405,10 @@ impl_node_set_callbacks(struct spa_node *node,
|
|||
this->callbacks = callbacks;
|
||||
this->callbacks_data = data;
|
||||
|
||||
if (callbacks) {
|
||||
if (callbacks->info)
|
||||
callbacks->info(data, &SPA_DICT_INIT_ARRAY(node_info_items));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -834,18 +842,8 @@ static int impl_node_process(struct spa_node *node)
|
|||
return SPA_STATUS_OK;
|
||||
}
|
||||
|
||||
static const struct spa_dict_item node_info_items[] = {
|
||||
{ "media.class", "Video/Source" },
|
||||
};
|
||||
|
||||
static const struct spa_dict node_info = {
|
||||
node_info_items,
|
||||
SPA_N_ELEMENTS(node_info_items),
|
||||
};
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
&node_info,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -801,7 +801,6 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -135,6 +135,18 @@ inspect_port_params(struct data *data, struct spa_node *node,
|
|||
}
|
||||
}
|
||||
|
||||
static void node_info(void *data, const struct spa_dict *info)
|
||||
{
|
||||
printf("node properties:\n");
|
||||
spa_debug_dict(2, info);
|
||||
}
|
||||
|
||||
static const struct spa_node_callbacks node_callbacks =
|
||||
{
|
||||
SPA_VERSION_NODE_CALLBACKS,
|
||||
.info = node_info,
|
||||
};
|
||||
|
||||
static void inspect_node(struct data *data, struct spa_node *node)
|
||||
{
|
||||
int res;
|
||||
|
|
@ -142,10 +154,7 @@ static void inspect_node(struct data *data, struct spa_node *node)
|
|||
uint32_t *in_ports, *out_ports;
|
||||
|
||||
printf("node info:\n");
|
||||
if (node->info)
|
||||
spa_debug_dict(2, node->info);
|
||||
else
|
||||
printf(" none\n");
|
||||
spa_node_set_callbacks(node, &node_callbacks, data);
|
||||
|
||||
inspect_node_params(data, node);
|
||||
|
||||
|
|
|
|||
|
|
@ -863,7 +863,6 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -897,7 +897,6 @@ static int impl_node_process(struct spa_node *node)
|
|||
|
||||
static const struct spa_node impl_node = {
|
||||
SPA_VERSION_NODE,
|
||||
NULL,
|
||||
impl_node_enum_params,
|
||||
impl_node_set_param,
|
||||
impl_node_set_io,
|
||||
|
|
|
|||
|
|
@ -894,9 +894,6 @@ void pw_node_set_implementation(struct pw_node *node,
|
|||
pw_log_debug("node %p: set clock %p", node, &impl->position.clock);
|
||||
node->rt.clock = &impl->position.clock;
|
||||
}
|
||||
|
||||
if (spa_node->info)
|
||||
pw_node_update_properties(node, spa_node->info);
|
||||
}
|
||||
|
||||
struct spa_node *pw_node_get_implementation(struct pw_node *node)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue