modules: add log topics to module-protocol-pulse

This ends up using a nested namespace: mod.protocol-pulse for the module
itself, mod.protocol-pulse.foo for the various submodules and
extensions.
This commit is contained in:
Peter Hutterer 2021-09-22 09:28:54 +10:00 committed by Wim Taymans
parent 96f8a7597e
commit 52a96bb602
41 changed files with 301 additions and 97 deletions

View file

@ -43,6 +43,11 @@
#define NAME "protocol-pulse" #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 #define MODULE_USAGE PW_PROTOCOL_PULSE_USAGE
static const struct spa_dict_item module_props[] = { 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; struct impl *impl;
int res; 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)); impl = calloc(1, sizeof(struct impl));
if (impl == NULL) if (impl == NULL)
return -errno; return -errno;

View file

@ -40,6 +40,7 @@
#include "commands.h" #include "commands.h"
#include "defs.h" #include "defs.h"
#include "internal.h" #include "internal.h"
#include "log.h"
#include "manager.h" #include "manager.h"
#include "message.h" #include "message.h"
#include "operation.h" #include "operation.h"

View file

@ -30,6 +30,7 @@
#include "collect.h" #include "collect.h"
#include "defs.h" #include "defs.h"
#include "log.h"
#include "manager.h" #include "manager.h"
void select_best(struct selector *s, struct pw_manager_object *o) void select_best(struct selector *s, struct pw_manager_object *o)

View file

@ -29,8 +29,8 @@
#include <spa/support/dbus.h> #include <spa/support/dbus.h>
#include <spa/support/plugin.h> #include <spa/support/plugin.h>
#include <pipewire/context.h> #include <pipewire/context.h>
#include <pipewire/log.h>
#include "log.h"
#include "dbus-name.h" #include "dbus-name.h"
void *dbus_request_name(struct pw_context *context, const char *name) void *dbus_request_name(struct pw_context *context, const char *name)

View file

@ -48,6 +48,10 @@
#include "../reply.h" #include "../reply.h"
#include "../volume.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_SINK 0
#define DEVICE_TYPE_SOURCE 1 #define DEVICE_TYPE_SOURCE 1

View file

@ -47,6 +47,10 @@
#include "../reply.h" #include "../reply.h"
#include "../volume.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) static int do_extension_stream_restore_test(struct client *client, uint32_t command, uint32_t tag, struct message *m)
{ {
struct message *reply; struct message *reply;

View file

@ -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 <pipewire/log.h>
PW_LOG_TOPIC_EXTERN(mod_topic);
#define PW_LOG_TOPIC_DEFAULT mod_topic
#endif /* PULSE_LOG_H */

View file

@ -30,6 +30,8 @@
#include <spa/utils/string.h> #include <spa/utils/string.h>
#include <pipewire/extensions/metadata.h> #include <pipewire/extensions/metadata.h>
#include "log.h"
#define MAX_PARAMS 32 #define MAX_PARAMS 32
#define manager_emit_sync(m) spa_hook_list_call(&m->hooks, struct pw_manager_events, sync, 0) #define manager_emit_sync(m) spa_hook_list_call(&m->hooks, struct pw_manager_events, sync, 0)

View file

@ -14,6 +14,7 @@
#include <pipewire/pipewire.h> #include <pipewire/pipewire.h>
#include "collect.h" #include "collect.h"
#include "log.h"
#include "manager.h" #include "manager.h"
#include "message-handler.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]; struct transport_codec_info codecs[64];
uint32_t n_codecs, active; 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); 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) 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")) { if (spa_streq(message, "list-handlers")) {
FILE *r; FILE *r;

View file

@ -34,6 +34,7 @@
#include "defs.h" #include "defs.h"
#include "format.h" #include "format.h"
#include "internal.h" #include "internal.h"
#include "log.h"
#include "media-roles.h" #include "media-roles.h"
#include "message.h" #include "message.h"
#include "volume.h" #include "volume.h"

View file

@ -39,6 +39,7 @@
#include "defs.h" #include "defs.h"
#include "format.h" #include "format.h"
#include "internal.h" #include "internal.h"
#include "log.h"
#include "module.h" #include "module.h"
static void on_module_unload(void *obj, void *data, int res, uint32_t id) static void on_module_unload(void *obj, void *data, int res, uint32_t id)

View file

@ -32,6 +32,11 @@
#include "../module.h" #include "../module.h"
#include "registry.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 */ #define MAX_SINKS 64 /* ... good enough for anyone */
static const struct spa_dict_item module_combine_sink_info[] = { 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 }; struct spa_audio_info_raw info = { 0 };
int i, n, res; int i, n, res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_combine_sink_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_combine_sink_info));
if (!props) { if (!props) {
res = -EINVAL; res = -EINVAL;

View file

@ -33,6 +33,11 @@
#include "../module.h" #include "../module.h"
#include "registry.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_echo_cancel_data {
struct module *module; 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 }; struct spa_audio_info_raw info = { 0 };
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_echo_cancel_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_echo_cancel_info));
aec_props = pw_properties_new(NULL, NULL); aec_props = pw_properties_new(NULL, NULL);
source_props = pw_properties_new(NULL, NULL); source_props = pw_properties_new(NULL, NULL);

