node: use new node.transport property to start/stop transport

Instead of modifying the driver activation to start/stop the transport,
use a property on the node and let the server handle the change.
This commit is contained in:
Wim Taymans 2024-02-29 17:45:28 +01:00
parent ccf899a709
commit d063ab7322
5 changed files with 40 additions and 9 deletions

View file

@ -6798,12 +6798,24 @@ int jack_transport_reposition (jack_client_t *client,
return 0;
}
static void update_command(struct client *c, uint32_t command)
static int transport_update(struct client* c, int active)
{
struct pw_node_activation *a = c->rt.driver_activation;
if (!a)
return;
SPA_ATOMIC_STORE(a->command, command);
pw_log_info("%p: transport %d", c, active);
pw_thread_loop_lock(c->context.loop);
pw_properties_set(c->props, PW_KEY_NODE_TRANSPORT,
active ? "true" : "false");
c->info.change_mask |= SPA_NODE_CHANGE_MASK_PROPS;
c->info.props = &c->props->dict;
pw_client_node_update(c->node,
PW_CLIENT_NODE_UPDATE_INFO,
0, NULL, &c->info);
c->info.change_mask = 0;
pw_thread_loop_unlock(c->context.loop);
return 0;
}
SPA_EXPORT
@ -6811,7 +6823,7 @@ void jack_transport_start (jack_client_t *client)
{
struct client *c = (struct client *) client;
return_if_fail(c != NULL);
update_command(c, PW_NODE_ACTIVATION_COMMAND_START);
transport_update(c, true);
}
SPA_EXPORT
@ -6819,7 +6831,7 @@ void jack_transport_stop (jack_client_t *client)
{
struct client *c = (struct client *) client;
return_if_fail(c != NULL);
update_command(c, PW_NODE_ACTIVATION_COMMAND_STOP);
transport_update(c, false);
}
SPA_EXPORT