From c4b2be2aad373c7e19b7c613b0926e2ee3d5f214 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 3 Mar 2020 18:17:46 +0100 Subject: [PATCH] use true and false for boolean properties So that it's easier to convert them to booleans in introspection code later. --- pipewire-jack/src/pipewire-jack.c | 6 +++--- pipewire-pulseaudio/src/stream.c | 2 +- spa/plugins/audioconvert/merger.c | 2 +- spa/plugins/audioconvert/resample.c | 2 +- spa/plugins/videoconvert/videoadapter.c | 2 +- src/daemon/main.c | 2 +- src/examples/export-sink.c | 2 +- src/examples/export-source.c | 4 ++-- src/examples/export-spa.c | 2 +- src/examples/local-v4l2.c | 2 +- src/examples/video-dsp-play.c | 2 +- src/modules/module-adapter/adapter.c | 4 ++-- src/pipewire/impl-port.c | 6 +++--- src/pipewire/pipewire.c | 4 ++-- src/pipewire/stream.c | 12 ++++++------ src/tools/pw-cli.c | 2 +- 16 files changed, 28 insertions(+), 28 deletions(-) diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c index 6a5e9d219..3cff783c1 100644 --- a/pipewire-jack/src/pipewire-jack.c +++ b/pipewire-jack/src/pipewire-jack.c @@ -2224,7 +2224,7 @@ jack_client_t * jack_client_open (const char *client_name, } props = SPA_DICT_INIT(items, 0); - items[props.n_items++] = SPA_DICT_ITEM_INIT("loop.cancel", "1"); + items[props.n_items++] = SPA_DICT_ITEM_INIT("loop.cancel", "true"); client->loop = pw_data_loop_new(&props); if (client->loop == NULL) goto init_failed; @@ -2276,7 +2276,7 @@ jack_client_t * jack_client_open (const char *client_name, if ((str = getenv("PIPEWIRE_LATENCY")) == NULL) str = DEFAULT_LATENCY; items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_NODE_LATENCY, str); - items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_NODE_ALWAYS_PROCESS, "1"); + items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_NODE_ALWAYS_PROCESS, "true"); client->node = pw_core_create_object(client->core, "client-node", @@ -3665,7 +3665,7 @@ int jack_connect (jack_client_t *client, items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_LINK_OUTPUT_PORT, val[1]); items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_LINK_INPUT_NODE, val[2]); items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_LINK_INPUT_PORT, val[3]); - items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_OBJECT_LINGER, "1"); + items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_OBJECT_LINGER, "true"); pw_core_create_object(c->core, "link-factory", diff --git a/pipewire-pulseaudio/src/stream.c b/pipewire-pulseaudio/src/stream.c index ace01e46d..7cdd73b97 100644 --- a/pipewire-pulseaudio/src/stream.c +++ b/pipewire-pulseaudio/src/stream.c @@ -991,7 +991,7 @@ static int create_stream(pa_stream_direction_t direction, direction == PA_STREAM_PLAYBACK ? "Playback" : "Capture"); items[3] = SPA_DICT_ITEM_INIT(PW_KEY_MEDIA_ROLE, str); - items[4] = SPA_DICT_ITEM_INIT(PW_KEY_STREAM_MONITOR, monitor ? "1" : "0"); + items[4] = SPA_DICT_ITEM_INIT(PW_KEY_STREAM_MONITOR, monitor ? "true" : "false"); pw_stream_update_properties(s->stream, &SPA_DICT_INIT(items, 5)); diff --git a/spa/plugins/audioconvert/merger.c b/spa/plugins/audioconvert/merger.c index e3d917892..a552c629d 100644 --- a/spa/plugins/audioconvert/merger.c +++ b/spa/plugins/audioconvert/merger.c @@ -150,7 +150,7 @@ static void emit_port_info(struct impl *this, struct port *port, bool full) items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "32 bit float mono audio"); items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_AUDIO_CHANNEL, port->position); if (port->direction == SPA_DIRECTION_OUTPUT) - items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_MONITOR, "1"); + items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_MONITOR, "true"); } port->info.props = &SPA_DICT_INIT(items, n_items); diff --git a/spa/plugins/audioconvert/resample.c b/spa/plugins/audioconvert/resample.c index c83da3119..0b14ef9b1 100644 --- a/spa/plugins/audioconvert/resample.c +++ b/spa/plugins/audioconvert/resample.c @@ -928,7 +928,7 @@ impl_init(const struct spa_handle_factory *factory, if ((str = spa_dict_lookup(info, "resample.quality")) != NULL) this->props.quality = atoi(str); if ((str = spa_dict_lookup(info, "resample.peaks")) != NULL) - this->peaks = atoi(str); + this->peaks = strcmp(str, "true") == 0 || atoi(str) == 1; if ((str = spa_dict_lookup(info, "factory.mode")) != NULL) { if (strcmp(str, "split") == 0) this->mode = MODE_SPLIT; diff --git a/spa/plugins/videoconvert/videoadapter.c b/spa/plugins/videoconvert/videoadapter.c index b262d2349..ac06ec459 100644 --- a/spa/plugins/videoconvert/videoadapter.c +++ b/spa/plugins/videoconvert/videoadapter.c @@ -196,7 +196,7 @@ static void emit_node_info(struct impl *this, bool full) struct spa_dict_item items[1]; this->info.change_mask |= SPA_NODE_CHANGE_MASK_PROPS; - items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_NODE_DRIVER, this->driver ? "1" : "0"); + items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_NODE_DRIVER, this->driver ? "true" : "false"); this->info.props = &SPA_DICT_INIT(items, 1); spa_node_emit_info(&this->hooks, &this->info); diff --git a/src/daemon/main.c b/src/daemon/main.c index 01eb2c717..d5074ebac 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -92,7 +92,7 @@ int main(int argc, char *argv[]) properties = pw_properties_new( PW_KEY_CORE_NAME, daemon_name, PW_KEY_CONTEXT_PROFILE_MODULES, "none", - PW_KEY_CORE_DAEMON, "1", NULL); + PW_KEY_CORE_DAEMON, "true", NULL); /* parse configuration */ config = pw_daemon_config_new(properties); diff --git a/src/examples/export-sink.c b/src/examples/export-sink.c index 073a63815..ec4696cc5 100644 --- a/src/examples/export-sink.c +++ b/src/examples/export-sink.c @@ -463,7 +463,7 @@ static void make_node(struct data *data) { struct pw_properties *props; - props = pw_properties_new(PW_KEY_NODE_AUTOCONNECT, "1", NULL); + props = pw_properties_new(PW_KEY_NODE_AUTOCONNECT, "true", NULL); if (data->path) pw_properties_set(props, PW_KEY_NODE_TARGET, data->path); pw_properties_set(props, PW_KEY_MEDIA_CLASS, "Stream/Input/Video"); diff --git a/src/examples/export-source.c b/src/examples/export-source.c index ea13da4a3..6e53c0126 100644 --- a/src/examples/export-source.c +++ b/src/examples/export-source.c @@ -469,8 +469,8 @@ static void make_node(struct data *data) { struct pw_properties *props; - props = pw_properties_new(PW_KEY_NODE_AUTOCONNECT, "1", - PW_KEY_NODE_EXCLUSIVE, "1", + props = pw_properties_new(PW_KEY_NODE_AUTOCONNECT, "true", + PW_KEY_NODE_EXCLUSIVE, "true", PW_KEY_MEDIA_TYPE, "Audio", PW_KEY_MEDIA_CATEGORY, "Playback", PW_KEY_MEDIA_ROLE, "Music", diff --git a/src/examples/export-spa.c b/src/examples/export-spa.c index 863bb34d5..e6c7429de 100644 --- a/src/examples/export-spa.c +++ b/src/examples/export-spa.c @@ -87,7 +87,7 @@ static int make_node(struct data *data) data->node = iface; if (data->path) { - pw_properties_set(props, PW_KEY_NODE_AUTOCONNECT, "1"); + pw_properties_set(props, PW_KEY_NODE_AUTOCONNECT, "true"); pw_properties_set(props, PW_KEY_NODE_TARGET, data->path); } diff --git a/src/examples/local-v4l2.c b/src/examples/local-v4l2.c index f1d910e4e..47b5c0be5 100644 --- a/src/examples/local-v4l2.c +++ b/src/examples/local-v4l2.c @@ -403,7 +403,7 @@ int main(int argc, char *argv[]) data.context = pw_context_new( pw_main_loop_get_loop(data.loop), pw_properties_new( - PW_KEY_CORE_DAEMON, "0", + PW_KEY_CORE_DAEMON, "false", NULL), 0); spa_hook_list_init(&data.hooks); diff --git a/src/examples/video-dsp-play.c b/src/examples/video-dsp-play.c index c76f6c248..8475ed961 100644 --- a/src/examples/video-dsp-play.c +++ b/src/examples/video-dsp-play.c @@ -256,7 +256,7 @@ int main(int argc, char *argv[]) PW_KEY_MEDIA_TYPE, "Video", PW_KEY_MEDIA_CATEGORY, "Capture", PW_KEY_MEDIA_ROLE, "DSP", - PW_KEY_NODE_AUTOCONNECT, "1", + PW_KEY_NODE_AUTOCONNECT, data.target ? "true" : "false", PW_KEY_NODE_TARGET, data.target, PW_KEY_MEDIA_CLASS, "Stream/Input/Video", NULL), diff --git a/src/modules/module-adapter/adapter.c b/src/modules/module-adapter/adapter.c index 32c423aa4..5be84f8a2 100644 --- a/src/modules/module-adapter/adapter.c +++ b/src/modules/module-adapter/adapter.c @@ -127,8 +127,8 @@ static void node_port_init(void *data, struct pw_impl_port *port) } if (direction == n->direction) { if (is_device) { - pw_properties_set(new, PW_KEY_PORT_PHYSICAL, "1"); - pw_properties_set(new, PW_KEY_PORT_TERMINAL, "1"); + pw_properties_set(new, PW_KEY_PORT_PHYSICAL, "true"); + pw_properties_set(new, PW_KEY_PORT_TERMINAL, "true"); } } diff --git a/src/pipewire/impl-port.c b/src/pipewire/impl-port.c index 35b79da3d..d3d4a495f 100644 --- a/src/pipewire/impl-port.c +++ b/src/pipewire/impl-port.c @@ -388,9 +388,9 @@ struct pw_impl_port *pw_context_create_port( if (info) { if (SPA_FLAG_IS_SET(info->flags, SPA_PORT_FLAG_PHYSICAL)) - pw_properties_set(properties, PW_KEY_PORT_PHYSICAL, "1"); + pw_properties_set(properties, PW_KEY_PORT_PHYSICAL, "true"); if (SPA_FLAG_IS_SET(info->flags, SPA_PORT_FLAG_TERMINAL)) - pw_properties_set(properties, PW_KEY_PORT_TERMINAL, "1"); + pw_properties_set(properties, PW_KEY_PORT_TERMINAL, "true"); this->spa_flags = info->flags; } @@ -855,7 +855,7 @@ int pw_impl_port_add(struct pw_impl_port *port, struct pw_impl_node *node) control = PW_IMPL_PORT_IS_CONTROL(port); if (control) { dir = port->direction == PW_DIRECTION_INPUT ? "control" : "notify"; - pw_properties_set(port->properties, PW_KEY_PORT_CONTROL, "1"); + pw_properties_set(port->properties, PW_KEY_PORT_CONTROL, "true"); } else { dir = port->direction == PW_DIRECTION_INPUT ? "in" : "out"; diff --git a/src/pipewire/pipewire.c b/src/pipewire/pipewire.c index 424569447..ff6f30804 100644 --- a/src/pipewire/pipewire.c +++ b/src/pipewire/pipewire.c @@ -378,8 +378,8 @@ void pw_init(int *argc, char **argv[]) support->registry = &global_registry; n_items = 0; - items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_LOG_COLORS, "1"); - items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_LOG_TIMESTAMP, "1"); + items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_LOG_COLORS, "true"); + items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_LOG_TIMESTAMP, "true"); snprintf(level, sizeof(level), "%d", pw_log_level); items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_LOG_LEVEL, level); if ((str = getenv("PIPEWIRE_LOG")) != NULL) diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 23ea03c87..8b8046d0c 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -1073,7 +1073,7 @@ stream_new(struct pw_context *context, const char *name, } if (pw_properties_get(props, PW_KEY_STREAM_IS_LIVE) == NULL) - pw_properties_set(props, PW_KEY_STREAM_IS_LIVE, "1"); + pw_properties_set(props, PW_KEY_STREAM_IS_LIVE, "true"); if (pw_properties_get(props, PW_KEY_NODE_NAME) == NULL && extra) { str = pw_properties_get(extra, PW_KEY_APP_NAME); @@ -1417,13 +1417,13 @@ pw_stream_connect(struct pw_stream *stream, if (target_id != PW_ID_ANY) pw_properties_setf(stream->properties, PW_KEY_NODE_TARGET, "%d", target_id); if (flags & PW_STREAM_FLAG_AUTOCONNECT) - pw_properties_set(stream->properties, PW_KEY_NODE_AUTOCONNECT, "1"); + pw_properties_set(stream->properties, PW_KEY_NODE_AUTOCONNECT, "true"); if (flags & PW_STREAM_FLAG_DRIVER) - pw_properties_set(stream->properties, PW_KEY_NODE_DRIVER, "1"); + pw_properties_set(stream->properties, PW_KEY_NODE_DRIVER, "true"); if (flags & PW_STREAM_FLAG_EXCLUSIVE) - pw_properties_set(stream->properties, PW_KEY_NODE_EXCLUSIVE, "1"); + pw_properties_set(stream->properties, PW_KEY_NODE_EXCLUSIVE, "true"); if (flags & PW_STREAM_FLAG_DONT_RECONNECT) - pw_properties_set(stream->properties, PW_KEY_NODE_DONT_RECONNECT, "1"); + pw_properties_set(stream->properties, PW_KEY_NODE_DONT_RECONNECT, "true"); if ((pw_properties_get(stream->properties, PW_KEY_MEDIA_CLASS) == NULL)) { pw_properties_setf(stream->properties, PW_KEY_MEDIA_CLASS, "Stream/%s/%s", @@ -1456,7 +1456,7 @@ pw_stream_connect(struct pw_stream *stream, if ((str = pw_properties_get(props, PW_KEY_STREAM_MONITOR)) && pw_properties_parse_bool(str)) { - pw_properties_set(props, "resample.peaks", "1"); + pw_properties_set(props, "resample.peaks", "true"); } follower = pw_context_create_node(impl->context, pw_properties_copy(props), 0); diff --git a/src/tools/pw-cli.c b/src/tools/pw-cli.c index 0fd4d27e9..450874915 100644 --- a/src/tools/pw-cli.c +++ b/src/tools/pw-cli.c @@ -6579,7 +6579,7 @@ int main(int argc, char *argv[]) spa_list_init(&data.remotes); pw_map_init(&data.vars, 64, 16); - data.context = pw_context_new(l, pw_properties_new(PW_KEY_CORE_DAEMON, "1", NULL), 0); + data.context = pw_context_new(l, pw_properties_new(PW_KEY_CORE_DAEMON, "true", NULL), 0); pw_context_load_module(data.context, "libpipewire-module-link-factory", NULL, NULL);