View file

@ -32,6 +32,11 @@
#include "../module.h" #include "../module.h"
#include "registry.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_ladspa_sink_data {
struct module *module; 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 }; struct spa_audio_info_raw playback_info = { 0 };
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_ladspa_sink_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_ladspa_sink_info));
capture_props = pw_properties_new(NULL, NULL); capture_props = pw_properties_new(NULL, NULL);
playback_props = pw_properties_new(NULL, NULL); playback_props = pw_properties_new(NULL, NULL);

View file

@ -32,6 +32,11 @@
#include "../module.h" #include "../module.h"
#include "registry.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_ladspa_source_data {
struct module *module; 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 }; struct spa_audio_info_raw playback_info = { 0 };
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_ladspa_source_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_ladspa_source_info));
capture_props = pw_properties_new(NULL, NULL); capture_props = pw_properties_new(NULL, NULL);
playback_props = pw_properties_new(NULL, NULL); playback_props = pw_properties_new(NULL, NULL);

View file

@ -33,6 +33,11 @@
#include "../module.h" #include "../module.h"
#include "registry.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_loopback_data {
struct module *module; 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 }; struct spa_audio_info_raw info = { 0 };
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_loopback_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_loopback_info));
capture_props = pw_properties_new(NULL, NULL); capture_props = pw_properties_new(NULL, NULL);
playback_props = pw_properties_new(NULL, NULL); playback_props = pw_properties_new(NULL, NULL);

View file

@ -29,6 +29,11 @@
#include "../server.h" #include "../server.h"
#include "registry.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_native_protocol_tcp_data {
struct module *module; struct module *module;
struct pw_array servers; struct pw_array servers;
@ -88,6 +93,8 @@ struct module *create_module_native_protocol_tcp(struct impl *impl, const char *
const char *port, *listen; const char *port, *listen;
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_native_protocol_tcp_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_native_protocol_tcp_info));
if (props == NULL) { if (props == NULL) {
res = -errno; res = -errno;

View file

@ -28,6 +28,11 @@
#include "../module.h" #include "../module.h"
#include "registry.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 module_null_sink_data {
struct pw_proxy *proxy; struct pw_proxy *proxy;
struct spa_hook listener; struct spa_hook listener;
@ -137,6 +142,8 @@ struct module *create_module_null_sink(struct impl *impl, const char *argument)
uint32_t i; uint32_t i;
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_null_sink_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_null_sink_info));
if (props == NULL) { if (props == NULL) {
res = -EINVAL; res = -EINVAL;

View file

@ -36,6 +36,11 @@
#include "../module.h" #include "../module.h"
#include "registry.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" #define DEFAULT_FILE_NAME "/tmp/music.output"
struct module_pipesink_data { struct module_pipesink_data {
@ -231,6 +236,8 @@ struct module *create_module_pipe_sink(struct impl *impl, const char *argument)
int res = 0; int res = 0;
int fd = -1; int fd = -1;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_pipesink_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_pipesink_info));
capture_props = pw_properties_new(NULL, NULL); capture_props = pw_properties_new(NULL, NULL);
if (!props || !capture_props) { if (!props || !capture_props) {

View file

@ -36,6 +36,12 @@
#include "../module.h" #include "../module.h"
#include "registry.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" #define DEFAULT_FILE_NAME "/tmp/music.input"
struct module_pipesrc_data { 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 stride, res = 0;
int fd = -1; int fd = -1;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_pipesource_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_pipesource_info));
playback_props = pw_properties_new(NULL, NULL); playback_props = pw_properties_new(NULL, NULL);
if (!props || !playback_props) { if (!props || !playback_props) {

View file

@ -32,6 +32,11 @@
#include "../module.h" #include "../module.h"
#include "registry.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_remap_sink_data {
struct module *module; 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 }; struct spa_audio_info_raw playback_info = { 0 };
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_remap_sink_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_remap_sink_info));
capture_props = pw_properties_new(NULL, NULL); capture_props = pw_properties_new(NULL, NULL);
playback_props = pw_properties_new(NULL, NULL); playback_props = pw_properties_new(NULL, NULL);

View file

@ -32,6 +32,11 @@
#include "../module.h" #include "../module.h"
#include "registry.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_remap_source_data {
struct module *module; 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 }; struct spa_audio_info_raw playback_info = { 0 };
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_remap_source_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_remap_source_info));
capture_props = pw_properties_new(NULL, NULL); capture_props = pw_properties_new(NULL, NULL);
playback_props = pw_properties_new(NULL, NULL); playback_props = pw_properties_new(NULL, NULL);

View file

@ -31,6 +31,11 @@
#include "../module.h" #include "../module.h"
#include "registry.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_IP "0.0.0.0"
#define ROC_DEFAULT_SOURCE_PORT "10001" #define ROC_DEFAULT_SOURCE_PORT "10001"
#define ROC_DEFAULT_REPAIR_PORT "10002" #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; const char *str;
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_roc_sink_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_roc_sink_info));
sink_props = pw_properties_new(NULL, NULL); sink_props = pw_properties_new(NULL, NULL);
roc_props = pw_properties_new(NULL, NULL); roc_props = pw_properties_new(NULL, NULL);

View file

@ -31,6 +31,11 @@
#include "../module.h" #include "../module.h"
#include "registry.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_IP "0.0.0.0"
#define ROC_DEFAULT_SOURCE_PORT "10001" #define ROC_DEFAULT_SOURCE_PORT "10001"
#define ROC_DEFAULT_REPAIR_PORT "10002" #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; const char *str;
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_roc_source_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_roc_source_info));
source_props = pw_properties_new(NULL, NULL); source_props = pw_properties_new(NULL, NULL);
roc_props = pw_properties_new(NULL, NULL); roc_props = pw_properties_new(NULL, NULL);

View file

@ -29,6 +29,11 @@
#include "../module.h" #include "../module.h"
#include "registry.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_simple_protocol_tcp_data {
struct module *module; struct module *module;
struct pw_properties *module_props; 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; const char *str, *port, *listen;
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_simple_protocol_tcp_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_simple_protocol_tcp_info));
if (props == NULL) { if (props == NULL) {
res = -errno; res = -errno;

View file

@ -36,7 +36,10 @@
#include "../manager.h" #include "../manager.h"
#include "../collect.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 */ /* Ignore HDMI by default */
#define DEFAULT_BLOCKLIST "hdmi" #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) if (!card_info || !card_info->props)
return; 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 */ /* If internal device, only consider hdmi sinks */
str = spa_dict_lookup(info->props, "api.alsa.path"); str = spa_dict_lookup(info->props, "api.alsa.path");
bus = spa_dict_lookup(card_info->props, PW_KEY_DEVICE_BUS); bus = spa_dict_lookup(card_info->props, PW_KEY_DEVICE_BUS);
if ((spa_streq(bus, "pci") || spa_streq(bus, "isa")) && if ((spa_streq(bus, "pci") || spa_streq(bus, "isa")) &&
!(pw_manager_object_is_sink(o) && spa_strstartswith(str, "hdmi"))) { !(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; return;
} }
if (d->blocklist && regexec(d->blocklist, name, 0, NULL, 0) == 0) { 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; return;
} }
if (d->ignore_virtual && spa_dict_lookup(info->props, PW_KEY_DEVICE_API) == NULL) { 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; return;
} }
@ -135,13 +138,13 @@ static void manager_added(void *data, struct pw_manager_object *o)
} }
/* Switch default */ /* 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_manager_set_metadata(d->manager, d->metadata_default,
PW_ID_CORE, PW_ID_CORE,
pw_manager_object_is_sink(o) ? METADATA_CONFIG_DEFAULT_SINK pw_manager_object_is_sink(o) ? METADATA_CONFIG_DEFAULT_SINK
: METADATA_CONFIG_DEFAULT_SOURCE, : METADATA_CONFIG_DEFAULT_SOURCE,
"Spa:String:JSON", "{ \"name\": \"%s\" }", name); "Spa:String:JSON", "{ \"name\"\"%s\" }", name);
} }
static void manager_sync(void *data) 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; struct module_switch_on_connect_data *d = data;
if (seq == d->sync_seq) { if (seq == d->sync_seq) {
pw_log_debug(NAME" %p: started", d); pw_log_debug("%p: started", d);
d->started = true; d->started = true;
} }
} }
@ -202,7 +205,7 @@ static int module_switch_on_connect_load(struct client *client, struct module *m
return 0; return 0;
error: 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; return res;
} }
@ -259,6 +262,8 @@ struct module *create_module_switch_on_connect(struct impl *impl, const char *ar
const char *str; const char *str;
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_switch_on_connect_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_switch_on_connect_info));
if (!props) { if (!props) {
res = -EINVAL; res = -EINVAL;
@ -309,7 +314,7 @@ struct module *create_module_switch_on_connect(struct impl *impl, const char *ar
if (d->only_from_unavailable) { if (d->only_from_unavailable) {
/* XXX: not implemented */ /* XXX: not implemented */
pw_log_warn(NAME": only_from_unavailable is not implemented"); pw_log_warn("only_from_unavailable is not implemented");
} }
return module; return module;

View file

