mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
impl-port: add port.exclusive flag
Add a port.exclusive flag and inherit the value from the node.exclusive flag if not otherwise specified. Make it so that exclusive ports can only be linked once. This is important for explicit sync where there can be only one producer and one consumer in order to signal the timeline objects correctly.
This commit is contained in:
parent
83b59d6ebe
commit
6305eada80
4 changed files with 8 additions and 0 deletions
|
|
@ -1159,6 +1159,7 @@ static void check_properties(struct pw_impl_node *node)
|
|||
node->transport_sync = pw_properties_get_bool(node->properties, PW_KEY_NODE_TRANSPORT_SYNC, false);
|
||||
impl->cache_params = pw_properties_get_bool(node->properties, PW_KEY_NODE_CACHE_PARAMS, true);
|
||||
driver = pw_properties_get_bool(node->properties, PW_KEY_NODE_DRIVER, false);
|
||||
node->exclusive = pw_properties_get_bool(node->properties, PW_KEY_NODE_EXCLUSIVE, false);
|
||||
|
||||
if (node->driver != driver) {
|
||||
pw_log_debug("%p: driver %d -> %d", node, node->driver, driver);
|
||||
|
|
|
|||
|
|
@ -370,6 +370,9 @@ int pw_impl_port_init_mix(struct pw_impl_port *port, struct pw_impl_port_mix *mi
|
|||
uint32_t port_id;
|
||||
int res = 0;
|
||||
|
||||
if (port->exclusive && port->n_mix != 0)
|
||||
return -EBUSY;
|
||||
|
||||
port_id = pw_map_insert_new(&port->mix_port_map, mix);
|
||||
if (port_id == SPA_ID_INVALID)
|
||||
return -errno;
|
||||
|
|
@ -1236,6 +1239,7 @@ int pw_impl_port_add(struct pw_impl_port *port, struct pw_impl_node *node)
|
|||
is_monitor = pw_properties_get_bool(port->properties, PW_KEY_PORT_MONITOR, false);
|
||||
|
||||
port->ignore_latency = pw_properties_get_bool(port->properties, PW_KEY_PORT_IGNORE_LATENCY, false);
|
||||
port->exclusive = pw_properties_get_bool(port->properties, PW_KEY_PORT_EXCLUSIVE, node->exclusive);
|
||||
|
||||
is_control = PW_IMPL_PORT_IS_CONTROL(port);
|
||||
if (is_control) {
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@ extern "C" {
|
|||
#define PW_KEY_PORT_PASSIVE "port.passive" /**< the ports wants passive links, since 0.3.67 */
|
||||
#define PW_KEY_PORT_IGNORE_LATENCY "port.ignore-latency" /**< latency ignored by peers, since 0.3.71 */
|
||||
#define PW_KEY_PORT_GROUP "port.group" /**< the port group of the port 1.2.0 */
|
||||
#define PW_KEY_PORT_EXCLUSIVE "port.exclusive" /**< link port only once 1.6.0 */
|
||||
|
||||
/** link properties */
|
||||
#define PW_KEY_LINK_ID "link.id" /**< a link id */
|
||||
|
|
|
|||
|
|
@ -782,6 +782,7 @@ struct pw_impl_node {
|
|||
unsigned int sync:1; /**< the sync-groups are active */
|
||||
unsigned int async:1; /**< async processing, one cycle latency */
|
||||
unsigned int lazy:1; /**< the graph is lazy scheduling */
|
||||
unsigned int exclusive:1; /**< ports can only be linked once */
|
||||
|
||||
uint32_t transport; /**< latest transport request */
|
||||
|
||||
|
|
@ -964,6 +965,7 @@ struct pw_impl_port {
|
|||
unsigned int have_latency_param:1;
|
||||
unsigned int ignore_latency:1;
|
||||
unsigned int have_latency:1;
|
||||
unsigned int exclusive:1; /**< port can only be linked once */
|
||||
|
||||
unsigned int have_tag_param:1;
|
||||
struct spa_pod *tag[2]; /**< tags */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue