diff options
author | Wim Taymans <wtaymans@redhat.com> | 2020-08-06 13:49:33 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2020-08-06 13:49:33 +0200 |
commit | e71936f8708aa03d6e7a8f34256d5c1ffb7e3041 (patch) | |
tree | 84f5dec6011840fb09f3f5eb380a9aa521fa1c35 | |
parent | 98b7dc7c0c57c7f7c0d11fd00e470dbdd0895527 (diff) |
Improve naming
master -> driving
priority_master -> priority_driver
segment_master -> segment_owner
-rw-r--r-- | doc/architecture.md | 2 | ||||
-rw-r--r-- | pipewire-alsa/alsa-plugins/ctl_pipewire.c | 4 | ||||
-rw-r--r-- | pipewire-jack/src/pipewire-jack.c | 26 | ||||
-rw-r--r-- | pipewire-pulseaudio/src/context.c | 6 | ||||
-rw-r--r-- | pipewire-pulseaudio/src/internal.h | 2 | ||||
-rw-r--r-- | spa/include/spa/node/io.h | 2 | ||||
-rw-r--r-- | spa/plugins/audioconvert/audioadapter.c | 12 | ||||
-rw-r--r-- | spa/plugins/videoconvert/videoadapter.c | 4 | ||||
-rw-r--r-- | src/daemon/pipewire.conf.in | 2 | ||||
-rw-r--r-- | src/examples/media-session/alsa-monitor.c | 4 | ||||
-rw-r--r-- | src/pipewire/context.c | 26 | ||||
-rw-r--r-- | src/pipewire/impl-node.c | 26 | ||||
-rw-r--r-- | src/pipewire/keys.h | 5 | ||||
-rw-r--r-- | src/pipewire/private.h | 4 |
14 files changed, 63 insertions, 62 deletions
diff --git a/doc/architecture.md b/doc/architecture.md index 4a10f254..eb9e1086 100644 --- a/doc/architecture.md +++ b/doc/architecture.md @@ -6,7 +6,7 @@ There are 2 main components that make up the PipeWire library: 2) An asynchronous IPC mechanism to manipulate and introspect a graph in another process. -There is usually a daemon that implements the master graph and +There is usually a daemon that implements the global graph and clients that operate on this graph. The IPC mechanism in PipeWire is inspired by wayland in that it diff --git a/pipewire-alsa/alsa-plugins/ctl_pipewire.c b/pipewire-alsa/alsa-plugins/ctl_pipewire.c index 5284933a..c20ca8e2 100644 --- a/pipewire-alsa/alsa-plugins/ctl_pipewire.c +++ b/pipewire-alsa/alsa-plugins/ctl_pipewire.c @@ -102,8 +102,6 @@ struct global { uint32_t permissions; struct pw_properties *props; - int priority_master; - struct pw_proxy *proxy; struct spa_hook proxy_listener; struct spa_hook object_listener; @@ -905,7 +903,7 @@ static void node_event_info(void *object, const struct pw_node_info *info) else g->node.device_id = SPA_ID_INVALID; - if (info->props && (str = spa_dict_lookup(info->props, PW_KEY_PRIORITY_MASTER))) + if (info->props && (str = spa_dict_lookup(info->props, PW_KEY_PRIORITY_DRIVER))) g->node.priority = atoi(str); if (info->props && (str = spa_dict_lookup(info->props, PW_KEY_MEDIA_CLASS))) { if (strcmp(str, "Audio/Sink") == 0) diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c index 300e13e8..fc22f285 100644 --- a/pipewire-jack/src/pipewire-jack.c +++ b/pipewire-jack/src/pipewire-jack.c @@ -337,8 +337,8 @@ struct client { unsigned int thread_entered:1; unsigned int has_transport:1; unsigned int allow_mlock:1; - unsigned int timemaster_pending:1; - unsigned int timemaster_conditional:1; + unsigned int timeowner_pending:1; + unsigned int timeowner_conditional:1; jack_position_t jack_position; jack_transport_state_t jack_state; @@ -1243,12 +1243,12 @@ static int client_node_set_param(void *object, return -ENOTSUP; } -static int install_timemaster(struct client *c) +static int install_timeowner(struct client *c) { struct pw_node_activation *a; uint32_t owner; - if (!c->timemaster_pending) + if (!c->timeowner_pending) return 0; if ((a = c->driver_activation) == NULL) @@ -1261,8 +1261,8 @@ static int install_timemaster(struct client *c) if (owner == c->node_id) return 0; - /* try to become master */ - if (c->timemaster_conditional) { + /* try to become owner */ + if (c->timeowner_conditional) { if (!ATOMIC_CAS(a->segment_owner[0], 0, c->node_id)) { pw_log_debug(NAME" %p: owner:%u id:%u", c, owner, c->node_id); return -EBUSY; @@ -1272,7 +1272,7 @@ static int install_timemaster(struct client *c) } pw_log_debug(NAME" %p: timebase installed for id:%u", c, c->node_id); - c->timemaster_pending = false; + c->timeowner_pending = false; return 0; } @@ -1296,7 +1296,7 @@ static int update_driver_activation(struct client *c) c->driver_activation = link ? link->activation : NULL; pw_data_loop_invoke(c->loop, do_update_driver_activation, SPA_ID_INVALID, NULL, 0, true, c); - install_timemaster(c); + install_timeowner(c); return 0; } @@ -2037,7 +2037,7 @@ static void registry_event_global(void *data, uint32_t id, if (ot != NULL && o->node.client_id != ot->node.client_id) snprintf(o->node.name, sizeof(o->node.name), "%s-%d", str, id); - if ((str = spa_dict_lookup(props, PW_KEY_PRIORITY_MASTER)) != NULL) + if ((str = spa_dict_lookup(props, PW_KEY_PRIORITY_DRIVER)) != NULL) o->node.priority = pw_properties_parse_int(str); pw_log_debug(NAME" %p: add node %d", c, id); @@ -4343,7 +4343,7 @@ int jack_release_timebase (jack_client_t *client) c->timebase_callback = NULL; c->timebase_arg = NULL; c->activation->pending_new_pos = false; - c->timemaster_pending = false; + c->timeowner_pending = false; return 0; } @@ -4399,9 +4399,9 @@ int jack_set_timebase_callback (jack_client_t *client, c->timebase_callback = timebase_callback; c->timebase_arg = arg; - c->timemaster_pending = true; - c->timemaster_conditional = conditional; - install_timemaster(c); + c->timeowner_pending = true; + c->timeowner_conditional = conditional; + install_timeowner(c); pw_log_debug(NAME" %p: timebase set id:%u", c, c->node_id); diff --git a/pipewire-pulseaudio/src/context.c b/pipewire-pulseaudio/src/context.c index fcab152c..4144608c 100644 --- a/pipewire-pulseaudio/src/context.c +++ b/pipewire-pulseaudio/src/context.c @@ -1089,8 +1089,8 @@ static int set_mask(pa_context *c, struct global *g) if (g->props == NULL) return 0; - if ((str = pw_properties_get(g->props, PW_KEY_PRIORITY_MASTER)) != NULL) - g->priority_master = pw_properties_parse_int(str); + if ((str = pw_properties_get(g->props, PW_KEY_PRIORITY_DRIVER)) != NULL) + g->priority_driver = pw_properties_parse_int(str); if ((str = pw_properties_get(g->props, PW_KEY_MEDIA_CLASS)) == NULL) { pw_log_debug("node %d without "PW_KEY_MEDIA_CLASS, g->id); @@ -1219,7 +1219,7 @@ static inline void insert_global(pa_context *c, struct global *global) bool found = false; spa_list_for_each(g, &c->globals, link) { - if (g->priority_master < global->priority_master) { + if (g->priority_driver < global->priority_driver) { g = spa_list_prev(g, link); found = true; break; diff --git a/pipewire-pulseaudio/src/internal.h b/pipewire-pulseaudio/src/internal.h index f7f9042f..00c79eae 100644 --- a/pipewire-pulseaudio/src/internal.h +++ b/pipewire-pulseaudio/src/internal.h @@ -250,7 +250,7 @@ struct global { pa_subscription_mask_t mask; pa_subscription_event_type_t event; - int priority_master; + int priority_driver; int pending_seq; int init:1; diff --git a/spa/include/spa/node/io.h b/spa/include/spa/node/io.h index eebc62a9..bddd15a5 100644 --- a/spa/include/spa/node/io.h +++ b/spa/include/spa/node/io.h @@ -254,7 +254,7 @@ enum spa_io_position_state { * The position information adds extra meaning to the raw clock times. * * It is set on all nodes and the clock id will contain the clock of the - * master node in the graph. + * driving node in the graph. * * The position information contains 1 or more segments that convert the * raw clock times to a stream time. They are sorted based on their diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index 4cffdc2a..6a777bdf 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -82,7 +82,7 @@ struct impl { unsigned int add_listener:1; unsigned int have_format:1; unsigned int started:1; - unsigned int master:1; + unsigned int driver:1; }; /** \endcond */ @@ -655,7 +655,7 @@ static int follower_ready(void *data, int status) spa_log_trace_fp(this->log, NAME " %p: ready %d", this, status); - this->master = true; + this->driver = true; if (this->direction == SPA_DIRECTION_OUTPUT) status = spa_node_process(this->convert); @@ -880,8 +880,8 @@ static int impl_node_process(void *object) struct impl *this = object; int status = 0; - spa_log_trace_fp(this->log, "%p: process convert:%p master:%d", - this, this->convert, this->master); + spa_log_trace_fp(this->log, "%p: process convert:%p driver:%d", + this, this->convert, this->driver); if (this->direction == SPA_DIRECTION_INPUT) { if (this->convert) @@ -892,7 +892,7 @@ static int impl_node_process(void *object) status = spa_node_process(this->follower); if (this->direction == SPA_DIRECTION_OUTPUT && - !this->master && this->convert) { + !this->driver && this->convert) { while (status > 0) { status = spa_node_process(this->convert); if (status & (SPA_STATUS_HAVE_DATA | SPA_STATUS_DRAINED)) @@ -906,7 +906,7 @@ static int impl_node_process(void *object) } spa_log_trace_fp(this->log, "%p: process status:%d", this, status); - this->master = false; + this->driver = false; return status; } diff --git a/spa/plugins/videoconvert/videoadapter.c b/spa/plugins/videoconvert/videoadapter.c index 8555f4c3..f150d48c 100644 --- a/spa/plugins/videoconvert/videoadapter.c +++ b/spa/plugins/videoconvert/videoadapter.c @@ -78,7 +78,7 @@ struct impl { unsigned int started:1; unsigned int active:1; unsigned int driver:1; - unsigned int master:1; + unsigned int driving:1; unsigned int monitor:1; }; @@ -775,7 +775,7 @@ static int impl_node_process(void *object) if (this->monitor) status |= SPA_STATUS_HAVE_DATA; - if (this->direction == SPA_DIRECTION_OUTPUT && !this->master) { + if (this->direction == SPA_DIRECTION_OUTPUT && !this->driving) { if (this->use_converter) status = spa_node_process(this->convert); } diff --git a/src/daemon/pipewire.conf.in b/src/daemon/pipewire.conf.in index 3a807870..5306ade0 100644 --- a/src/daemon/pipewire.conf.in +++ b/src/daemon/pipewire.conf.in @@ -67,7 +67,7 @@ load-module libpipewire-module-session-manager #create-object spa-device-factory factory.name=api.alsa.seq.bridge node.name=Internal-MIDI-Bridge #create-object adapter factory.name=audiotestsrc node.name=my-test #create-object spa-node-factory factory.name=api.vulkan.compute.source node.name=my-compute-source -create-object spa-node-factory factory.name=support.node.driver node.name=Dummy priority.master=8000 +create-object spa-node-factory factory.name=support.node.driver node.name=Dummy priority.driver=8000 ## exec <program-name> # diff --git a/src/examples/media-session/alsa-monitor.c b/src/examples/media-session/alsa-monitor.c index e7395be4..1995b095 100644 --- a/src/examples/media-session/alsa-monitor.c +++ b/src/examples/media-session/alsa-monitor.c @@ -247,8 +247,8 @@ static struct node *alsa_create_node(struct device *device, uint32_t id, else if (strstr(profile, "iec958-") == profile) priority += 8; - if (pw_properties_get(node->props, PW_KEY_PRIORITY_MASTER) == NULL) { - pw_properties_setf(node->props, PW_KEY_PRIORITY_MASTER, "%d", priority); + if (pw_properties_get(node->props, PW_KEY_PRIORITY_DRIVER) == NULL) { + pw_properties_setf(node->props, PW_KEY_PRIORITY_DRIVER, "%d", priority); pw_properties_setf(node->props, PW_KEY_PRIORITY_SESSION, "%d", priority); } diff --git a/src/pipewire/context.c b/src/pipewire/context.c index 697381eb..e9e80788 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -868,7 +868,7 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason) /* start from all drivers and group all nodes that are linked * to it. Some nodes are not (yet) linked to anything and they - * will end up 'unassigned' to a master. Other nodes are master + * will end up 'unassigned' to a driver. Other nodes are drivers * and if they have active followers, we can use them to schedule * the unassigned nodes. */ target = fallback = NULL; @@ -879,12 +879,12 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason) if (!n->visited) collect_nodes(n); - /* from now on we are only interested in active master nodes. + /* from now on we are only interested in active driving nodes. * We're going to see if there are active followers. */ - if (!n->master || !n->active || n->passive) + if (!n->driving || !n->active || n->passive) continue; - /* first active master node is fallback */ + /* first active driving node is fallback */ if (fallback == NULL) fallback = n; @@ -892,21 +892,21 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason) pw_log_debug(NAME" %p: driver %p: follower %p %s: %d", context, n, s, s->name, s->active); if (s != n && s->active) { - /* if the master has active followers, it is a target for our - * unassigned nodes */ + /* if the driving node has active followers, it + * is a target for our unassigned nodes */ if (target == NULL) target = n; break; } } } - /* no active node, use fallback master */ + /* no active node, use fallback driving node */ if (target == NULL) target = fallback; /* now go through all available nodes. The ones we didn't visit - * in collect_nodes() are not linked to any master. We assign them - * to either an active master of the first master */ + * in collect_nodes() are not linked to any driver. We assign them + * to either an active driver of the first driver */ spa_list_for_each(n, &context->node_list, link) { if (n->exported) continue; @@ -926,14 +926,14 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason) n->visited = false; } - /* assign final quantum and set state for followers and master */ + /* assign final quantum and set state for followers and drivers */ spa_list_for_each(n, &context->driver_list, driver_link) { bool running = false; uint32_t max_quantum = 0; uint32_t min_quantum = 0; uint32_t quantum; - if (!n->master || n->exported) + if (!n->driving || n->exported) continue; /* collect quantum and count active nodes */ @@ -964,8 +964,8 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason) n->rt.position->clock.duration = quantum; } - pw_log_debug(NAME" %p: master %p running:%d passive:%d quantum:%u '%s'", context, n, - running, n->passive, quantum, n->name); + pw_log_debug(NAME" %p: driving %p running:%d passive:%d quantum:%u '%s'", + context, n, running, n->passive, quantum, n->name); spa_list_for_each(s, &n->follower_list, follower_link) { if (s == n) diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index bf52d636..fee5ea69 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -575,7 +575,7 @@ static inline void insert_driver(struct pw_context *context, struct pw_impl_node struct pw_impl_node *n, *t; spa_list_for_each_safe(n, t, &context->driver_list, driver_link) { - if (n->priority_master < node->priority_master) + if (n->priority_driver < node->priority_driver) break; } spa_list_append(&n->driver_link, &node->driver_link); @@ -616,7 +616,7 @@ int pw_impl_node_register(struct pw_impl_node *this, PW_KEY_CLIENT_ID, PW_KEY_DEVICE_ID, PW_KEY_PRIORITY_SESSION, - PW_KEY_PRIORITY_MASTER, + PW_KEY_PRIORITY_DRIVER, PW_KEY_APP_NAME, PW_KEY_NODE_DESCRIPTION, PW_KEY_NODE_NAME, @@ -706,7 +706,7 @@ do_move_nodes(struct spa_loop *loop, return 0; } -static void remove_segment_master(struct pw_impl_node *driver, uint32_t node_id) +static void remove_segment_owner(struct pw_impl_node *driver, uint32_t node_id) { struct pw_node_activation *a = driver->rt.activation; ATOMIC_CAS(a->segment_owner[0], node_id, 0); @@ -729,11 +729,11 @@ int pw_impl_node_set_driver(struct pw_impl_node *node, struct pw_impl_node *driv if (old == driver) return 0; - remove_segment_master(old, node->info.id); + remove_segment_owner(old, node->info.id); - node->master = node->driver && driver == node; - pw_log_debug(NAME" %p: driver %p master:%u", node, - driver, node->master); + node->driving = node->driver && driver == node; + pw_log_debug(NAME" %p: driver %p driving:%u", node, + driver, node->driving); pw_log_info("(%s-%u) -> change driver (%s-%d -> %s-%d)", node->name, node->info.id, old->name, old->info.id, driver->name, driver->info.id); @@ -775,9 +775,9 @@ static void check_properties(struct pw_impl_node *node) const char *str; bool driver, do_recalc = false; - if ((str = pw_properties_get(node->properties, PW_KEY_PRIORITY_MASTER))) { - node->priority_master = pw_properties_parse_int(str); - pw_log_debug(NAME" %p: priority master %d", node, node->priority_master); + if ((str = pw_properties_get(node->properties, PW_KEY_PRIORITY_DRIVER))) { + node->priority_driver = pw_properties_parse_int(str); + pw_log_debug(NAME" %p: priority driver %d", node, node->priority_driver); } if ((str = pw_properties_get(node->properties, PW_KEY_NODE_NAME)) && @@ -1122,7 +1122,7 @@ struct pw_impl_node *pw_context_create_node(struct pw_context *context, this->driver_node = this; spa_list_append(&this->follower_list, &this->follower_link); - this->master = true; + this->driving = true; return this; @@ -1474,7 +1474,7 @@ static int node_ready(void *data, int status) update_position(node, all_ready); } - if (SPA_UNLIKELY(node->driver && !node->master)) + if (SPA_UNLIKELY(node->driver && !node->driving)) return 0; if (status & SPA_STATUS_HAVE_DATA) { @@ -1602,7 +1602,7 @@ void pw_impl_node_destroy(struct pw_impl_node *node) /* remove ourself as a follower from the driver node */ spa_list_remove(&node->follower_link); - remove_segment_master(node->driver_node, node->info.id); + remove_segment_owner(node->driver_node, node->info.id); spa_list_consume(follower, &node->follower_list, follower_link) { pw_log_debug(NAME" %p: reassign follower %p", impl, follower); diff --git a/src/pipewire/keys.h b/src/pipewire/keys.h index 9925eeca..d5e4ad55 100644 --- a/src/pipewire/keys.h +++ b/src/pipewire/keys.h @@ -79,7 +79,7 @@ extern "C" { /* priorities */ #define PW_KEY_PRIORITY_SESSION "priority.session" /**< priority in session manager */ -#define PW_KEY_PRIORITY_MASTER "priority.master" /**< priority to be a master */ +#define PW_KEY_PRIORITY_DRIVER "priority.driver" /**< priority to be a driver */ /* remote keys */ #define PW_KEY_REMOTE_NAME "remote.name" /**< The name of the remote to connect to, @@ -264,6 +264,9 @@ extern "C" { #define PW_KEY_VIDEO_FORMAT "video.format" /**< a video format */ #define PW_KEY_VIDEO_SIZE "video.size" /**< a video size as "<width>x<height" */ +#ifdef PW_ENABLE_DEPRECATED +#define PW_KEY_PRIORITY_MASTER "priority.master" /**< deprecated */ +#endif /* PW_ENABLE_DEPRECATED */ #ifdef __cplusplus } diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 27261c63..445e5c8e 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -535,7 +535,7 @@ struct pw_impl_node { char *name; /** for debug */ - uint32_t priority_master; /** priority for being master driver */ + uint32_t priority_driver; /** priority for being driver */ uint32_t spa_flags; unsigned int registered:1; @@ -544,7 +544,7 @@ struct pw_impl_node { unsigned int driver:1; /**< if the node can drive the graph */ unsigned int exported:1; /**< if the node is exported */ unsigned int remote:1; /**< if the node is implemented remotely */ - unsigned int master:1; /**< a master node is one of the driver nodes that + unsigned int driving:1; /**< a driving node is one of the driver nodes that * is selected to drive the graph */ unsigned int visited:1; /**< for sorting */ unsigned int want_driver:1; /**< this node wants to be assigned to a driver */ |