diff --git a/src/modules/module-protocol-pulse.c b/src/modules/module-protocol-pulse.c index 55ed4c4ad..3210f043d 100644 --- a/src/modules/module-protocol-pulse.c +++ b/src/modules/module-protocol-pulse.c @@ -43,6 +43,11 @@ #define NAME "protocol-pulse" +PW_LOG_TOPIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic +PW_LOG_TOPIC(pulse_ext_dev_restore, "mod." NAME ".device-restore"); +PW_LOG_TOPIC(pulse_ext_stream_restore, "mod." NAME ".stream-restore"); + #define MODULE_USAGE PW_PROTOCOL_PULSE_USAGE static const struct spa_dict_item module_props[] = { @@ -88,6 +93,12 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args) struct impl *impl; int res; + PW_LOG_TOPIC_INIT(mod_topic); + /* it's easier to init these here than adding an init() call to the + * extensions */ + PW_LOG_TOPIC_INIT(pulse_ext_dev_restore); + PW_LOG_TOPIC_INIT(pulse_ext_stream_restore); + impl = calloc(1, sizeof(struct impl)); if (impl == NULL) return -errno; diff --git a/src/modules/module-protocol-pulse/client.c b/src/modules/module-protocol-pulse/client.c index 5d145bedc..21641bda4 100644 --- a/src/modules/module-protocol-pulse/client.c +++ b/src/modules/module-protocol-pulse/client.c @@ -40,6 +40,7 @@ #include "commands.h" #include "defs.h" #include "internal.h" +#include "log.h" #include "manager.h" #include "message.h" #include "operation.h" diff --git a/src/modules/module-protocol-pulse/collect.c b/src/modules/module-protocol-pulse/collect.c index 0d786c7c8..770e211f2 100644 --- a/src/modules/module-protocol-pulse/collect.c +++ b/src/modules/module-protocol-pulse/collect.c @@ -30,6 +30,7 @@ #include "collect.h" #include "defs.h" +#include "log.h" #include "manager.h" void select_best(struct selector *s, struct pw_manager_object *o) diff --git a/src/modules/module-protocol-pulse/dbus-name.c b/src/modules/module-protocol-pulse/dbus-name.c index aa3ead1ef..b82bc4577 100644 --- a/src/modules/module-protocol-pulse/dbus-name.c +++ b/src/modules/module-protocol-pulse/dbus-name.c @@ -29,8 +29,8 @@ #include #include #include -#include +#include "log.h" #include "dbus-name.h" void *dbus_request_name(struct pw_context *context, const char *name) diff --git a/src/modules/module-protocol-pulse/extensions/ext-device-restore.c b/src/modules/module-protocol-pulse/extensions/ext-device-restore.c index 072e90516..ae67ec5f4 100644 --- a/src/modules/module-protocol-pulse/extensions/ext-device-restore.c +++ b/src/modules/module-protocol-pulse/extensions/ext-device-restore.c @@ -48,6 +48,10 @@ #include "../reply.h" #include "../volume.h" +PW_LOG_TOPIC_EXTERN(pulse_ext_dev_restore); +#undef PW_LOG_TOPIC_DEFAULT +#define PW_LOG_TOPIC_DEFAULT pulse_ext_dev_restore + #define DEVICE_TYPE_SINK 0 #define DEVICE_TYPE_SOURCE 1 diff --git a/src/modules/module-protocol-pulse/extensions/ext-stream-restore.c b/src/modules/module-protocol-pulse/extensions/ext-stream-restore.c index 7252ea168..963891aec 100644 --- a/src/modules/module-protocol-pulse/extensions/ext-stream-restore.c +++ b/src/modules/module-protocol-pulse/extensions/ext-stream-restore.c @@ -47,6 +47,10 @@ #include "../reply.h" #include "../volume.h" +PW_LOG_TOPIC_EXTERN(pulse_ext_stream_restore); +#undef PW_LOG_TOPIC_DEFAULT +#define PW_LOG_TOPIC_DEFAULT pulse_ext_stream_restore + static int do_extension_stream_restore_test(struct client *client, uint32_t command, uint32_t tag, struct message *m) { struct message *reply; diff --git a/src/modules/module-protocol-pulse/log.h b/src/modules/module-protocol-pulse/log.h new file mode 100644 index 000000000..e1f5ca755 --- /dev/null +++ b/src/modules/module-protocol-pulse/log.h @@ -0,0 +1,34 @@ +/* PipeWire + * + * Copyright © 2021 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +#ifndef PULSE_LOG_H +#define PULSE_LOG_H + +#include + +PW_LOG_TOPIC_EXTERN(mod_topic); +#define PW_LOG_TOPIC_DEFAULT mod_topic + +#endif /* PULSE_LOG_H */ diff --git a/src/modules/module-protocol-pulse/manager.c b/src/modules/module-protocol-pulse/manager.c index 0e978ff8e..ff01a2668 100644 --- a/src/modules/module-protocol-pulse/manager.c +++ b/src/modules/module-protocol-pulse/manager.c @@ -30,6 +30,8 @@ #include #include +#include "log.h" + #define MAX_PARAMS 32 #define manager_emit_sync(m) spa_hook_list_call(&m->hooks, struct pw_manager_events, sync, 0) diff --git a/src/modules/module-protocol-pulse/message-handler.c b/src/modules/module-protocol-pulse/message-handler.c index 00f304dcd..183156d94 100644 --- a/src/modules/module-protocol-pulse/message-handler.c +++ b/src/modules/module-protocol-pulse/message-handler.c @@ -14,6 +14,7 @@ #include #include "collect.h" +#include "log.h" #include "manager.h" #include "message-handler.h" @@ -22,7 +23,7 @@ static int bluez_card_object_message_handler(struct pw_manager *m, struct pw_man struct transport_codec_info codecs[64]; uint32_t n_codecs, active; - pw_log_debug(NAME ": bluez-card %p object message:'%s' params:'%s'", o, message, params); + pw_log_debug(": bluez-card %p object message:'%s' params:'%s'", o, message, params); n_codecs = collect_transport_codec_info(o, codecs, SPA_N_ELEMENTS(codecs), &active); @@ -92,7 +93,7 @@ static int bluez_card_object_message_handler(struct pw_manager *m, struct pw_man static int core_object_message_handler(struct pw_manager *m, struct pw_manager_object *o, const char *message, const char *params, char **response) { - pw_log_debug(NAME ": core %p object message:'%s' params:'%s'", o, message, params); + pw_log_debug(": core %p object message:'%s' params:'%s'", o, message, params); if (spa_streq(message, "list-handlers")) { FILE *r; diff --git a/src/modules/module-protocol-pulse/message.c b/src/modules/module-protocol-pulse/message.c index 75b95646b..c91821fd4 100644 --- a/src/modules/module-protocol-pulse/message.c +++ b/src/modules/module-protocol-pulse/message.c @@ -34,6 +34,7 @@ #include "defs.h" #include "format.h" #include "internal.h" +#include "log.h" #include "media-roles.h" #include "message.h" #include "volume.h" diff --git a/src/modules/module-protocol-pulse/module.c b/src/modules/module-protocol-pulse/module.c index 2627db29d..01a8233c3 100644 --- a/src/modules/module-protocol-pulse/module.c +++ b/src/modules/module-protocol-pulse/module.c @@ -39,6 +39,7 @@ #include "defs.h" #include "format.h" #include "internal.h" +#include "log.h" #include "module.h" static void on_module_unload(void *obj, void *data, int res, uint32_t id) diff --git a/src/modules/module-protocol-pulse/modules/module-combine-sink.c b/src/modules/module-protocol-pulse/modules/module-combine-sink.c index a8528b8f3..2426c4ab0 100644 --- a/src/modules/module-protocol-pulse/modules/module-combine-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-combine-sink.c @@ -32,6 +32,11 @@ #include "../module.h" #include "registry.h" +#define NAME "combine-sink" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + #define MAX_SINKS 64 /* ... good enough for anyone */ static const struct spa_dict_item module_combine_sink_info[] = { @@ -418,6 +423,8 @@ struct module *create_module_combine_sink(struct impl *impl, const char *argumen struct spa_audio_info_raw info = { 0 }; int i, n, res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_combine_sink_info)); if (!props) { res = -EINVAL; diff --git a/src/modules/module-protocol-pulse/modules/module-echo-cancel.c b/src/modules/module-protocol-pulse/modules/module-echo-cancel.c index 1481fdc72..cd0762cbe 100644 --- a/src/modules/module-protocol-pulse/modules/module-echo-cancel.c +++ b/src/modules/module-protocol-pulse/modules/module-echo-cancel.c @@ -33,6 +33,11 @@ #include "../module.h" #include "registry.h" +#define NAME "echo-cancel" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + struct module_echo_cancel_data { struct module *module; @@ -164,6 +169,8 @@ struct module *create_module_echo_cancel(struct impl *impl, const char *argument struct spa_audio_info_raw info = { 0 }; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_echo_cancel_info)); aec_props = pw_properties_new(NULL, NULL); source_props = pw_properties_new(NULL, NULL); diff --git a/src/modules/module-protocol-pulse/modules/module-ladspa-sink.c b/src/modules/module-protocol-pulse/modules/module-ladspa-sink.c index bebfee7ec..768e01466 100644 --- a/src/modules/module-protocol-pulse/modules/module-ladspa-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-ladspa-sink.c @@ -32,6 +32,11 @@ #include "../module.h" #include "registry.h" +#define NAME "ladspa-sink" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + struct module_ladspa_sink_data { struct module *module; @@ -172,6 +177,8 @@ struct module *create_module_ladspa_sink(struct impl *impl, const char *argument struct spa_audio_info_raw playback_info = { 0 }; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_ladspa_sink_info)); capture_props = pw_properties_new(NULL, NULL); playback_props = pw_properties_new(NULL, NULL); diff --git a/src/modules/module-protocol-pulse/modules/module-ladspa-source.c b/src/modules/module-protocol-pulse/modules/module-ladspa-source.c index ec9eee34b..14611ab91 100644 --- a/src/modules/module-protocol-pulse/modules/module-ladspa-source.c +++ b/src/modules/module-protocol-pulse/modules/module-ladspa-source.c @@ -32,6 +32,11 @@ #include "../module.h" #include "registry.h" +#define NAME "ladspa-source" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + struct module_ladspa_source_data { struct module *module; @@ -172,6 +177,8 @@ struct module *create_module_ladspa_source(struct impl *impl, const char *argume struct spa_audio_info_raw playback_info = { 0 }; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_ladspa_source_info)); capture_props = pw_properties_new(NULL, NULL); playback_props = pw_properties_new(NULL, NULL); diff --git a/src/modules/module-protocol-pulse/modules/module-loopback.c b/src/modules/module-protocol-pulse/modules/module-loopback.c index 64c6fd106..85d567e82 100644 --- a/src/modules/module-protocol-pulse/modules/module-loopback.c +++ b/src/modules/module-protocol-pulse/modules/module-loopback.c @@ -33,6 +33,11 @@ #include "../module.h" #include "registry.h" +#define NAME "loopback" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + struct module_loopback_data { struct module *module; @@ -150,6 +155,8 @@ struct module *create_module_loopback(struct impl *impl, const char *argument) struct spa_audio_info_raw info = { 0 }; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_loopback_info)); capture_props = pw_properties_new(NULL, NULL); playback_props = pw_properties_new(NULL, NULL); diff --git a/src/modules/module-protocol-pulse/modules/module-native-protocol-tcp.c b/src/modules/module-protocol-pulse/modules/module-native-protocol-tcp.c index 63c0ac3c5..8b8711fec 100644 --- a/src/modules/module-protocol-pulse/modules/module-native-protocol-tcp.c +++ b/src/modules/module-protocol-pulse/modules/module-native-protocol-tcp.c @@ -29,6 +29,11 @@ #include "../server.h" #include "registry.h" +#define NAME "protocol-tcp" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + struct module_native_protocol_tcp_data { struct module *module; struct pw_array servers; @@ -88,6 +93,8 @@ struct module *create_module_native_protocol_tcp(struct impl *impl, const char * const char *port, *listen; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_native_protocol_tcp_info)); if (props == NULL) { res = -errno; diff --git a/src/modules/module-protocol-pulse/modules/module-null-sink.c b/src/modules/module-protocol-pulse/modules/module-null-sink.c index 110962d70..2ee4c1fe8 100644 --- a/src/modules/module-protocol-pulse/modules/module-null-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-null-sink.c @@ -28,6 +28,11 @@ #include "../module.h" #include "registry.h" +#define NAME "null-sink" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + struct module_null_sink_data { struct pw_proxy *proxy; struct spa_hook listener; @@ -137,6 +142,8 @@ struct module *create_module_null_sink(struct impl *impl, const char *argument) uint32_t i; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_null_sink_info)); if (props == NULL) { res = -EINVAL; diff --git a/src/modules/module-protocol-pulse/modules/module-pipe-sink.c b/src/modules/module-protocol-pulse/modules/module-pipe-sink.c index 9ba8227fa..26bda17cb 100644 --- a/src/modules/module-protocol-pulse/modules/module-pipe-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-pipe-sink.c @@ -36,6 +36,11 @@ #include "../module.h" #include "registry.h" +#define NAME "pipe-sink" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + #define DEFAULT_FILE_NAME "/tmp/music.output" struct module_pipesink_data { @@ -231,6 +236,8 @@ struct module *create_module_pipe_sink(struct impl *impl, const char *argument) int res = 0; int fd = -1; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_pipesink_info)); capture_props = pw_properties_new(NULL, NULL); if (!props || !capture_props) { diff --git a/src/modules/module-protocol-pulse/modules/module-pipe-source.c b/src/modules/module-protocol-pulse/modules/module-pipe-source.c index ef1ab6769..685851298 100644 --- a/src/modules/module-protocol-pulse/modules/module-pipe-source.c +++ b/src/modules/module-protocol-pulse/modules/module-pipe-source.c @@ -36,6 +36,12 @@ #include "../module.h" #include "registry.h" +#define NAME "pipe-source" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + + #define DEFAULT_FILE_NAME "/tmp/music.input" struct module_pipesrc_data { @@ -249,6 +255,8 @@ struct module *create_module_pipe_source(struct impl *impl, const char *argument int stride, res = 0; int fd = -1; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_pipesource_info)); playback_props = pw_properties_new(NULL, NULL); if (!props || !playback_props) { diff --git a/src/modules/module-protocol-pulse/modules/module-remap-sink.c b/src/modules/module-protocol-pulse/modules/module-remap-sink.c index d8cc0d94c..2b33756ef 100644 --- a/src/modules/module-protocol-pulse/modules/module-remap-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-remap-sink.c @@ -32,6 +32,11 @@ #include "../module.h" #include "registry.h" +#define NAME "remap-sink" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + struct module_remap_sink_data { struct module *module; @@ -151,6 +156,8 @@ struct module *create_module_remap_sink(struct impl *impl, const char *argument) struct spa_audio_info_raw playback_info = { 0 }; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_remap_sink_info)); capture_props = pw_properties_new(NULL, NULL); playback_props = pw_properties_new(NULL, NULL); diff --git a/src/modules/module-protocol-pulse/modules/module-remap-source.c b/src/modules/module-protocol-pulse/modules/module-remap-source.c index 6d24eb0ef..821a0e708 100644 --- a/src/modules/module-protocol-pulse/modules/module-remap-source.c +++ b/src/modules/module-protocol-pulse/modules/module-remap-source.c @@ -32,6 +32,11 @@ #include "../module.h" #include "registry.h" +#define NAME "remap-sink" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + struct module_remap_source_data { struct module *module; @@ -151,6 +156,8 @@ struct module *create_module_remap_source(struct impl *impl, const char *argumen struct spa_audio_info_raw playback_info = { 0 }; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_remap_source_info)); capture_props = pw_properties_new(NULL, NULL); playback_props = pw_properties_new(NULL, NULL); diff --git a/src/modules/module-protocol-pulse/modules/module-roc-sink.c b/src/modules/module-protocol-pulse/modules/module-roc-sink.c index 00f22d2e7..c2abf7c9f 100644 --- a/src/modules/module-protocol-pulse/modules/module-roc-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-roc-sink.c @@ -31,6 +31,11 @@ #include "../module.h" #include "registry.h" +#define NAME "roc-sink" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + #define ROC_DEFAULT_IP "0.0.0.0" #define ROC_DEFAULT_SOURCE_PORT "10001" #define ROC_DEFAULT_REPAIR_PORT "10002" @@ -137,6 +142,8 @@ struct module *create_module_roc_sink(struct impl *impl, const char *argument) const char *str; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_roc_sink_info)); sink_props = pw_properties_new(NULL, NULL); roc_props = pw_properties_new(NULL, NULL); diff --git a/src/modules/module-protocol-pulse/modules/module-roc-source.c b/src/modules/module-protocol-pulse/modules/module-roc-source.c index 72ed5a938..cd595e118 100644 --- a/src/modules/module-protocol-pulse/modules/module-roc-source.c +++ b/src/modules/module-protocol-pulse/modules/module-roc-source.c @@ -31,6 +31,11 @@ #include "../module.h" #include "registry.h" +#define NAME "roc-source" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + #define ROC_DEFAULT_IP "0.0.0.0" #define ROC_DEFAULT_SOURCE_PORT "10001" #define ROC_DEFAULT_REPAIR_PORT "10002" @@ -140,6 +145,8 @@ struct module *create_module_roc_source(struct impl *impl, const char *argument) const char *str; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_roc_source_info)); source_props = pw_properties_new(NULL, NULL); roc_props = pw_properties_new(NULL, NULL); diff --git a/src/modules/module-protocol-pulse/modules/module-simple-protocol-tcp.c b/src/modules/module-protocol-pulse/modules/module-simple-protocol-tcp.c index 8ab1420bd..3b33d1ea3 100644 --- a/src/modules/module-protocol-pulse/modules/module-simple-protocol-tcp.c +++ b/src/modules/module-protocol-pulse/modules/module-simple-protocol-tcp.c @@ -29,6 +29,11 @@ #include "../module.h" #include "registry.h" +#define NAME "simple-protocol-tcp" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + struct module_simple_protocol_tcp_data { struct module *module; struct pw_properties *module_props; @@ -135,6 +140,8 @@ struct module *create_module_simple_protocol_tcp(struct impl *impl, const char * const char *str, *port, *listen; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_simple_protocol_tcp_info)); if (props == NULL) { res = -errno; diff --git a/src/modules/module-protocol-pulse/modules/module-switch-on-connect.c b/src/modules/module-protocol-pulse/modules/module-switch-on-connect.c index 8b64563cf..83ed17f1c 100644 --- a/src/modules/module-protocol-pulse/modules/module-switch-on-connect.c +++ b/src/modules/module-protocol-pulse/modules/module-switch-on-connect.c @@ -36,7 +36,10 @@ #include "../manager.h" #include "../collect.h" -#define NAME "pulse-server: module-switch-on-connect" +#define NAME "switch-on-connect" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic /* Ignore HDMI by default */ #define DEFAULT_BLOCKLIST "hdmi" @@ -109,24 +112,24 @@ static void manager_added(void *data, struct pw_manager_object *o) if (!card_info || !card_info->props) return; - pw_log_debug(NAME ": considering switching to %s", name); + pw_log_debug("considering switching to %s", name); /* If internal device, only consider hdmi sinks */ str = spa_dict_lookup(info->props, "api.alsa.path"); bus = spa_dict_lookup(card_info->props, PW_KEY_DEVICE_BUS); if ((spa_streq(bus, "pci") || spa_streq(bus, "isa")) && !(pw_manager_object_is_sink(o) && spa_strstartswith(str, "hdmi"))) { - pw_log_debug(NAME ": not switching to internal device"); + pw_log_debug("not switching to internal device"); return; } if (d->blocklist && regexec(d->blocklist, name, 0, NULL, 0) == 0) { - pw_log_debug(NAME ": not switching to blocklisted device"); + pw_log_debug("not switching to blocklisted device"); return; } if (d->ignore_virtual && spa_dict_lookup(info->props, PW_KEY_DEVICE_API) == NULL) { - pw_log_debug(NAME ": not switching to virtual device"); + pw_log_debug("not switching to virtual device"); return; } @@ -135,13 +138,13 @@ static void manager_added(void *data, struct pw_manager_object *o) } /* Switch default */ - pw_log_debug(NAME ": switching to %s", name); + pw_log_debug("switching to %s", name); pw_manager_set_metadata(d->manager, d->metadata_default, PW_ID_CORE, pw_manager_object_is_sink(o) ? METADATA_CONFIG_DEFAULT_SINK : METADATA_CONFIG_DEFAULT_SOURCE, - "Spa:String:JSON", "{ \"name\": \"%s\" }", name); + "Spa:String:JSON", "{ \"name\"\"%s\" }", name); } static void manager_sync(void *data) @@ -163,7 +166,7 @@ static void on_core_done(void *data, uint32_t id, int seq) { struct module_switch_on_connect_data *d = data; if (seq == d->sync_seq) { - pw_log_debug(NAME" %p: started", d); + pw_log_debug("%p: started", d); d->started = true; } } @@ -202,7 +205,7 @@ static int module_switch_on_connect_load(struct client *client, struct module *m return 0; error: - pw_log_error(NAME" %p: failed to connect: %s", impl, spa_strerror(res)); + pw_log_error("%p: failed to connect: %s", impl, spa_strerror(res)); return res; } @@ -259,6 +262,8 @@ struct module *create_module_switch_on_connect(struct impl *impl, const char *ar const char *str; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_switch_on_connect_info)); if (!props) { res = -EINVAL; @@ -309,7 +314,7 @@ struct module *create_module_switch_on_connect(struct impl *impl, const char *ar if (d->only_from_unavailable) { /* XXX: not implemented */ - pw_log_warn(NAME": only_from_unavailable is not implemented"); + pw_log_warn("only_from_unavailable is not implemented"); } return module; diff --git a/src/modules/module-protocol-pulse/modules/module-tunnel-sink.c b/src/modules/module-protocol-pulse/modules/module-tunnel-sink.c index 73a9cb5f5..a07fdd203 100644 --- a/src/modules/module-protocol-pulse/modules/module-tunnel-sink.c +++ b/src/modules/module-protocol-pulse/modules/module-tunnel-sink.c @@ -34,6 +34,11 @@ #include "../module.h" #include "registry.h" +#define NAME "tunnel-sink" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + struct module_tunnel_sink_data { struct module *module; @@ -150,6 +155,8 @@ struct module *create_module_tunnel_sink(struct impl *impl, const char *argument struct spa_audio_info_raw info = { 0 }; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_tunnel_sink_info)); stream_props = pw_properties_new(NULL, NULL); if (props == NULL || stream_props == NULL) { diff --git a/src/modules/module-protocol-pulse/modules/module-tunnel-source.c b/src/modules/module-protocol-pulse/modules/module-tunnel-source.c index 7b4fe45b6..1acd88cef 100644 --- a/src/modules/module-protocol-pulse/modules/module-tunnel-source.c +++ b/src/modules/module-protocol-pulse/modules/module-tunnel-source.c @@ -34,6 +34,11 @@ #include "../module.h" #include "registry.h" +#define NAME "tunnel-source" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + struct module_tunnel_source_data { struct module *module; @@ -150,6 +155,8 @@ struct module *create_module_tunnel_source(struct impl *impl, const char *argume struct spa_audio_info_raw info = { 0 }; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_tunnel_source_info)); stream_props = pw_properties_new(NULL, NULL); if (props == NULL || stream_props == NULL) { diff --git a/src/modules/module-protocol-pulse/modules/module-zeroconf-discover.c b/src/modules/module-protocol-pulse/modules/module-zeroconf-discover.c index cb5e91062..4d75cde68 100644 --- a/src/modules/module-protocol-pulse/modules/module-zeroconf-discover.c +++ b/src/modules/module-protocol-pulse/modules/module-zeroconf-discover.c @@ -30,6 +30,12 @@ #include "../module.h" #include "registry.h" +#define NAME "zeroconf-discover" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + + struct module_zeroconf_discover_data { struct module *module; @@ -100,6 +106,8 @@ struct module *create_module_zeroconf_discover(struct impl *impl, const char *ar struct pw_properties *props = NULL; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_zeroconf_discover_info)); if (props == NULL) { res = -errno; diff --git a/src/modules/module-protocol-pulse/modules/module-zeroconf-publish.c b/src/modules/module-protocol-pulse/modules/module-zeroconf-publish.c index f850bef77..3c0a01c07 100644 --- a/src/modules/module-protocol-pulse/modules/module-zeroconf-publish.c +++ b/src/modules/module-protocol-pulse/modules/module-zeroconf-publish.c @@ -41,6 +41,11 @@ #include #include +#define NAME "zeroconf-publish" + +PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); +#define PW_LOG_TOPIC_DEFAULT mod_topic + #define SERVICE_TYPE_SINK "_pulse-sink._tcp" #define SERVICE_TYPE_SOURCE "_pulse-source._tcp" #define SERVICE_TYPE_SERVER "_pulse-server._tcp" @@ -636,6 +641,8 @@ struct module *create_module_zeroconf_publish(struct impl *impl, const char *arg const char *port; int res; + PW_LOG_TOPIC_INIT(mod_topic); + props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_zeroconf_publish_info)); if (!props) { res = -errno; diff --git a/src/modules/module-protocol-pulse/operation.c b/src/modules/module-protocol-pulse/operation.c index bf98a5e13..8608a4e72 100644 --- a/src/modules/module-protocol-pulse/operation.c +++ b/src/modules/module-protocol-pulse/operation.c @@ -28,6 +28,7 @@ #include #include "client.h" +#include "log.h" #include "manager.h" #include "operation.h" #include "reply.h" diff --git a/src/modules/module-protocol-pulse/pending-sample.c b/src/modules/module-protocol-pulse/pending-sample.c index 2f6b3f165..17e77c1cb 100644 --- a/src/modules/module-protocol-pulse/pending-sample.c +++ b/src/modules/module-protocol-pulse/pending-sample.c @@ -28,6 +28,7 @@ #include "client.h" #include "internal.h" +#include "log.h" #include "pending-sample.h" #include "sample-play.h" diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index eda21b576..f54c4f2a7 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -35,6 +35,7 @@ #include +#include "log.h" #define spa_debug pw_log_debug #include @@ -149,7 +150,7 @@ static int do_command_auth(struct client *client, uint32_t command, uint32_t tag client->version = version; - pw_log_info(NAME" %p: client:%p AUTH tag:%u version:%d", impl, client, tag, version); + pw_log_info("%p: client:%p AUTH tag:%u version:%d", impl, client, tag, version); reply = reply_new(client, tag); message_put(reply, @@ -171,7 +172,7 @@ static int reply_set_client_name(struct client *client, uint32_t tag) id = pw_proxy_get_bound_id((struct pw_proxy*)c); - pw_log_info(NAME" %p: [%s] reply tag:%u id:%u", client, client->name, tag, id); + pw_log_info("%p: [%s] reply tag:%u id:%u", client, client->name, tag, id); reply = reply_new(client, tag); @@ -188,7 +189,7 @@ static void manager_sync(void *data) struct client *client = data; struct operation *o; - pw_log_debug(NAME" %p: manager sync", client); + pw_log_debug("%p: manager sync", client); if (client->connect_tag != SPA_ID_INVALID) { reply_set_client_name(client, client->connect_tag); @@ -416,7 +417,7 @@ static void fix_playback_buffer_attr(struct stream *s, struct buffer_attr *attr) s->missing = attr->tlength; attr->fragsize = 0; - pw_log_info(NAME" %p: [%s] maxlength:%u tlength:%u minreq:%u prebuf:%u", s, + pw_log_info("%p: [%s] maxlength:%u tlength:%u minreq:%u prebuf:%u", s, s->client->name, attr->maxlength, attr->tlength, attr->minreq, attr->prebuf); } @@ -480,7 +481,7 @@ static int reply_create_playback_stream(struct stream *stream, struct pw_manager missing = stream_pop_missing(stream); - pw_log_info(NAME" %p: [%s] reply CREATE_PLAYBACK_STREAM tag:%u missing:%u latency:%s", + pw_log_info("%p: [%s] reply CREATE_PLAYBACK_STREAM tag:%u missing:%u latency:%s", stream, client->name, stream->create_tag, missing, latency); reply = reply_new(client, stream->create_tag); @@ -559,7 +560,7 @@ static void fix_record_buffer_attr(struct stream *s, struct buffer_attr *attr) attr->tlength = attr->minreq = attr->prebuf = 0; - pw_log_info(NAME" %p: [%s] maxlength:%u fragsize:%u minfrag:%u", s, + pw_log_info("%p: [%s] maxlength:%u fragsize:%u minfrag:%u", s, s->client->name, attr->maxlength, attr->fragsize, minfrag); } @@ -612,7 +613,7 @@ static int reply_create_record_stream(struct stream *stream, struct pw_manager_o pw_stream_update_properties(stream->stream, &SPA_DICT_INIT(items, 3)); - pw_log_info(NAME" %p: [%s] reply CREATE_RECORD_STREAM tag:%u latency:%s", + pw_log_info("%p: [%s] reply CREATE_RECORD_STREAM tag:%u latency:%s", stream, client->name, stream->create_tag, latency); reply = reply_new(client, stream->create_tag); @@ -851,7 +852,7 @@ static int do_set_client_name(struct client *client, uint32_t command, uint32_t } client->name = pw_properties_get(client->props, PW_KEY_APP_NAME); - pw_log_info(NAME" %p: [%s] %s tag:%d", impl, client->name, + pw_log_info("%p: [%s] %s tag:%d", impl, client->name, commands[command].name, tag); if (client->core == NULL) { @@ -881,7 +882,7 @@ static int do_set_client_name(struct client *client, uint32_t command, uint32_t return res; error: - pw_log_error(NAME" %p: failed to connect client: %s", impl, spa_strerror(res)); + pw_log_error("%p: failed to connect client: %s", impl, spa_strerror(res)); return res; } @@ -896,7 +897,7 @@ static int do_subscribe(struct client *client, uint32_t command, uint32_t tag, s TAG_INVALID) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] SUBSCRIBE tag:%u mask:%08x", impl, + pw_log_info("%p: [%s] SUBSCRIBE tag:%u mask:%08x", impl, client->name, tag, mask); client->subscribed = mask; @@ -1010,7 +1011,7 @@ static void stream_param_changed(void *data, uint32_t id, const struct spa_pod * return; } - pw_log_debug(NAME" %p: got rate:%u channels:%u", stream, stream->ss.rate, stream->ss.channels); + pw_log_debug("%p: got rate:%u channels:%u", stream, stream->ss.rate, stream->ss.channels); stream->frame_size = sample_spec_frame_size(&stream->ss); if (stream->frame_size == 0) { @@ -1115,7 +1116,7 @@ do_process_done(struct spa_loop *loop, avail = spa_ringbuffer_get_read_index(&stream->ring, &index); if (!spa_list_is_empty(&client->out_messages)) { - pw_log_debug(NAME" %p: [%s] pending read:%u avail:%d", + pw_log_debug("%p: [%s] pending read:%u avail:%d", stream, client->name, index, avail); return 0; } @@ -1123,13 +1124,13 @@ do_process_done(struct spa_loop *loop, if (avail <= 0) { /* underrun, can't really happen but if it does we * do nothing and wait for more data */ - pw_log_warn(NAME" %p: [%s] underrun read:%u avail:%d", + pw_log_warn("%p: [%s] underrun read:%u avail:%d", stream, client->name, index, avail); } else { if (avail > (int32_t)stream->attr.maxlength) { uint32_t skip = avail - stream->attr.fragsize; /* overrun, catch up to latest fragment and send it */ - pw_log_warn(NAME" %p: [%s] overrun recover read:%u avail:%d max:%u skip:%u", + pw_log_warn("%p: [%s] overrun recover read:%u avail:%d max:%u skip:%u", stream, client->name, index, avail, stream->attr.maxlength, skip); index += skip; stream->read_index += skip; @@ -1174,7 +1175,7 @@ static void stream_process(void *data) uint32_t size, minreq = 0, index; struct process_data pd; - pw_log_trace_fp(NAME" %p: process", stream); + pw_log_trace_fp("%p: process", stream); buffer = pw_stream_dequeue_buffer(stream->stream); if (buffer == NULL) @@ -1218,7 +1219,7 @@ static void stream_process(void *data) uint32_t skip = avail - stream->attr.maxlength; /* overrun, reported by other side, here we skip * ahead to the oldest data. */ - pw_log_debug(NAME" %p: [%s] overrun read:%u avail:%d max:%u skip:%u", + pw_log_debug("%p: [%s] overrun read:%u avail:%d max:%u skip:%u", stream, client->name, index, avail, stream->attr.maxlength, skip); index += skip; @@ -1251,13 +1252,13 @@ static void stream_process(void *data) if (filled < 0) { /* underrun, can't really happen because we never read more * than what's available on the other side */ - pw_log_warn(NAME" %p: [%s] underrun write:%u filled:%d", + pw_log_warn("%p: [%s] underrun write:%u filled:%d", stream, client->name, index, filled); } else if ((uint32_t)filled + size > stream->attr.maxlength) { /* overrun, can happen when the other side is not * reading fast enough. We still write our data into the * ringbuffer and expect the other side to warn and catch up. */ - pw_log_debug(NAME" %p: [%s] overrun write:%u filled:%d size:%u max:%u", + pw_log_debug("%p: [%s] overrun write:%u filled:%d size:%u max:%u", stream, client->name, index, filled, size, stream->attr.maxlength); } @@ -1283,7 +1284,7 @@ static void stream_process(void *data) static void stream_drained(void *data) { struct stream *stream = data; - pw_log_info(NAME" %p: [%s] drained channel:%u", stream, + pw_log_info("%p: [%s] drained channel:%u", stream, stream->client->name, stream->channel); reply_simple_ack(stream->client, stream->drain_tag); stream->drain_tag = 0; @@ -1303,10 +1304,10 @@ static const struct pw_stream_events stream_events = static void log_format_info(struct impl *impl, enum spa_log_level level, struct format_info *format) { const struct spa_dict_item *it; - pw_log(level, NAME" %p: format %s", + pw_logt(level, mod_topic, "%p: format %s", impl, format_encoding2name(format->encoding)); spa_dict_for_each(it, &format->props->dict) - pw_log(level, NAME" %p: '%s': '%s'", + pw_logt(level, mod_topic, "%p: '%s': '%s'", impl, it->key, it->value); } @@ -1373,7 +1374,7 @@ static int do_create_playback_stream(struct client *client, uint32_t command, ui TAG_INVALID) < 0) goto error_protocol; - pw_log_info(NAME" %p: [%s] CREATE_PLAYBACK_STREAM tag:%u corked:%u sink-name:%s sink-idx:%u", + pw_log_info("%p: [%s] CREATE_PLAYBACK_STREAM tag:%u corked:%u sink-name:%s sink-idx:%u", impl, client->name, tag, corked, sink_name, sink_index); if (sink_index != SPA_ID_INVALID && sink_name != NULL) @@ -1465,7 +1466,7 @@ static int do_create_playback_stream(struct client *client, uint32_t command, ui n_params++; n_valid_formats++; } else { - pw_log_warn(NAME" %p: unsupported format:%s rate:%d channels:%u", + pw_log_warn("%p: unsupported format:%s rate:%d channels:%u", impl, format_id2name(ss.format), ss.rate, ss.channels); } @@ -1525,7 +1526,7 @@ static int do_create_playback_stream(struct client *client, uint32_t command, ui if (stream->stream == NULL) goto error_errno; - pw_log_debug(NAME" %p: new stream %p channel:%d passthrough:%d", + pw_log_debug("%p: new stream %p channel:%d passthrough:%d", impl, stream, stream->channel, passthrough); pw_stream_add_listener(stream->stream, @@ -1623,7 +1624,7 @@ static int do_create_record_stream(struct client *client, uint32_t command, uint TAG_INVALID) < 0) goto error_protocol; - pw_log_info(NAME" %p: [%s] CREATE_RECORD_STREAM tag:%u corked:%u source-name:%s source-index:%u", + pw_log_info("%p: [%s] CREATE_RECORD_STREAM tag:%u corked:%u source-name:%s source-index:%u", impl, client->name, tag, corked, source_name, source_index); if (source_index != SPA_ID_INVALID && source_name != NULL) @@ -1712,7 +1713,7 @@ static int do_create_record_stream(struct client *client, uint32_t command, uint n_params++; n_valid_formats++; } else { - pw_log_warn(NAME" %p: unsupported format:%s rate:%d channels:%u", + pw_log_warn("%p: unsupported format:%s rate:%d channels:%u", impl, format_id2name(ss.format), ss.rate, ss.channels); } @@ -1835,7 +1836,7 @@ static int do_delete_stream(struct client *client, uint32_t command, uint32_t ta TAG_INVALID)) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] DELETE_STREAM tag:%u channel:%u", impl, + pw_log_info("%p: [%s] DELETE_STREAM tag:%u channel:%u", impl, client->name, tag, channel); stream = pw_map_lookup(&client->streams, channel); @@ -1871,7 +1872,7 @@ static int do_get_playback_latency(struct client *client, uint32_t command, uint TAG_INVALID)) < 0) return -EPROTO; - pw_log_debug(NAME" %p: %s tag:%u channel:%u", impl, commands[command].name, tag, channel); + pw_log_debug("%p: %s tag:%u channel:%u", impl, commands[command].name, tag, channel); stream = pw_map_lookup(&client->streams, channel); if (stream == NULL || stream->type != STREAM_TYPE_PLAYBACK) return -ENOENT; @@ -1920,7 +1921,7 @@ static int do_get_record_latency(struct client *client, uint32_t command, uint32 TAG_INVALID)) < 0) return -EPROTO; - pw_log_debug(NAME" %p: %s channel:%u", impl, commands[command].name, channel); + pw_log_debug("%p: %s channel:%u", impl, commands[command].name, channel); stream = pw_map_lookup(&client->streams, channel); if (stream == NULL || stream->type != STREAM_TYPE_RECORD) return -ENOENT; @@ -1986,7 +1987,7 @@ static int do_create_upload_stream(struct client *client, uint32_t command, uint if (length >= SCACHE_ENTRY_SIZE_MAX) goto error_toolarge; - pw_log_info(NAME" %p: [%s] %s tag:%u name:%s length:%d", + pw_log_info("%p: [%s] %s tag:%u name:%s length:%d", impl, client->name, commands[command].name, tag, name, length); @@ -2066,7 +2067,7 @@ static int do_finish_upload_stream(struct client *client, uint32_t command, uint if (name == NULL) goto error_invalid; - pw_log_info(NAME" %p: [%s] %s tag:%u channel:%u name:%s", + pw_log_info("%p: [%s] %s tag:%u channel:%u name:%s", impl, client->name, commands[command].name, tag, channel, name); @@ -2220,7 +2221,7 @@ static void sample_play_ready(void *data, uint32_t index) struct impl *impl = client->impl; struct message *reply; - pw_log_info(NAME" %p: [%s] PLAY_SAMPLE tag:%u index:%u", + pw_log_info("%p: [%s] PLAY_SAMPLE tag:%u index:%u", impl, client->name, ps->tag, index); reply = reply_new(client, ps->tag); @@ -2250,7 +2251,7 @@ static void sample_play_done(void *data, int res) if (res < 0) reply_error(client, COMMAND_PLAY_SAMPLE, ps->tag, res); else - pw_log_info(NAME" %p: PLAY_SAMPLE done tag:%u", client, ps->tag); + pw_log_info("%p: PLAY_SAMPLE done tag:%u", client, ps->tag); ps->done = true; pw_work_queue_add(impl->work_queue, ps, 0, @@ -2293,7 +2294,7 @@ static int do_play_sample(struct client *client, uint32_t command, uint32_t tag, goto error_proto; } - pw_log_info(NAME" %p: [%s] %s tag:%u sink_index:%u sink_name:%s name:%s", + pw_log_info("%p: [%s] %s tag:%u sink_index:%u sink_name:%s name:%s", impl, client->name, commands[command].name, tag, sink_index, sink_name, name); @@ -2356,7 +2357,7 @@ static int do_remove_sample(struct client *client, uint32_t command, uint32_t ta TAG_INVALID)) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u name:%s", + pw_log_info("%p: [%s] %s tag:%u name:%s", impl, client->name, commands[command].name, tag, name); if (name == NULL) @@ -2389,7 +2390,7 @@ static int do_cork_stream(struct client *client, uint32_t command, uint32_t tag, TAG_INVALID)) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u channel:%u cork:%s", + pw_log_info("%p: [%s] %s tag:%u channel:%u cork:%s", impl, client->name, commands[command].name, tag, channel, cork ? "yes" : "no"); @@ -2421,7 +2422,7 @@ static int do_flush_trigger_prebuf_stream(struct client *client, uint32_t comman TAG_INVALID)) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u channel:%u", + pw_log_info("%p: [%s] %s tag:%u channel:%u", impl, client->name, commands[command].name, tag, channel); stream = pw_map_lookup(&client->streams, channel); @@ -2566,7 +2567,7 @@ static int do_set_stream_volume(struct client *client, uint32_t command, uint32_ TAG_INVALID)) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u index:%u", impl, + pw_log_info("%p: [%s] %s tag:%u index:%u", impl, client->name, commands[command].name, tag, id); stream = find_stream(client, id); @@ -2615,7 +2616,7 @@ static int do_set_stream_mute(struct client *client, uint32_t command, uint32_t TAG_INVALID)) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] DO_SET_STREAM_MUTE tag:%u id:%u mute:%u", + pw_log_info("%p: [%s] DO_SET_STREAM_MUTE tag:%u id:%u mute:%u", impl, client->name, tag, id, mute); stream = find_stream(client, id); @@ -2672,7 +2673,7 @@ static int do_set_volume(struct client *client, uint32_t command, uint32_t tag, TAG_INVALID)) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u index:%u name:%s", impl, + pw_log_info("%p: [%s] %s tag:%u index:%u name:%s", impl, client->name, commands[command].name, tag, id, name); if ((id == SPA_ID_INVALID && name == NULL) || @@ -2738,7 +2739,7 @@ static int do_set_mute(struct client *client, uint32_t command, uint32_t tag, st TAG_INVALID)) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u index:%u name:%s mute:%d", impl, + pw_log_info("%p: [%s] %s tag:%u index:%u name:%s mute:%d", impl, client->name, commands[command].name, tag, id, name, mute); if ((id == SPA_ID_INVALID && name == NULL) || @@ -2801,7 +2802,7 @@ static int do_set_port(struct client *client, uint32_t command, uint32_t tag, st TAG_INVALID)) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u index:%u name:%s port:%s", impl, + pw_log_info("%p: [%s] %s tag:%u index:%u name:%s port:%s", impl, client->name, commands[command].name, tag, id, name, port_name); if ((id == SPA_ID_INVALID && name == NULL) || @@ -2865,7 +2866,7 @@ static int do_set_port_latency_offset(struct client *client, uint32_t command, u TAG_INVALID)) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u index:%u card_name:%s port_name:%s offset:%"PRIi64, impl, + pw_log_info("%p: [%s] %s tag:%u index:%u card_name:%s port_name:%s offset:%"PRIi64, impl, client->name, commands[command].name, tag, sel.id, sel.value, port_name, offset); if ((sel.id == SPA_ID_INVALID && sel.value == NULL) || @@ -2927,7 +2928,7 @@ static int do_set_stream_name(struct client *client, uint32_t command, uint32_t if (name == NULL) return -EINVAL; - pw_log_info(NAME" %p: [%s] SET_STREAM_NAME tag:%u channel:%d name:%s", + pw_log_info("%p: [%s] SET_STREAM_NAME tag:%u channel:%d name:%s", impl, client->name, tag, channel, name); stream = pw_map_lookup(&client->streams, channel); @@ -2962,7 +2963,7 @@ static int do_update_proplist(struct client *client, uint32_t command, uint32_t channel = SPA_ID_INVALID; } - pw_log_info(NAME" %p: [%s] %s tag:%u channel:%d", impl, + pw_log_info("%p: [%s] %s tag:%u channel:%d", impl, client->name, commands[command].name, tag, channel); if (message_get(m, @@ -3019,7 +3020,7 @@ static int do_remove_proplist(struct client *client, uint32_t command, uint32_t channel = SPA_ID_INVALID; } - pw_log_info(NAME" %p: [%s] %s tag:%u channel:%d", impl, + pw_log_info("%p: [%s] %s tag:%u channel:%d", impl, client->name, commands[command].name, tag, channel); while (true) { @@ -3072,7 +3073,7 @@ static int do_get_server_info(struct client *client, uint32_t command, uint32_t char name[256]; struct message *reply; - pw_log_info(NAME" %p: [%s] GET_SERVER_INFO tag:%u", impl, client->name, tag); + pw_log_info("%p: [%s] GET_SERVER_INFO tag:%u", impl, client->name, tag); snprintf(name, sizeof(name), "PulseAudio (on PipeWire %s)", pw_get_library_version()); @@ -3102,7 +3103,7 @@ static int do_stat(struct client *client, uint32_t command, uint32_t tag, struct struct impl *impl = client->impl; struct message *reply; - pw_log_info(NAME" %p: [%s] STAT tag:%u", impl, client->name, tag); + pw_log_info("%p: [%s] STAT tag:%u", impl, client->name, tag); reply = reply_new(client, tag); message_put(reply, @@ -3130,7 +3131,7 @@ static int do_lookup(struct client *client, uint32_t command, uint32_t tag, stru TAG_INVALID) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] LOOKUP tag:%u name:'%s'", impl, client->name, tag, name); + pw_log_info("%p: [%s] LOOKUP tag:%u name:'%s'", impl, client->name, tag, name); if ((o = find_device(client, SPA_ID_INVALID, name, is_sink, &is_monitor)) == NULL) return -ENOENT; @@ -3154,7 +3155,7 @@ static int do_drain_stream(struct client *client, uint32_t command, uint32_t tag TAG_INVALID) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] DRAIN tag:%u channel:%d", impl, client->name, tag, channel); + pw_log_info("%p: [%s] DRAIN tag:%u channel:%d", impl, client->name, tag, channel); stream = pw_map_lookup(&client->streams, channel); if (stream == NULL || stream->type != STREAM_TYPE_PLAYBACK) return -ENOENT; @@ -3381,7 +3382,7 @@ static int fill_card_info(struct client *client, struct message *m, pi_n_profiles = SPA_MIN(pi->n_profiles, n_profiles); if (pi->n_profiles != pi_n_profiles) { /* libpulse assumes port profile array size <= n_profiles */ - pw_log_error(NAME" %p: card %d port %d profiles inconsistent (%d < %d)", + pw_log_error("%p: card %d port %d profiles inconsistent (%d < %d)", client->impl, o->id, n, n_profiles, pi->n_profiles); } @@ -3983,7 +3984,7 @@ static int do_get_info(struct client *client, uint32_t command, uint32_t tag, st if (sel.id != SPA_ID_INVALID && sel.value != NULL) goto error_invalid; - pw_log_info(NAME" %p: [%s] %s tag:%u idx:%u name:%s", impl, client->name, + pw_log_info("%p: [%s] %s tag:%u idx:%u name:%s", impl, client->name, commands[command].name, tag, sel.id, sel.value); if (command == COMMAND_GET_SINK_INFO || command == COMMAND_GET_SOURCE_INFO) { @@ -4082,7 +4083,7 @@ static int do_get_sample_info(struct client *client, uint32_t command, uint32_t (id != SPA_ID_INVALID && name != NULL)) return -EINVAL; - pw_log_info(NAME" %p: [%s] %s tag:%u idx:%u name:%s", impl, client->name, + pw_log_info("%p: [%s] %s tag:%u idx:%u name:%s", impl, client->name, commands[command].name, tag, id, name); if ((sample = find_sample(impl, id, name)) == NULL) @@ -4106,7 +4107,7 @@ static int do_get_sample_info_list(struct client *client, uint32_t command, uint struct message *reply; union pw_map_item *item; - pw_log_info(NAME" %p: [%s] %s tag:%u", impl, client->name, + pw_log_info("%p: [%s] %s tag:%u", impl, client->name, commands[command].name, tag); reply = reply_new(client, tag); @@ -4146,7 +4147,7 @@ static int do_get_info_list(struct client *client, uint32_t command, uint32_t ta struct pw_manager *manager = client->manager; struct info_list_data info; - pw_log_info(NAME" %p: [%s] %s tag:%u", impl, client->name, + pw_log_info("%p: [%s] %s tag:%u", impl, client->name, commands[command].name, tag); spa_zero(info); @@ -4202,7 +4203,7 @@ static int do_set_stream_buffer_attr(struct client *client, uint32_t command, ui TAG_INVALID) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u channel:%u", impl, client->name, + pw_log_info("%p: [%s] %s tag:%u channel:%u", impl, client->name, commands[command].name, tag, channel); stream = pw_map_lookup(&client->streams, channel); @@ -4284,7 +4285,7 @@ static int do_update_stream_sample_rate(struct client *client, uint32_t command, TAG_INVALID) < 0) return -EPROTO; - pw_log_warn(NAME" %p: [%s] %s tag:%u channel:%u rate:%u", impl, client->name, + pw_log_warn("%p: [%s] %s tag:%u channel:%u rate:%u", impl, client->name, commands[command].name, tag, channel, rate); stream = pw_map_lookup(&client->streams, channel); @@ -4317,7 +4318,7 @@ static int do_extension(struct client *client, uint32_t command, uint32_t tag, s TAG_INVALID) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u id:%u name:%s", impl, client->name, + pw_log_info("%p: [%s] %s tag:%u id:%u name:%s", impl, client->name, commands[command].name, tag, idx, name); if ((idx == SPA_ID_INVALID && name == NULL) || @@ -4353,7 +4354,7 @@ static int do_set_profile(struct client *client, uint32_t command, uint32_t tag, TAG_INVALID) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u id:%u name:%s profile:%s", impl, client->name, + pw_log_info("%p: [%s] %s tag:%u id:%u name:%s profile:%s", impl, client->name, commands[command].name, tag, sel.id, sel.value, profile_name); if ((sel.id == SPA_ID_INVALID && sel.value == NULL) || @@ -4398,7 +4399,7 @@ static int do_set_default(struct client *client, uint32_t command, uint32_t tag, TAG_INVALID) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u name:%s", impl, client->name, + pw_log_info("%p: [%s] %s tag:%u name:%s", impl, client->name, commands[command].name, tag, name); if (name != NULL && (o = find_device(client, SPA_ID_INVALID, name, sink, NULL)) == NULL) @@ -4441,7 +4442,7 @@ static int do_suspend(struct client *client, uint32_t command, uint32_t tag, str TAG_INVALID) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u id:%u name:%s", impl, client->name, + pw_log_info("%p: [%s] %s tag:%u id:%u name:%s", impl, client->name, commands[command].name, tag, id, name); if ((o = find_device(client, id, name, sink, NULL)) == NULL) @@ -4480,7 +4481,7 @@ static int do_move_stream(struct client *client, uint32_t command, uint32_t tag, (id_device != SPA_ID_INVALID && name_device != NULL)) return -EINVAL; - pw_log_info(NAME" %p: [%s] %s tag:%u idx:%u device:%d name:%s", impl, client->name, + pw_log_info("%p: [%s] %s tag:%u idx:%u device:%d name:%s", impl, client->name, commands[command].name, tag, id, id_device, name_device); spa_zero(sel); @@ -4528,7 +4529,7 @@ static int do_kill(struct client *client, uint32_t command, uint32_t tag, struct TAG_INVALID) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u id:%u", impl, client->name, + pw_log_info("%p: [%s] %s tag:%u id:%u", impl, client->name, commands[command].name, tag, id); spa_zero(sel); @@ -4576,7 +4577,7 @@ static void on_module_loaded(void *data, int result) if (SPA_RESULT_IS_OK(result)) { struct message *reply; - pw_log_info(NAME" %p: [%s] loaded module id:%u name:%s", + pw_log_info("%p: [%s] loaded module id:%u name:%s", impl, client->name, module->idx, module->name); @@ -4594,7 +4595,7 @@ static void on_module_loaded(void *data, int result) client_queue_message(client, reply); } else { - pw_log_warn(NAME" %p: [%s] failed to load module id:%u name:%s result:%d (%s)", + pw_log_warn("%p: [%s] failed to load module id:%u name:%s result:%d (%s)", impl, client->name, module->idx, module->name, result, spa_strerror(result)); @@ -4625,7 +4626,7 @@ static int do_load_module(struct client *client, uint32_t command, uint32_t tag, TAG_INVALID) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s name:%s argument:%s", impl, + pw_log_info("%p: [%s] %s name:%s argument:%s", impl, client->name, commands[command].name, name, argument); module = module_create(client, name, argument); @@ -4666,7 +4667,7 @@ static int do_unload_module(struct client *client, uint32_t command, uint32_t ta TAG_INVALID) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u id:%u", impl, client->name, + pw_log_info("%p: [%s] %s tag:%u id:%u", impl, client->name, commands[command].name, tag, module_idx); if (module_idx == SPA_ID_INVALID) @@ -4704,7 +4705,7 @@ static int do_send_object_message(struct client *client, uint32_t command, uint3 TAG_INVALID) < 0) return -EPROTO; - pw_log_info(NAME" %p: [%s] %s tag:%u object_path:'%s' message:'%s' params:'%s'", impl, + pw_log_info("%p: [%s] %s tag:%u object_path:'%s' message:'%s' params:'%s'", impl, client->name, commands[command].name, tag, object_path, message, params ? params : ""); @@ -4734,7 +4735,7 @@ static int do_send_object_message(struct client *client, uint32_t command, uint3 if (res < 0) return res; - pw_log_debug(NAME" %p: object message response:'%s'", impl, response ? response : ""); + pw_log_debug("%p: object message response:'%s'", impl, response ? response : ""); reply = reply_new(client, tag); message_put(reply, TAG_STRING, response, TAG_INVALID); @@ -4981,7 +4982,7 @@ static int parse_frac(struct pw_properties *props, const char *key, const char * str = def; if (sscanf(str, "%u/%u", &res->num, &res->denom) != 2 || res->denom == 0) return -EINVAL; - pw_log_info(NAME": defaults: %s = %u/%u", key, res->num, res->denom); + pw_log_info(": defaults: %s = %u/%u", key, res->num, res->denom); return 0; } @@ -5005,7 +5006,7 @@ static int parse_position(struct pw_properties *props, const char *key, const ch res->channels < SPA_AUDIO_MAX_CHANNELS) { res->map[res->channels++] = channel_name2id(v); } - pw_log_info(NAME": defaults: %s = %s", key, str); + pw_log_info(": defaults: %s = %s", key, str); return 0; } static int parse_format(struct pw_properties *props, const char *key, const char *def, @@ -5017,10 +5018,10 @@ static int parse_format(struct pw_properties *props, const char *key, const char str = def; res->format = format_name2id(str); if (res->format == SPA_AUDIO_FORMAT_UNKNOWN) { - pw_log_warn(NAME": unknown format %s, default to %s", str, def); + pw_log_warn(": unknown format %s, default to %s", str, def); res->format = format_name2id(def); } - pw_log_info(NAME": defaults: %s = %s", key, str); + pw_log_info(": defaults: %s = %s", key, str); return 0; } @@ -5098,13 +5099,13 @@ struct pw_protocol_pulse *pw_protocol_pulse_new(struct pw_context *context, goto error_free; if ((res = servers_create_and_start(impl, str, NULL)) < 0) { - pw_log_error(NAME" %p: no servers could be started: %s", + pw_log_error("%p: no servers could be started: %s", impl, spa_strerror(res)); goto error_free; } if ((res = create_pid_file()) < 0) { - pw_log_warn(NAME" %p: can't create pid file: %s", + pw_log_warn("%p: can't create pid file: %s", impl, spa_strerror(res)); } pw_context_add_listener(context, &impl->context_listener, diff --git a/src/modules/module-protocol-pulse/quirks.c b/src/modules/module-protocol-pulse/quirks.c index f607fe03a..feff7c3aa 100644 --- a/src/modules/module-protocol-pulse/quirks.c +++ b/src/modules/module-protocol-pulse/quirks.c @@ -28,6 +28,7 @@ #include +#include "log.h" #include "quirks.h" #define QUOTE(...) #__VA_ARGS__ diff --git a/src/modules/module-protocol-pulse/reply.c b/src/modules/module-protocol-pulse/reply.c index 173390454..9444e5b1c 100644 --- a/src/modules/module-protocol-pulse/reply.c +++ b/src/modules/module-protocol-pulse/reply.c @@ -31,6 +31,7 @@ #include "client.h" #include "commands.h" #include "message.h" +#include "log.h" struct message *reply_new(const struct client *client, uint32_t tag) { diff --git a/src/modules/module-protocol-pulse/sample-play.c b/src/modules/module-protocol-pulse/sample-play.c index ea39195e1..cc5a95011 100644 --- a/src/modules/module-protocol-pulse/sample-play.c +++ b/src/modules/module-protocol-pulse/sample-play.c @@ -38,6 +38,7 @@ #include #include "format.h" +#include "log.h" #include "sample.h" #include "sample-play.h" diff --git a/src/modules/module-protocol-pulse/sample.c b/src/modules/module-protocol-pulse/sample.c index f4575e546..a2d8de91d 100644 --- a/src/modules/module-protocol-pulse/sample.c +++ b/src/modules/module-protocol-pulse/sample.c @@ -29,6 +29,7 @@ #include #include "internal.h" +#include "log.h" #include "sample.h" void sample_free(struct sample *sample) diff --git a/src/modules/module-protocol-pulse/server.c b/src/modules/module-protocol-pulse/server.c index 2315532b5..4bee4e8f8 100644 --- a/src/modules/module-protocol-pulse/server.c +++ b/src/modules/module-protocol-pulse/server.c @@ -54,6 +54,7 @@ #include "commands.h" #include "defs.h" #include "internal.h" +#include "log.h" #include "message.h" #include "reply.h" #include "server.h" diff --git a/src/modules/module-protocol-pulse/stream.c b/src/modules/module-protocol-pulse/stream.c index f3c9fd977..008b747f8 100644 --- a/src/modules/module-protocol-pulse/stream.c +++ b/src/modules/module-protocol-pulse/stream.c @@ -39,6 +39,7 @@ #include "client.h" #include "commands.h" #include "internal.h" +#include "log.h" #include "message.h" #include "reply.h" #include "stream.h" diff --git a/src/modules/module-protocol-pulse/utils.c b/src/modules/module-protocol-pulse/utils.c index 2ec430b37..eb672acd1 100644 --- a/src/modules/module-protocol-pulse/utils.c +++ b/src/modules/module-protocol-pulse/utils.c @@ -49,6 +49,7 @@ #include #include +#include "log.h" #include "utils.h" int get_runtime_dir(char *buf, size_t buflen, const char *dir) @@ -62,7 +63,7 @@ int get_runtime_dir(char *buf, size_t buflen, const char *dir) runtime_dir = getenv("XDG_RUNTIME_DIR"); if (runtime_dir == NULL) { - pw_log_error(NAME": could not find a suitable runtime directory in" + pw_log_error("could not find a suitable runtime directory in" "$PULSE_RUNTIME_PATH and $XDG_RUNTIME_DIR"); return -ENOENT; } @@ -71,24 +72,24 @@ int get_runtime_dir(char *buf, size_t buflen, const char *dir) if (size < 0) return -errno; if ((size_t) size >= buflen) { - pw_log_error(NAME": path %s/%s too long", runtime_dir, dir); + pw_log_error("path %s/%s too long", runtime_dir, dir); return -ENAMETOOLONG; } if (stat(buf, &stat_buf) < 0) { res = -errno; if (res != -ENOENT) { - pw_log_error(NAME": stat() %s failed: %m", buf); + pw_log_error("stat() %s failed: %m", buf); return res; } if (mkdir(buf, 0700) < 0) { res = -errno; - pw_log_error(NAME": mkdir() %s failed: %m", buf); + pw_log_error("mkdir() %s failed: %m", buf); return res; } - pw_log_info(NAME": created %s", buf); + pw_log_info("created %s", buf); } else if (!S_ISDIR(stat_buf.st_mode)) { - pw_log_error(NAME": %s is not a directory", buf); + pw_log_error("%s is not a directory", buf); return -ENOTDIR; } return 0; @@ -117,7 +118,7 @@ int check_flatpak(struct client *client, pid_t pid) /* Not able to open the root dir shouldn't happen. Probably the app died and * we're failing due to /proc/$pid not existing. In that case fail instead * of treating this as privileged. */ - pw_log_info("failed to open \"%s\": %s", root_path, spa_strerror(res)); + pw_log_info("failed to open \"%s\"%s", root_path, spa_strerror(res)); return res; } info_fd = openat(root_fd, ".flatpak-info", O_RDONLY | O_CLOEXEC | O_NOCTTY); @@ -187,7 +188,7 @@ int create_pid_file(void) { return res; if (strlen(pid_file) > PATH_MAX - sizeof("/pid")) { - pw_log_error(NAME": path too long: %s/pid", pid_file); + pw_log_error("path too long: %s/pid", pid_file); return -ENAMETOOLONG; } @@ -195,7 +196,7 @@ int create_pid_file(void) { if ((f = fopen(pid_file, "w")) == NULL) { res = -errno; - pw_log_error(NAME": failed to open pid file: %m"); + pw_log_error("failed to open pid file: %m"); return res; } diff --git a/src/modules/module-protocol-pulse/volume.c b/src/modules/module-protocol-pulse/volume.c index 94f90eb5f..31f45a597 100644 --- a/src/modules/module-protocol-pulse/volume.c +++ b/src/modules/module-protocol-pulse/volume.c @@ -28,6 +28,7 @@ #include #include +#include "log.h" #include "volume.h" int volume_compare(struct volume *vol, struct volume *other)