Simplify node activation

Don't directly expose the state change methods. Only expose an activate
method for nodes that indicates if the node should be scheduled or not.
Let the link automatically negotiate two active nodes.
Make some defines for properties.
Use link property to make passive links. Passive links don't activate
the nodes.
Make sure the mainloop quits when quit is called before run.
This commit is contained in:
Wim Taymans 2017-09-18 20:37:00 +02:00
parent 304a6d1796
commit 93a52f4837
32 changed files with 181 additions and 86 deletions

View file

@ -49,8 +49,8 @@ int main(int argc, char *argv[])
return -1;
}
props = pw_properties_new("pipewire.core.name", "pipewire-0",
"pipewire.daemon", "1", NULL);
props = pw_properties_new(PW_CORE_PROP_NAME, "pipewire-0",
PW_CORE_PROP_DAEMON, "1", NULL);
loop = pw_main_loop_new(props);
pw_loop_add_signal(pw_main_loop_get_loop(loop), SIGINT, do_quit, loop);

View file

@ -469,9 +469,9 @@ static void make_node(struct data *data)
{
struct pw_properties *props;
props = pw_properties_new("pipewire.autoconnect", "1", NULL);
props = pw_properties_new(PW_NODE_PROP_AUTOCONNECT, "1", NULL);
if (data->path)
pw_properties_set(props, "pipewire.target.node", data->path);
pw_properties_set(props, PW_NODE_PROP_TARGET_NODE, data->path);
data->node = pw_node_new(data->core, "SDL-sink", props, 0);
data->impl_node = impl_node;

View file

@ -363,9 +363,9 @@ static void make_node(struct data *data)
{
struct pw_properties *props;
props = pw_properties_new("pipewire.autoconnect", "1", NULL);
props = pw_properties_new(PW_NODE_PROP_AUTOCONNECT, "1", NULL);
if (data->path)
pw_properties_set(props, "pipewire.target.node", data->path);
pw_properties_set(props, PW_NODE_PROP_TARGET_NODE, data->path);
data->node = pw_node_new(data->core, "sine-source", props, 0);
data->impl_node = impl_node;

View file

@ -60,8 +60,8 @@ static int make_node(struct data *data)
"spa.factory.name", data->factory, NULL);
if (data->path) {
pw_properties_set(props, "pipewire.autoconnect", "1");
pw_properties_set(props, "pipewire.target.node", data->path);
pw_properties_set(props, PW_NODE_PROP_AUTOCONNECT, "1");
pw_properties_set(props, PW_NODE_PROP_TARGET_NODE, data->path);
}
data->node = pw_factory_create_object(factory,

View file

@ -465,7 +465,6 @@ static void make_nodes(struct data *data)
PW_VERSION_NODE,
props,
SPA_ID_INVALID);
data->link = pw_link_new(data->core,
pw_node_get_free_port(data->v4l2, PW_DIRECTION_OUTPUT),
pw_node_find_port(data->node, PW_DIRECTION_INPUT, 0),
@ -474,7 +473,9 @@ static void make_nodes(struct data *data)
NULL,
0);
pw_link_register(data->link, NULL, NULL);
pw_link_activate(data->link);
pw_node_set_active(data->node, true);
pw_node_set_active(data->v4l2, true);
}
int main(int argc, char *argv[])

View file