@ -34,6 +34,11 @@
#include "../module.h" #include "../module.h"
#include "registry.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_tunnel_sink_data {
struct module *module; 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 }; struct spa_audio_info_raw info = { 0 };
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_tunnel_sink_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_tunnel_sink_info));
stream_props = pw_properties_new(NULL, NULL); stream_props = pw_properties_new(NULL, NULL);
if (props == NULL || stream_props == NULL) { if (props == NULL || stream_props == NULL) {

View file

@ -34,6 +34,11 @@
#include "../module.h" #include "../module.h"
#include "registry.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_tunnel_source_data {
struct module *module; 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 }; struct spa_audio_info_raw info = { 0 };
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_tunnel_source_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_tunnel_source_info));
stream_props = pw_properties_new(NULL, NULL); stream_props = pw_properties_new(NULL, NULL);
if (props == NULL || stream_props == NULL) { if (props == NULL || stream_props == NULL) {

View file

@ -30,6 +30,12 @@
#include "../module.h" #include "../module.h"
#include "registry.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_zeroconf_discover_data {
struct module *module; struct module *module;
@ -100,6 +106,8 @@ struct module *create_module_zeroconf_discover(struct impl *impl, const char *ar
struct pw_properties *props = NULL; struct pw_properties *props = NULL;
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_zeroconf_discover_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_zeroconf_discover_info));
if (props == NULL) { if (props == NULL) {
res = -errno; res = -errno;

View file

@ -41,6 +41,11 @@
#include <avahi-common/error.h> #include <avahi-common/error.h>
#include <avahi-common/domain.h> #include <avahi-common/domain.h>
#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_SINK "_pulse-sink._tcp"
#define SERVICE_TYPE_SOURCE "_pulse-source._tcp" #define SERVICE_TYPE_SOURCE "_pulse-source._tcp"
#define SERVICE_TYPE_SERVER "_pulse-server._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; const char *port;
int res; int res;
PW_LOG_TOPIC_INIT(mod_topic);
props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_zeroconf_publish_info)); props = pw_properties_new_dict(&SPA_DICT_INIT_ARRAY(module_zeroconf_publish_info));
if (!props) { if (!props) {
res = -errno; res = -errno;

View file

@ -28,6 +28,7 @@
#include <pipewire/log.h> #include <pipewire/log.h>
#include "client.h" #include "client.h"
#include "log.h"
#include "manager.h" #include "manager.h"
#include "operation.h" #include "operation.h"
#include "reply.h" #include "reply.h"

View file

@ -28,6 +28,7 @@
#include "client.h" #include "client.h"
#include "internal.h" #include "internal.h"
#include "log.h"
#include "pending-sample.h" #include "pending-sample.h"
#include "sample-play.h" #include "sample-play.h"

View file

@ -35,6 +35,7 @@
#include <pipewire/log.h> #include <pipewire/log.h>
#include "log.h"
#define spa_debug pw_log_debug #define spa_debug pw_log_debug
#include <spa/support/cpu.h> #include <spa/support/cpu.h>
@ -149,7 +150,7 @@ static int do_command_auth(struct client *client, uint32_t command, uint32_t tag
client->version = version; 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); reply = reply_new(client, tag);
message_put(reply, 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); 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); reply = reply_new(client, tag);
@ -188,7 +189,7 @@ static void manager_sync(void *data)
struct client *client = data; struct client *client = data;
struct operation *o; 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) { if (client->connect_tag != SPA_ID_INVALID) {
reply_set_client_name(client, client->connect_tag); 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; s->missing = attr->tlength;
attr->fragsize = 0; 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, s->client->name, attr->maxlength, attr->tlength,
attr->minreq, attr->prebuf); 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); 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); stream, client->name, stream->create_tag, missing, latency);
reply = reply_new(client, stream->create_tag); 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; 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); 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, pw_stream_update_properties(stream->stream,
&SPA_DICT_INIT(items, 3)); &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); stream, client->name, stream->create_tag, latency);
reply = reply_new(client, stream->create_tag); 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); 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); commands[command].name, tag);
if (client->core == NULL) { if (client->core == NULL) {
@ -881,7 +882,7 @@ static int do_set_client_name(struct client *client, uint32_t command, uint32_t
return res; return res;
error: 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; return res;
} }
@ -896,7 +897,7 @@ static int do_subscribe(struct client *client, uint32_t command, uint32_t tag, s
TAG_INVALID) < 0) TAG_INVALID) < 0)
return -EPROTO; 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->name, tag, mask);
client->subscribed = mask; client->subscribed = mask;
@ -1010,7 +1011,7 @@ static void stream_param_changed(void *data, uint32_t id, const struct spa_pod *
return; 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); stream->frame_size = sample_spec_frame_size(&stream->ss);
if (stream->frame_size == 0) { 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); avail = spa_ringbuffer_get_read_index(&stream->ring, &index);
if (!spa_list_is_empty(&client->out_messages)) { 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); stream, client->name, index, avail);
return 0; return 0;
} }
@ -1123,13 +1124,13 @@ do_process_done(struct spa_loop *loop,
if (avail <= 0) { if (avail <= 0) {
/* underrun, can't really happen but if it does we /* underrun, can't really happen but if it does we
* do nothing and wait for more data */ * 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); stream, client->name, index, avail);
} else { } else {
if (avail > (int32_t)stream->attr.maxlength) { if (avail > (int32_t)stream->attr.maxlength) {
uint32_t skip = avail - stream->attr.fragsize; uint32_t skip = avail - stream->attr.fragsize;
/* overrun, catch up to latest fragment and send it */ /* 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); stream, client->name, index, avail, stream->attr.maxlength, skip);
index += skip; index += skip;
stream->read_index += skip; stream->read_index += skip;
@ -1174,7 +1175,7 @@ static void stream_process(void *data)
uint32_t size, minreq = 0, index; uint32_t size, minreq = 0, index;
struct process_data pd; 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); buffer = pw_stream_dequeue_buffer(stream->stream);
if (buffer == NULL) if (buffer == NULL)
@ -1218,7 +1219,7 @@ static void stream_process(void *data)
uint32_t skip = avail - stream->attr.maxlength; uint32_t skip = avail - stream->attr.maxlength;
/* overrun, reported by other side, here we skip /* overrun, reported by other side, here we skip
* ahead to the oldest data. */ * 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, client->name, index, avail,
stream->attr.maxlength, skip); stream->attr.maxlength, skip);
index += skip; index += skip;
@ -1251,13 +1252,13 @@ static void stream_process(void *data)
if (filled < 0) { if (filled < 0) {
/* underrun, can't really happen because we never read more /* underrun, can't really happen because we never read more
* than what's available on the other side */ * 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); stream, client->name, index, filled);
} else if ((uint32_t)filled + size > stream->attr.maxlength) { } else if ((uint32_t)filled + size > stream->attr.maxlength) {
/* overrun, can happen when the other side is not /* overrun, can happen when the other side is not
* reading fast enough. We still write our data into the * reading fast enough. We still write our data into the
* ringbuffer and expect the other side to warn and catch up. */ * 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, stream, client->name, index, filled,
size, stream->attr.maxlength); size, stream->attr.maxlength);
} }
@ -1283,7 +1284,7 @@ static void stream_process(void *data)
static void stream_drained(void *data) static void stream_drained(void *data)
{ {
struct stream *stream = 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); stream->client->name, stream->channel);
reply_simple_ack(stream->client, stream->drain_tag); reply_simple_ack(stream->client, stream->drain_tag);
stream->drain_tag = 0; 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) static void log_format_info(struct impl *impl, enum spa_log_level level, struct format_info *format)
{ {
const struct spa_dict_item *it; 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)); impl, format_encoding2name(format->encoding));
spa_dict_for_each(it, &format->props->dict) 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); 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) TAG_INVALID) < 0)
goto error_protocol; 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); impl, client->name, tag, corked, sink_name, sink_index);
if (sink_index != SPA_ID_INVALID && sink_name != NULL) 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_params++;
n_valid_formats++; n_valid_formats++;
} else { } 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, impl, format_id2name(ss.format), ss.rate,
ss.channels); ss.channels);
} }
@ -1525,7 +1526,7 @@ static int do_create_playback_stream(struct client *client, uint32_t command, ui
if (stream->stream == NULL) if (stream->stream == NULL)
goto error_errno; 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); impl, stream, stream->channel, passthrough);
pw_stream_add_listener(stream->stream, 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) TAG_INVALID) < 0)
goto error_protocol; 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); impl, client->name, tag, corked, source_name, source_index);
if (source_index != SPA_ID_INVALID && source_name != NULL) 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_params++;
n_valid_formats++; n_valid_formats++;
} else { } 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, impl, format_id2name(ss.format), ss.rate,
ss.channels); ss.channels);
} }
@ -1835,7 +1836,7 @@ static int do_delete_stream(struct client *client, uint32_t command, uint32_t ta
TAG_INVALID)) < 0) TAG_INVALID)) < 0)
return -EPROTO; 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); client->name, tag, channel);
stream = pw_map_lookup(&client->streams, 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) TAG_INVALID)) < 0)
return -EPROTO; 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); stream = pw_map_lookup(&client->streams, channel);
if (stream == NULL || stream->type != STREAM_TYPE_PLAYBACK) if (stream == NULL || stream->type != STREAM_TYPE_PLAYBACK)
return -ENOENT; return -ENOENT;
@ -1920,7 +1921,7 @@ static int do_get_record_latency(struct client *client, uint32_t command, uint32
TAG_INVALID)) < 0) TAG_INVALID)) < 0)
return -EPROTO; 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); stream = pw_map_lookup(&client->streams, channel);
if (stream == NULL || stream->type != STREAM_TYPE_RECORD) if (stream == NULL || stream->type != STREAM_TYPE_RECORD)
return -ENOENT; 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) if (length >= SCACHE_ENTRY_SIZE_MAX)
goto error_toolarge; 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, impl, client->name, commands[command].name, tag,
name, length); name, length);
@ -2066,7 +2067,7 @@ static int do_finish_upload_stream(struct client *client, uint32_t command, uint
if (name == NULL) if (name == NULL)
goto error_invalid; 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, impl, client->name, commands[command].name, tag,
channel, name); channel, name);
@ -2220,7 +2221,7 @@ static void sample_play_ready(void *data, uint32_t index)
struct impl *impl = client->impl; struct impl *impl = client->impl;
struct message *reply; 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); impl, client->name, ps->tag, index);
reply = reply_new(client, ps->tag); reply = reply_new(client, ps->tag);
@ -2250,7 +2251,7 @@ static void sample_play_done(void *data, int res)
if (res < 0) if (res < 0)
reply_error(client, COMMAND_PLAY_SAMPLE, ps->tag, res); reply_error(client, COMMAND_PLAY_SAMPLE, ps->tag, res);
else 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; ps->done = true;
pw_work_queue_add(impl->work_queue, ps, 0, 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; 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, impl, client->name, commands[command].name, tag,
sink_index, sink_name, name); 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) TAG_INVALID)) < 0)
return -EPROTO; 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, impl, client->name, commands[command].name, tag,
name); name);
if (name == NULL) if (name == NULL)
@ -2389,7 +2390,7 @@ static int do_cork_stream(struct client *client, uint32_t command, uint32_t tag,
TAG_INVALID)) < 0) TAG_INVALID)) < 0)
return -EPROTO; 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, impl, client->name, commands[command].name, tag,
channel, cork ? "yes" : "no"); channel, cork ? "yes" : "no");
@ -2421,7 +2422,7 @@ static int do_flush_trigger_prebuf_stream(struct client *client, uint32_t comman
TAG_INVALID)) < 0) TAG_INVALID)) < 0)
return -EPROTO; 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); impl, client->name, commands[command].name, tag, channel);
stream = pw_map_lookup(&client->streams, 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) TAG_INVALID)) < 0)
return -EPROTO; 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); client->name, commands[command].name, tag, id);
stream = find_stream(client, 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) TAG_INVALID)) < 0)
return -EPROTO; 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); impl, client->name, tag, id, mute);
stream = find_stream(client, id); 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) TAG_INVALID)) < 0)
return -EPROTO; 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); client->name, commands[command].name, tag, id, name);
if ((id == SPA_ID_INVALID && name == NULL) || 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) TAG_INVALID)) < 0)
return -EPROTO; 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); client->name, commands[command].name, tag, id, name, mute);
if ((id == SPA_ID_INVALID && name == NULL) || 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) TAG_INVALID)) < 0)
return -EPROTO; 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); client->name, commands[command].name, tag, id, name, port_name);
if ((id == SPA_ID_INVALID && name == NULL) || 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) TAG_INVALID)) < 0)
return -EPROTO; 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); client->name, commands[command].name, tag, sel.id, sel.value, port_name, offset);
if ((sel.id == SPA_ID_INVALID && sel.value == NULL) || 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) if (name == NULL)
return -EINVAL; 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); impl, client->name, tag, channel, name);
stream = pw_map_lookup(&client->streams, channel); 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; 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); client->name, commands[command].name, tag, channel);
if (message_get(m, 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; 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); client->name, commands[command].name, tag, channel);
while (true) { while (true) {
@ -3072,7 +3073,7 @@ static int do_get_server_info(struct client *client, uint32_t command, uint32_t
char name[256]; char name[256];
struct message *reply; 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()); 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 impl *impl = client->impl;
struct message *reply; 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); reply = reply_new(client, tag);
message_put(reply, message_put(reply,
@ -3130,7 +3131,7 @@ static int do_lookup(struct client *client, uint32_t command, uint32_t tag, stru
TAG_INVALID) < 0) TAG_INVALID) < 0)
return -EPROTO; 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) if ((o = find_device(client, SPA_ID_INVALID, name, is_sink, &is_monitor)) == NULL)
return -ENOENT; return -ENOENT;
@ -3154,7 +3155,7 @@ static int do_drain_stream(struct client *client, uint32_t command, uint32_t tag
TAG_INVALID) < 0) TAG_INVALID) < 0)
return -EPROTO; 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); stream = pw_map_lookup(&client->streams, channel);
if (stream == NULL || stream->type != STREAM_TYPE_PLAYBACK) if (stream == NULL || stream->type != STREAM_TYPE_PLAYBACK)
return -ENOENT; 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); pi_n_profiles = SPA_MIN(pi->n_profiles, n_profiles);
if (pi->n_profiles != pi_n_profiles) { if (pi->n_profiles != pi_n_profiles) {
/* libpulse assumes port profile array size <= 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); 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) if (sel.id != SPA_ID_INVALID && sel.value != NULL)
goto error_invalid; 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); commands[command].name, tag, sel.id, sel.value);
if (command == COMMAND_GET_SINK_INFO || command == COMMAND_GET_SOURCE_INFO) { 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)) (id != SPA_ID_INVALID && name != NULL))
return -EINVAL; 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); commands[command].name, tag, id, name);
if ((sample = find_sample(impl, id, name)) == NULL) 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; struct message *reply;
union pw_map_item *item; 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); commands[command].name, tag);
reply = reply_new(client, 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 pw_manager *manager = client->manager;
struct info_list_data info; 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); commands[command].name, tag);
spa_zero(info); spa_zero(info);
@ -4202,7 +4203,7 @@ static int do_set_stream_buffer_attr(struct client *client, uint32_t command, ui
TAG_INVALID) < 0) TAG_INVALID) < 0)
return -EPROTO; 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); commands[command].name, tag, channel);
stream = pw_map_lookup(&client->streams, 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) TAG_INVALID) < 0)
return -EPROTO; 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); commands[command].name, tag, channel, rate);
stream = pw_map_lookup(&client->streams, channel); 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) TAG_INVALID) < 0)
return -EPROTO; 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); commands[command].name, tag, idx, name);
if ((idx == SPA_ID_INVALID && name == NULL) || 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) TAG_INVALID) < 0)
return -EPROTO; 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); commands[command].name, tag, sel.id, sel.value, profile_name);
if ((sel.id == SPA_ID_INVALID && sel.value == NULL) || 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) TAG_INVALID) < 0)
return -EPROTO; 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); commands[command].name, tag, name);
if (name != NULL && (o = find_device(client, SPA_ID_INVALID, name, sink, NULL)) == NULL) 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) TAG_INVALID) < 0)
return -EPROTO; 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); commands[command].name, tag, id, name);
if ((o = find_device(client, id, name, sink, NULL)) == NULL) 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)) (id_device != SPA_ID_INVALID && name_device != NULL))
return -EINVAL; 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); commands[command].name, tag, id, id_device, name_device);
spa_zero(sel); spa_zero(sel);
@ -4528,7 +4529,7 @@ static int do_kill(struct client *client, uint32_t command, uint32_t tag, struct
TAG_INVALID) < 0) TAG_INVALID) < 0)
return -EPROTO; 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); commands[command].name, tag, id);
spa_zero(sel); spa_zero(sel);
@ -4576,7 +4577,7 @@ static void on_module_loaded(void *data, int result)
if (SPA_RESULT_IS_OK(result)) { if (SPA_RESULT_IS_OK(result)) {
struct message *reply; 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, impl, client->name,
module->idx, module->name); module->idx, module->name);
@ -4594,7 +4595,7 @@ static void on_module_loaded(void *data, int result)
client_queue_message(client, reply); client_queue_message(client, reply);
} }
else { 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, impl, client->name,
module->idx, module->name, module->idx, module->name,
result, spa_strerror(result)); 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) TAG_INVALID) < 0)
return -EPROTO; 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); client->name, commands[command].name, name, argument);
module = module_create(client, 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) TAG_INVALID) < 0)
return -EPROTO; 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); commands[command].name, tag, module_idx);
if (module_idx == SPA_ID_INVALID) 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) TAG_INVALID) < 0)
return -EPROTO; 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, client->name, commands[command].name, tag, object_path,
message, params ? params : "<null>"); message, params ? params : "<null>");
@ -4734,7 +4735,7 @@ static int do_send_object_message(struct client *client, uint32_t command, uint3
if (res < 0) if (res < 0)
return res; return res;
pw_log_debug(NAME" %p: object message response:'%s'", impl, response ? response : "<null>"); pw_log_debug("%p: object message response:'%s'", impl, response ? response : "<null>");
reply = reply_new(client, tag); reply = reply_new(client, tag);
message_put(reply, TAG_STRING, response, TAG_INVALID); 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; str = def;
if (sscanf(str, "%u/%u", &res->num, &res->denom) != 2 || res->denom == 0) if (sscanf(str, "%u/%u", &res->num, &res->denom) != 2 || res->denom == 0)
return -EINVAL; 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; 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->channels < SPA_AUDIO_MAX_CHANNELS) {
res->map[res->channels++] = channel_name2id(v); 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; return 0;
} }
static int parse_format(struct pw_properties *props, const char *key, const char *def, 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; str = def;
res->format = format_name2id(str); res->format = format_name2id(str);
if (res->format == SPA_AUDIO_FORMAT_UNKNOWN) { 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); res->format = format_name2id(def);
} }
pw_log_info(NAME": defaults: %s = %s", key, str); pw_log_info(": defaults: %s = %s", key, str);
return 0; return 0;
} }
@ -5098,13 +5099,13 @@ struct pw_protocol_pulse *pw_protocol_pulse_new(struct pw_context *context,
goto error_free; goto error_free;
if ((res = servers_create_and_start(impl, str, NULL)) < 0) { 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)); impl, spa_strerror(res));
goto error_free; goto error_free;
} }
if ((res = create_pid_file()) < 0) { 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)); impl, spa_strerror(res));
} }
pw_context_add_listener(context, &impl->context_listener, pw_context_add_listener(context, &impl->context_listener,

View file

@ -28,6 +28,7 @@
#include <pipewire/properties.h> #include <pipewire/properties.h>
#include "log.h"
#include "quirks.h" #include "quirks.h"
#define QUOTE(...) #__VA_ARGS__ #define QUOTE(...) #__VA_ARGS__

View file

@ -31,6 +31,7 @@
#include "client.h" #include "client.h"
#include "commands.h" #include "commands.h"
#include "message.h" #include "message.h"
#include "log.h"
struct message *reply_new(const struct client *client, uint32_t tag) struct message *reply_new(const struct client *client, uint32_t tag)
{ {

View file

@ -38,6 +38,7 @@
#include <pipewire/stream.h> #include <pipewire/stream.h>
#include "format.h" #include "format.h"
#include "log.h"
#include "sample.h" #include "sample.h"
#include "sample-play.h" #include "sample-play.h"

View file

@ -29,6 +29,7 @@
#include <pipewire/properties.h> #include <pipewire/properties.h>
#include "internal.h" #include "internal.h"
#include "log.h"
#include "sample.h" #include "sample.h"
void sample_free(struct sample *sample) void sample_free(struct sample *sample)

View file

@ -54,6 +54,7 @@
#include "commands.h" #include "commands.h"
#include "defs.h" #include "defs.h"
#include "internal.h" #include "internal.h"
#include "log.h"
#include "message.h" #include "message.h"
#include "reply.h" #include "reply.h"
#include "server.h" #include "server.h"

View file

@ -39,6 +39,7 @@
#include "client.h" #include "client.h"
#include "commands.h" #include "commands.h"
#include "internal.h" #include "internal.h"
#include "log.h"
#include "message.h" #include "message.h"
#include "reply.h" #include "reply.h"
#include "stream.h" #include "stream.h"

View file

@ -49,6 +49,7 @@
#include <pipewire/log.h> #include <pipewire/log.h>
#include <pipewire/keys.h> #include <pipewire/keys.h>
#include "log.h"
#include "utils.h" #include "utils.h"
int get_runtime_dir(char *buf, size_t buflen, const char *dir) 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"); runtime_dir = getenv("XDG_RUNTIME_DIR");
if (runtime_dir == NULL) { 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"); "$PULSE_RUNTIME_PATH and $XDG_RUNTIME_DIR");
return -ENOENT; return -ENOENT;
} }
@ -71,24 +72,24 @@ int get_runtime_dir(char *buf, size_t buflen, const char *dir)
if (size < 0) if (size < 0)
return -errno; return -errno;
if ((size_t) size >= buflen) { 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; return -ENAMETOOLONG;
} }
if (stat(buf, &stat_buf) < 0) { if (stat(buf, &stat_buf) < 0) {
res = -errno; res = -errno;
if (res != -ENOENT) { if (res != -ENOENT) {
pw_log_error(NAME": stat() %s failed: %m", buf); pw_log_error("stat() %s failed: %m", buf);
return res; return res;
} }
if (mkdir(buf, 0700) < 0) { if (mkdir(buf, 0700) < 0) {
res = -errno; res = -errno;
pw_log_error(NAME": mkdir() %s failed: %m", buf); pw_log_error("mkdir() %s failed: %m", buf);
return res; return res;
} }
pw_log_info(NAME": created %s", buf); pw_log_info("created %s", buf);
} else if (!S_ISDIR(stat_buf.st_mode)) { } 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 -ENOTDIR;
} }
return 0; 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 /* 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 * we're failing due to /proc/$pid not existing. In that case fail instead
* of treating this as privileged. */ * 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; return res;
} }
info_fd = openat(root_fd, ".flatpak-info", O_RDONLY | O_CLOEXEC | O_NOCTTY); info_fd = openat(root_fd, ".flatpak-info", O_RDONLY | O_CLOEXEC | O_NOCTTY);
@ -187,7 +188,7 @@ int create_pid_file(void) {
return res; return res;
if (strlen(pid_file) > PATH_MAX - sizeof("/pid")) { 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; return -ENAMETOOLONG;
} }
@ -195,7 +196,7 @@ int create_pid_file(void) {
if ((f = fopen(pid_file, "w")) == NULL) { if ((f = fopen(pid_file, "w")) == NULL) {
res = -errno; res = -errno;
pw_log_error(NAME": failed to open pid file: %m"); pw_log_error("failed to open pid file: %m");
return res; return res;
} }

View file

@ -28,6 +28,7 @@
#include <spa/utils/defs.h> #include <spa/utils/defs.h>
#include <pipewire/log.h> #include <pipewire/log.h>
#include "log.h"
#include "volume.h" #include "volume.h"
int volume_compare(struct volume *vol, struct volume *other) int volume_compare(struct volume *vol, struct volume *other)