@ -515,13 +515,13 @@ parse_stream_properties (GstPipeWireSrc *pwsrc, const struct pw_properties *prop
gboolean is_live;
GST_OBJECT_LOCK (pwsrc);
var = pw_properties_get (props, "pipewire.latency.is-live");
is_live = pwsrc->is_live = var ? (atoi (var) == 1) : FALSE;
var = pw_properties_get (props, PW_STREAM_PROP_IS_LIVE);
is_live = pwsrc->is_live = var ? pw_properties_parse_bool(var) : FALSE;
var = pw_properties_get (props, "pipewire.latency.min");
var = pw_properties_get (props, PW_STREAM_PROP_LATENCY_MIN);
pwsrc->min_latency = var ? (GstClockTime) atoi (var) : 0;
var = pw_properties_get (props, "pipewire.latency.max");
var = pw_properties_get (props, PW_STREAM_PROP_LATENCY_MAX);
pwsrc->max_latency = var ? (GstClockTime) atoi (var) : GST_CLOCK_TIME_NONE;
GST_OBJECT_UNLOCK (pwsrc);

View file

@ -169,12 +169,12 @@ static void try_link_port(struct pw_node *node, struct pw_port *port, struct nod
props = pw_node_get_properties(node);
str = pw_properties_get(props, "pipewire.target.node");
str = pw_properties_get(props, PW_NODE_PROP_TARGET_NODE);
if (str != NULL)
path_id = atoi(str);
else {
str = pw_properties_get(props, "pipewire.autoconnect");
if (str == NULL || atoi(str) == 0) {
str = pw_properties_get(props, PW_NODE_PROP_AUTOCONNECT);
if (str == NULL || !pw_properties_parse_bool(str)) {
pw_log_debug("module %p: node does not need autoconnect", impl);
return;
}
@ -209,8 +209,6 @@ static void try_link_port(struct pw_node *node, struct pw_port *port, struct nod
spa_list_append(&info->links, &ld->l);
pw_link_register(link, NULL, pw_module_get_global(impl->module));
pw_link_activate(link);
return;
error:

View file

@ -810,7 +810,6 @@ handle_connect_name_ports(struct client *client)
spa_list_append(&impl->link_list, &ld->link_link);
pw_link_add_listener(link, &ld->link_listener, &link_events, ld);
pw_link_register(link, NULL, pw_module_get_global(impl->module));
pw_link_activate(link);
notify_clients(impl, jack_notify_PortConnectCallback, false, "", src_id, dst_id);
@ -1034,7 +1033,7 @@ static struct client *client_new(struct impl *impl, int fd)
ucredp = &ucred;
}
properties = pw_properties_new("pipewire.protocol", "protocol-jack", NULL);
properties = pw_properties_new(PW_CLIENT_PROP_PROTOCOL, "protocol-jack", NULL);
if (properties == NULL)
goto no_props;
@ -1283,6 +1282,7 @@ static bool on_global(void *data, struct pw_global *global)
struct pw_node *node;
const struct pw_properties *properties;
const char *str;
char *error;
struct pw_port *in_port, *out_port;
if (pw_global_get_type(global) != impl->t->node)
@ -1306,10 +1306,14 @@ static bool on_global(void *data, struct pw_global *global)
out_port,
in_port,
NULL,
NULL,
NULL,
pw_properties_new(PW_LINK_PROP_PASSIVE, "true", NULL),
&error,
0);
pw_link_inc_idle(impl->sink_link);
if (impl->sink_link == NULL) {
pw_log_warn("can't link ports: %s", error);
free(error);
return true;
}
pw_link_register(impl->sink_link, NULL, pw_module_get_global(impl->module));
return false;

View file

@ -918,6 +918,7 @@ struct pw_jack_node *pw_jack_node_new(struct pw_core *core,
jack_graph_manager_next_stop(mgr);
pw_node_register(node, NULL, parent);
pw_node_set_active(node, true);
return this;
}
@ -1014,6 +1015,7 @@ pw_jack_driver_new(struct pw_core *core,
pw_port_add(this->driver_out->port, node);
}
pw_node_register(node, NULL, parent);
pw_node_set_active(node, true);
return this;
}

View file

@ -161,8 +161,12 @@ static bool on_global(void *data, struct pw_global *global)
if (op == NULL)
return true;
link = pw_link_new(impl->core, op, ip, NULL, NULL, &error, 0);
pw_link_inc_idle(link);
link = pw_link_new(impl->core,
op,
ip,
NULL,
pw_properties_new(PW_LINK_PROP_PASSIVE, "true", NULL),
&error, 0);
pw_link_register(link, NULL, pw_module_get_global(impl->module));
return true;

View file

@ -365,10 +365,10 @@ handle_create_client_node(PipeWireDaemon1 * interface,
pw_log_debug("protocol-dbus %p: create client-node: %s", impl, sender);
props = pw_properties_from_variant(arg_properties);
target_node = pw_properties_get(props, "pipewire.target.node");
target_node = pw_properties_get(props, PW_NODE_PROP_TARGET_NODE);
if (target_node) {
if (strncmp(target_node, "/org/pipewire/node_", strlen("/org/pipewire/node_")) == 0) {
pw_properties_setf(props, "pipewire.target.node", "%s",
pw_properties_setf(props, PW_NODE_PROP_TARGET_NODE, "%s",
target_node + strlen("/org/pipewire/node_"));
}
}

View file

@ -241,7 +241,7 @@ static struct pw_client *client_new(struct server *s, int fd)
ucredp = &ucred;
}
props = pw_properties_new("pipewire.protocol", "protocol-native", NULL);
props = pw_properties_new(PW_CLIENT_PROP_PROTOCOL, "protocol-native", NULL);
if (props == NULL)
goto no_props;
@ -412,7 +412,7 @@ get_remote(const struct pw_properties *properties)
const char *name = NULL;
if (properties)
name = pw_properties_get(properties, "pipewire.remote.name");
name = pw_properties_get(properties, PW_REMOTE_PROP_REMOTE_NAME);
if (name == NULL)
name = getenv("PIPEWIRE_REMOTE");
if (name == NULL)
@ -687,7 +687,7 @@ get_name(const struct pw_properties *properties)
const char *name = NULL;
if (properties)
name = pw_properties_get(properties, "pipewire.core.name");
name = pw_properties_get(properties, PW_CORE_PROP_NAME);
if (name == NULL)
name = getenv("PIPEWIRE_CORE");
if (name == NULL)
@ -850,10 +850,10 @@ static bool module_init(struct pw_module *module, struct pw_properties *properti
d->module = module;
d->properties = properties;
if ((val = pw_properties_get(pw_core_get_properties(core), "pipewire.daemon"))) {
if (atoi(val) == 1)
if (impl_add_server(this, core, properties) == NULL)
return false;
val = pw_properties_get(pw_core_get_properties(core), PW_CORE_PROP_DAEMON);
if (val && pw_properties_parse_bool(val)) {
if (impl_add_server(this, core, properties) == NULL)
return false;
}
pw_module_add_listener(module, &d->module_listener, &module_events, d);

View file

@ -27,6 +27,7 @@
#include "pipewire/log.h"
#include "pipewire/type.h"
#include "pipewire/module.h"
#include "pipewire/private.h"
struct impl {
struct pw_core *core;

View file

@ -72,6 +72,7 @@ static void complete_init(struct impl *impl)
{
struct pw_node *this = impl->this;
pw_node_register(this, impl->owner, impl->parent);
pw_node_set_active(this, true);
}
static void on_node_done(void *data, uint32_t seq, int res)

View file

@ -114,9 +114,9 @@ struct pw_client *pw_client_new(struct pw_core *core,
return NULL;
if (ucred) {
pw_properties_setf(properties, "pipewire.ucred.pid", "%d", ucred->pid);
pw_properties_setf(properties, "pipewire.ucred.uid", "%d", ucred->uid);
pw_properties_setf(properties, "pipewire.ucred.gid", "%d", ucred->gid);
pw_properties_setf(properties, PW_CLIENT_PROP_UCRED_PID, "%d", ucred->pid);
pw_properties_setf(properties, PW_CLIENT_PROP_UCRED_UID, "%d", ucred->uid);
pw_properties_setf(properties, PW_CLIENT_PROP_UCRED_GID, "%d", ucred->gid);
}
this->properties = properties;

View file

@ -113,6 +113,13 @@ struct pw_client_events {
void (*busy_changed) (void *data, bool busy);
};
/** The name of the protocol used by the client, set by the protocol */
#define PW_CLIENT_PROP_PROTOCOL "pipewire.protocol"
#define PW_CLIENT_PROP_UCRED_PID "pipewire.ucred.pid" /**< Client pid, set by protocol */
#define PW_CLIENT_PROP_UCRED_UID "pipewire.ucred.uid" /**< Client uid, set by protocol*/
#define PW_CLIENT_PROP_UCRED_GID "pipewire.ucred.gid" /**< client gid, set by protocol*/
/** Create a new client. This is mainly used by protocols. */
struct pw_client *
pw_client_new(struct pw_core *core, /**< the core object */

View file

@ -280,8 +280,6 @@ core_create_link(void *object,
if (res < 0)
goto no_bind;
pw_link_activate(link);
done:
return;
@ -445,11 +443,11 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop, struct pw_properties *pro
spa_list_init(&this->link_list);
spa_hook_list_init(&this->listener_list);
if ((name = pw_properties_get(properties, "pipewire.core.name")) == NULL) {
if ((name = pw_properties_get(properties, PW_CORE_PROP_NAME)) == NULL) {
pw_properties_setf(properties,
"pipewire.core.name", "pipewire-%s-%d",
PW_CORE_PROP_NAME, "pipewire-%s-%d",
pw_get_user_name(), getpid());
name = pw_properties_get(properties, "pipewire.core.name");
name = pw_properties_get(properties, PW_CORE_PROP_NAME);
}
this->info.change_mask = 0;

View file

@ -105,6 +105,13 @@ struct pw_core_events {
void (*global_removed) (void *data, struct pw_global *global);
};
/** The name of the core. Default is pipewire-<user-name>-<pid> */
#define PW_CORE_PROP_NAME "pipewire.core.name"
/** The version of the core. */
#define PW_CORE_PROP_VERSION "pipewire.core.version"
/** If the core should listen for connections, boolean default false */
#define PW_CORE_PROP_DAEMON "pipewire.daemon"
/** Make a new core object for a given main_loop. Ownership of the properties is taken */
struct pw_core * pw_core_new(struct pw_loop *main_loop, struct pw_properties *props);

View file

@ -1088,12 +1088,20 @@ struct pw_link *pw_link_new(struct pw_core *core,
this->properties = properties;
this->state = PW_LINK_STATE_INIT;
this->input = input;
this->output = output;
input_node = input->node;
output_node = output->node;
if (properties) {
const char *str = pw_properties_get(properties, PW_LINK_PROP_PASSIVE);
if (str && pw_properties_parse_bool(str)) {
input_node->idle_used_input_links++;
output_node->idle_used_output_links++;
}
}
spa_list_init(&this->resource_list);
spa_hook_list_init(&this->listener_list);
@ -1165,11 +1173,30 @@ void pw_link_register(struct pw_link *link,
struct pw_global *parent)
{
struct pw_core *core = link->core;
struct pw_node *input_node, *output_node;
spa_list_insert(core->link_list.prev, &link->link);
link->global = pw_core_add_global(core, owner, parent, core->type.link, PW_VERSION_LINK,
link_bind_func, link);
link->info.id = link->global->id;
input_node = link->input->node;
output_node = link->output->node;
pw_log_debug("link %p: in %d %d, out %d %d, %d %d %d %d", link,
input_node->n_used_input_links,
input_node->n_used_output_links,
output_node->n_used_input_links,
output_node->n_used_output_links,
input_node->idle_used_input_links,
input_node->idle_used_output_links,
output_node->idle_used_input_links,
output_node->idle_used_output_links);
if ((input_node->n_used_input_links + 1 > input_node->idle_used_input_links ||
output_node->n_used_output_links + 1 > output_node->idle_used_output_links) &&
input_node->active && output_node->active)
pw_link_activate(link);
}
@ -1267,9 +1294,3 @@ struct pw_port *pw_link_get_input(struct pw_link *link)
{
return link->input;
}
void pw_link_inc_idle(struct pw_link *link)
{
link->input->node->idle_used_input_links++;
link->output->node->idle_used_output_links++;
}

View file

@ -71,6 +71,10 @@ struct pw_link_events {
void (*port_unlinked) (void *data, struct pw_port *port);
};
/** Indicate that a link is passive, it does not cause the nodes to activate,
* set to "1" or "0" */
#define PW_LINK_PROP_PASSIVE "pipewire.link.passive"
/** Make a new link between two ports \memberof pw_link
* \return a newly allocated link */
struct pw_link *
@ -118,17 +122,6 @@ struct pw_port *pw_link_get_input(struct pw_link *link);
/** Find the link between 2 ports \memberof pw_link */
struct pw_link *pw_link_find(struct pw_port *output, struct pw_port *input);
/** Indicate that linked nodes can be idle even when linked with this link */
void pw_link_inc_idle(struct pw_link *link);
/** Activate a link \memberof pw_link
* Starts the negotiation of formats and buffers on \a link and then
* starts data streaming */
bool pw_link_activate(struct pw_link *link);
/** Deactivate a link \memberof pw_link */
bool pw_link_deactivate(struct pw_link *link);
#ifdef __cplusplus
}
#endif

View file

@ -95,9 +95,7 @@ struct pw_loop * pw_main_loop_get_loop(struct pw_main_loop *loop)
void pw_main_loop_quit(struct pw_main_loop *loop)
{
pw_log_debug("main-loop %p: quit", loop);
if (loop->running) {
pw_loop_signal_event(loop->loop, loop->event);
}
pw_loop_signal_event(loop->loop, loop->event);
}
/** Start a main loop

View file

@ -786,13 +786,16 @@ int pw_node_set_state(struct pw_node *node, enum pw_node_state state)
break;
case PW_NODE_STATE_IDLE:
res = pause_node(node);
if (!node->active)
res = pause_node(node);
break;
case PW_NODE_STATE_RUNNING:
node_activate(node);
send_clock_update(node);
res = start_node(node);
if (node->active) {
node_activate(node);
send_clock_update(node);
res = start_node(node);
}
break;
case PW_NODE_STATE_ERROR:
@ -848,3 +851,23 @@ void pw_node_update_state(struct pw_node *node, enum pw_node_state state, char *
node->info.change_mask = 0;
}
}
bool pw_node_set_active(struct pw_node *node, bool active)
{
bool old = node->active;
if (old != active) {
pw_log_debug("node %p: %s", node, active ? "activate" : "deactivate");
node->active = active;
if (active)
node_activate(node);
else
pw_node_set_state(node, PW_NODE_STATE_IDLE);
}
return true;
}
bool pw_node_is_active(struct pw_node *node)
{
return node->active;
}

View file

@ -86,6 +86,11 @@ struct pw_node_events {
void (*reuse_buffer) (void *data, uint32_t port_id, uint32_t buffer_id);
};
/** Automatically connect this node to a compatible node */
#define PW_NODE_PROP_AUTOCONNECT "pipewire.autoconnect"
/** Try to connect the node to this node id */
#define PW_NODE_PROP_TARGET_NODE "pipewire.target.node"
/** Create a new node \memberof pw_node */
struct pw_node *
pw_node_new(struct pw_core *core, /**< the core */
@ -148,11 +153,12 @@ uint32_t pw_node_get_free_port_id(struct pw_node *node, enum pw_direction direct
* or a new port */
struct pw_port * pw_node_get_free_port(struct pw_node *node, enum pw_direction direction);
/** Change the state of the node */
int pw_node_set_state(struct pw_node *node, enum pw_node_state state);
/** Set a node active. This will start negotiation with all linked active
* nodes and start data transport */
bool pw_node_set_active(struct pw_node *node, bool active);
/** Update the state of the node, mostly used by node implementations */
void pw_node_update_state(struct pw_node *node, enum pw_node_state state, char *error);
/** Check is a node is active */
bool pw_node_is_active(struct pw_node *node);
#ifdef __cplusplus
}

View file

@ -325,11 +325,11 @@ void pw_fill_remote_properties(struct pw_core *core, struct pw_properties *prope
pw_properties_set(properties, "application.process.session_id",
getenv("XDG_SESSION_ID"));
}
pw_properties_set(properties, "pipewire.core.version", core->info.version);
pw_properties_set(properties, "pipewire.core.name", core->info.name);
pw_properties_set(properties, PW_CORE_PROP_VERSION, core->info.version);
pw_properties_set(properties, PW_CORE_PROP_NAME, core->info.name);
if ((val = pw_properties_get(core->properties, "pipewire.daemon")))
pw_properties_set(properties, "pipewire.daemon", val);
if ((val = pw_properties_get(core->properties, PW_CORE_PROP_DAEMON)))
pw_properties_set(properties, PW_CORE_PROP_DAEMON, val);
}
/** Fill stream properties

View file

@ -225,6 +225,7 @@ struct pw_node {
struct pw_node_info info; /**< introspectable node info */
bool active; /**< if the node is active */
bool live; /**< if the node is live */
struct spa_clock *clock; /**< handle to SPA clock if any */
struct spa_node *node; /**< SPA node implementation */
@ -411,6 +412,20 @@ int pw_port_alloc_buffers(struct pw_port *port,
struct spa_param **params, uint32_t n_params,
struct spa_buffer **buffers, uint32_t *n_buffers);
/** Change the state of the node */
int pw_node_set_state(struct pw_node *node, enum pw_node_state state);
/** Update the state of the node, mostly used by node implementations */
void pw_node_update_state(struct pw_node *node, enum pw_node_state state, char *error);
/** Activate a link \memberof pw_link
* Starts the negotiation of formats and buffers on \a link and then
* starts data streaming */
bool pw_link_activate(struct pw_link *link);
/** Deactivate a link \memberof pw_link */
bool pw_link_deactivate(struct pw_link *link);
/** \endcond */
#ifdef __cplusplus

View file

@ -67,6 +67,10 @@ pw_properties_get(const struct pw_properties *properties, const char *key);
const char *
pw_properties_iterate(const struct pw_properties *properties, void **state);
static inline bool pw_properties_parse_bool(const char *value) {
return (strcmp(value, "true") == 0 || atoi(value) == 1);
}
#ifdef __cplusplus
}
#endif

View file

@ -244,7 +244,7 @@ struct pw_remote *pw_remote_new(struct pw_core *core,
spa_hook_list_init(&this->listener_list);
if ((protocol_name = pw_properties_get(properties, "pipewire.protocol")) == NULL) {
if ((protocol_name = pw_properties_get(properties, PW_REMOTE_PROP_PROTOCOL)) == NULL) {
if (!pw_module_load(core, "libpipewire-module-protocol-native", NULL))
goto no_protocol;
@ -941,9 +941,9 @@ handle_node_command(struct pw_proxy *proxy, uint32_t seq, const struct spa_comma
#if 0
if (cu->body.flags.value & SPA_COMMAND_NODE_CLOCK_UPDATE_FLAG_LIVE) {
pw_properties_set(stream->properties, "pipewire.latency.is-live", "1");
pw_properties_set(stream->properties, PW_STREAM_PROP_IS_LIVE, "1");
pw_properties_setf(stream->properties,
"pipewire.latency.min", "%" PRId64,
PW_STREAM_PROP_LATENCY_MIN, "%" PRId64,
cu->body.latency.value);
}
impl->last_ticks = cu->body.ticks.value;

View file

@ -138,6 +138,11 @@ struct pw_remote_events {
enum pw_remote_state state, const char *error);
};
/** Specify the name of the protocol to use, default is using the native protocol */
#define PW_REMOTE_PROP_PROTOCOL "pipewire.protocol"
/** The name of the remote to connect to, default env(PIPEWIRE_REMOTE) or pipewire-0 */
#define PW_REMOTE_PROP_REMOTE_NAME "pipewire.remote.name"
/** Create a new unconnected remote \memberof pw_remote
* \return a new unconnected remote */
struct pw_remote *

View file

@ -156,7 +156,7 @@ void pw_resource_destroy(struct pw_resource *resource)
{
struct pw_client *client = resource->client;
pw_log_trace("resource %p: destroy %u", resource, resource->id);
pw_log_debug("resource %p: destroy %u", resource, resource->id);
spa_hook_list_call(&resource->listener_list, struct pw_resource_events, destroy);
pw_map_insert_at(&client->objects, resource->id, NULL);
@ -165,6 +165,6 @@ void pw_resource_destroy(struct pw_resource *resource)
if (client->core_resource)
pw_core_resource_remove_id(client->core_resource, resource->id);
pw_log_trace("resource %p: free", resource);
pw_log_debug("resource %p: free", resource);
free(resource);
}

View file

@ -646,9 +646,9 @@ handle_node_command(struct pw_stream *stream, uint32_t seq, const struct spa_com
struct spa_command_node_clock_update *cu = (__typeof__(cu)) command;
if (cu->body.flags.value & SPA_COMMAND_NODE_CLOCK_UPDATE_FLAG_LIVE) {
pw_properties_set(stream->properties, "pipewire.latency.is-live", "1");
pw_properties_set(stream->properties, PW_STREAM_PROP_IS_LIVE, "1");
pw_properties_setf(stream->properties,
"pipewire.latency.min", "%" PRId64,
PW_STREAM_PROP_LATENCY_MIN, "%" PRId64,
cu->body.latency.value);
}
impl->last_ticks = cu->body.ticks.value;
@ -953,9 +953,9 @@ pw_stream_connect(struct pw_stream *stream,
if (stream->properties == NULL)
stream->properties = pw_properties_new(NULL, NULL);
if (port_path)
pw_properties_set(stream->properties, "pipewire.target.node", port_path);
pw_properties_set(stream->properties, PW_NODE_PROP_TARGET_NODE, port_path);
if (flags & PW_STREAM_FLAG_AUTOCONNECT)
pw_properties_set(stream->properties, "pipewire.autoconnect", "1");
pw_properties_set(stream->properties, PW_NODE_PROP_AUTOCONNECT, "1");
impl->node_proxy = pw_core_proxy_create_object(stream->remote->core_proxy,
"client-node",

View file

@ -248,6 +248,13 @@ enum pw_stream_state pw_stream_get_state(struct pw_stream *stream, const char **
const char *pw_stream_get_name(struct pw_stream *stream);
/** Indicates that the stream is live, boolean default false */
#define PW_STREAM_PROP_IS_LIVE "pipewire.latency.is-live"
/** The minimum latency of the stream, int, default 0 */
#define PW_STREAM_PROP_LATENCY_MIN "pipewire.latency.min"
/** The maximum latency of the stream, int default MAXINT */
#define PW_STREAM_PROP_LATENCY_MAX "pipewire.latency.max"
const struct pw_properties *pw_stream_get_properties(struct pw_stream *stream);
/** Connect a stream for input or output on \a port_path. \memberof pw_stream

View file

@ -374,7 +374,7 @@ static bool do_connect(struct data *data, const char *cmd, char *args, char **er
n = pw_split_ip(args, WHITESPACE, 1, a);
if (n == 1) {
props = pw_properties_new("pipewire.remote.name", a[0], NULL);
props = pw_properties_new(PW_REMOTE_PROP_REMOTE_NAME, a[0], NULL);
}
remote = pw_remote_new(data->core, props, sizeof(struct remote_data));
@ -1054,7 +1054,7 @@ int main(int argc, char *argv[])
spa_list_init(&data.remotes);
pw_map_init(&data.vars, 64, 16);
data.core = pw_core_new(l, pw_properties_new("pipewire.daemon", "1", NULL));
data.core = pw_core_new(l, pw_properties_new(PW_CORE_PROP_DAEMON, "1", NULL));
data.t = pw_core_get_type(data.core);
info = pw_core_get_info(data.core);