diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index 53aeb97bf..7783a943d 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -42,7 +42,9 @@ #include #include -#define NAME "audioadapter" +#undef SPA_LOG_TOPIC_DEFAULT +#define SPA_LOG_TOPIC_DEFAULT log_topic +static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.audioadapter"); #define MAX_PORTS SPA_AUDIO_MAX_CHANNELS @@ -125,7 +127,7 @@ static int impl_node_enum_params(void *object, int seq, next: result.index = result.next; - spa_log_debug(this->log, NAME" %p: %d id:%u", this, seq, id); + spa_log_debug(this->log, "%p: %d id:%u", this, seq, id); spa_pod_builder_init(&b, buffer, sizeof(buffer)); @@ -181,7 +183,7 @@ static int link_io(struct impl *this) if (this->convert == NULL) return 0; - spa_log_debug(this->log, NAME " %p: controls", this); + spa_log_debug(this->log, "%p: controls", this); spa_zero(this->io_rate_match); this->io_rate_match.rate = 1.0; @@ -190,14 +192,14 @@ static int link_io(struct impl *this) this->direction, 0, SPA_IO_RateMatch, &this->io_rate_match, sizeof(this->io_rate_match))) < 0) { - spa_log_debug(this->log, NAME " %p: set RateMatch on follower disabled %d %s", this, + spa_log_debug(this->log, "%p: set RateMatch on follower disabled %d %s", this, res, spa_strerror(res)); } else if ((res = spa_node_port_set_io(this->convert, SPA_DIRECTION_REVERSE(this->direction), 0, SPA_IO_RateMatch, &this->io_rate_match, sizeof(this->io_rate_match))) < 0) { - spa_log_warn(this->log, NAME " %p: set RateMatch on convert failed %d %s", this, + spa_log_warn(this->log, "%p: set RateMatch on convert failed %d %s", this, res, spa_strerror(res)); } @@ -207,7 +209,7 @@ static int link_io(struct impl *this) this->direction, 0, SPA_IO_Buffers, &this->io_buffers, sizeof(this->io_buffers))) < 0) { - spa_log_warn(this->log, NAME " %p: set Buffers on follower failed %d %s", this, + spa_log_warn(this->log, "%p: set Buffers on follower failed %d %s", this, res, spa_strerror(res)); return res; } @@ -215,7 +217,7 @@ static int link_io(struct impl *this) SPA_DIRECTION_REVERSE(this->direction), 0, SPA_IO_Buffers, &this->io_buffers, sizeof(this->io_buffers))) < 0) { - spa_log_warn(this->log, NAME " %p: set Buffers on convert failed %d %s", this, + spa_log_warn(this->log, "%p: set Buffers on convert failed %d %s", this, res, spa_strerror(res)); return res; } @@ -294,7 +296,7 @@ static int negotiate_buffers(struct impl *this) struct spa_data *datas; uint32_t follower_flags, conv_flags; - spa_log_debug(this->log, NAME" %p: %d", this, this->n_buffers); + spa_log_debug(this->log, "%p: %d", this, this->n_buffers); if (this->target == this->follower) return 0; @@ -394,7 +396,7 @@ static int configure_format(struct impl *this, uint32_t flags, const struct spa_ { int res; - spa_log_debug(this->log, NAME "%p: configure format:", this); + spa_log_debug(this->log, "%p: configure format:", this); if (format && spa_log_level_enabled(this->log, SPA_LOG_LEVEL_DEBUG)) spa_debug_format(0, NULL, format); @@ -450,7 +452,7 @@ static int reconfigure_mode(struct impl *this, bool passthrough, int res = 0; struct spa_hook l; - spa_log_debug(this->log, NAME " %p: passthrough mode %d", this, passthrough); + spa_log_debug(this->log, "%p: passthrough mode %d", this, passthrough); if (this->passthrough != passthrough) { if (passthrough) { @@ -502,7 +504,7 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags, struct impl *this = object; struct spa_audio_info info = { 0 }; - spa_log_debug(this->log, NAME" %p: set param %d", this, id); + spa_log_debug(this->log, "%p: set param %d", this, id); switch (id) { case SPA_PARAM_Format: @@ -623,7 +625,7 @@ static int negotiate_format(struct impl *this) spa_pod_builder_init(&b, buffer, sizeof(buffer)); - spa_log_debug(this->log, NAME " %p: negiotiate", this); + spa_log_debug(this->log, "%p: negiotiate", this); spa_node_send_command(this->follower, &SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_ParamBegin)); @@ -680,7 +682,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_debug(this->log, NAME " %p: command %d", this, SPA_NODE_COMMAND_ID(command)); + spa_log_debug(this->log, "%p: command %d", this, SPA_NODE_COMMAND_ID(command)); switch (SPA_NODE_COMMAND_ID(command)) { case SPA_NODE_COMMAND_Start: @@ -703,7 +705,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman } if ((res = spa_node_send_command(this->target, command)) < 0) { - spa_log_error(this->log, NAME " %p: can't send command %d: %s", + spa_log_error(this->log, "%p: can't send command %d: %s", this, SPA_NODE_COMMAND_ID(command), spa_strerror(res)); return res; @@ -711,7 +713,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman if (this->target != this->follower) { if ((res = spa_node_send_command(this->follower, command)) < 0) { - spa_log_error(this->log, NAME " %p: can't send command %d: %s", + spa_log_error(this->log, "%p: can't send command %d: %s", this, SPA_NODE_COMMAND_ID(command), spa_strerror(res)); return res; @@ -774,7 +776,7 @@ static void convert_port_info(void *data, port_id--; } - spa_log_trace(this->log, NAME" %p: port info %d:%d", this, + spa_log_trace(this->log, "%p: port info %d:%d", this, direction, port_id); if (this->target != this->follower) @@ -788,7 +790,7 @@ static void convert_result(void *data, int seq, int res, uint32_t type, const vo if (this->target == this->follower) return; - spa_log_trace(this->log, NAME" %p: result %d %d", this, seq, res); + spa_log_trace(this->log, "%p: result %d %d", this, seq, res); spa_node_emit_result(&this->hooks, seq, res, type, result); } @@ -822,7 +824,7 @@ static void follower_info(void *data, const struct spa_node_info *info) this->info.max_output_ports = MAX_PORTS; } - spa_log_debug(this->log, NAME" %p: follower info %s", this, + spa_log_debug(this->log, "%p: follower info %s", this, this->direction == SPA_DIRECTION_INPUT ? "Input" : "Output"); @@ -870,7 +872,7 @@ static int recalc_latency(struct impl *this, enum spa_direction direction, uint3 struct spa_latency_info latency; int res; - spa_log_debug(this->log, NAME" %p: ", this); + spa_log_debug(this->log, "%p: ", this); if (this->target == this->follower) return 0; @@ -907,7 +909,7 @@ static void follower_port_info(void *data, return; } - spa_log_debug(this->log, NAME" %p: follower port info %s %p %08"PRIx64, this, + spa_log_debug(this->log, "%p: follower port info %s %p %08"PRIx64, this, this->direction == SPA_DIRECTION_INPUT ? "Input" : "Output", info, info->change_mask); @@ -960,7 +962,7 @@ static void follower_result(void *data, int seq, int res, uint32_t type, const v if (this->target != this->follower) return; - spa_log_trace(this->log, NAME" %p: result %d %d", this, seq, res); + spa_log_trace(this->log, "%p: result %d %d", this, seq, res); spa_node_emit_result(&this->hooks, seq, res, type, result); } @@ -975,7 +977,7 @@ static int follower_ready(void *data, int status) { struct impl *this = data; - spa_log_trace_fp(this->log, NAME " %p: ready %d", this, status); + spa_log_trace_fp(this->log, "%p: ready %d", this, status); if (this->target != this->follower) { this->driver = true; @@ -1024,7 +1026,7 @@ static int impl_node_add_listener(void *object, spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_trace(this->log, NAME" %p: add listener %p", this, listener); + spa_log_trace(this->log, "%p: add listener %p", this, listener); spa_hook_list_isolate(&this->hooks, &save, listener, events, data); @@ -1114,7 +1116,7 @@ impl_node_port_enum_params(void *object, int seq, if (direction != this->direction) port_id++; - spa_log_debug(this->log, NAME" %p: %d %u", this, seq, id); + spa_log_debug(this->log, "%p: %d %u", this, seq, id); return spa_node_port_enum_params(this->target, seq, direction, port_id, id, start, num, filter); @@ -1185,7 +1187,7 @@ impl_node_port_use_buffers(void *object, if (direction != this->direction) port_id++; - spa_log_debug(this->log, NAME" %p: %d %d:%d", this, + spa_log_debug(this->log, "%p: %d %d:%d", this, n_buffers, direction, port_id); if ((res = spa_node_port_use_buffers(this->target, @@ -1390,6 +1392,8 @@ impl_init(const struct spa_handle_factory *factory, this = (struct impl *) handle; this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); + spa_log_topic_init(this->log, log_topic); + this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); if (info == NULL || diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index c88ef60f0..fbb485657 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -43,7 +43,9 @@ #include #include -#define NAME "audioconvert" +#undef SPA_LOG_TOPIC_DEFAULT +#define SPA_LOG_TOPIC_DEFAULT log_topic +static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.audioconvert"); #define MAX_PORTS SPA_AUDIO_MAX_CHANNELS @@ -410,7 +412,7 @@ static int negotiate_link_buffers(struct impl *this, struct link *link) static void flush_convert(struct impl *this) { int i; - spa_log_debug(this->log, NAME " %p: %d", this, this->n_links); + spa_log_debug(this->log, "%p: %d", this, this->n_links); for (i = 0; i < this->n_links; i++) this->links[i].io.status = SPA_STATUS_OK; } @@ -419,7 +421,7 @@ static void clean_convert(struct impl *this) { int i; - spa_log_debug(this->log, NAME " %p: %d", this, this->n_links); + spa_log_debug(this->log, "%p: %d", this, this->n_links); for (i = 0; i < this->n_links; i++) clean_link(this, &this->links[i]); @@ -430,18 +432,18 @@ static int setup_buffers(struct impl *this, enum spa_direction direction) { int i, res; - spa_log_debug(this->log, NAME " %p: %d %d", this, direction, this->n_links); + spa_log_debug(this->log, "%p: %d %d", this, direction, this->n_links); if (direction == SPA_DIRECTION_INPUT) { for (i = 0; i < this->n_links; i++) { if ((res = negotiate_link_buffers(this, &this->links[i])) < 0) - spa_log_error(this->log, NAME " %p: buffers %d failed %s", + spa_log_error(this->log, "%p: buffers %d failed %s", this, i, spa_strerror(res)); } } else { for (i = this->n_links-1; i >= 0 ; i--) { if ((res = negotiate_link_buffers(this, &this->links[i])) < 0) - spa_log_error(this->log, NAME " %p: buffers %d failed %s", + spa_log_error(this->log, "%p: buffers %d failed %s", this, i, spa_strerror(res)); } } @@ -552,7 +554,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size) spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_debug(this->log, NAME " %p: io %d %p/%zd", this, id, data, size); + spa_log_debug(this->log, "%p: io %d %p/%zd", this, id, data, size); switch (id) { case SPA_IO_Position: @@ -675,7 +677,7 @@ static int reconfigure_mode(struct impl *this, enum spa_param_port_config_mode m struct spa_node *old, *new; bool do_signal; - spa_log_debug(this->log, NAME " %p: mode %d", this, mode); + spa_log_debug(this->log, "%p: mode %d", this, mode); /* old node on input/output */ old = this->fmt[direction]; @@ -733,7 +735,7 @@ static int reconfigure_mode(struct impl *this, enum spa_param_port_config_mode m spa_pod_builder_init(&b, buffer, sizeof(buffer)); if (info) { - spa_log_debug(this->log, NAME " %p: port config %d", this, info->info.raw.channels); + spa_log_debug(this->log, "%p: port config %d", this, info->info.raw.channels); param = spa_format_audio_raw_build(&b, SPA_PARAM_Format, &info->info.raw); } if (mode == SPA_PARAM_PORT_CONFIG_MODE_dsp) { @@ -884,7 +886,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman for (i = 0; i < this->n_nodes; i++) { if ((res = spa_node_send_command(this->nodes[i], command)) < 0) { - spa_log_error(this->log, NAME " %p: can't send command to node %d: %s", + spa_log_error(this->log, "%p: can't send command to node %d: %s", this, i, spa_strerror(res)); } } @@ -980,7 +982,7 @@ impl_node_port_enum_params(void *object, int seq, spa_return_val_if_fail(this != NULL, -EINVAL); spa_return_val_if_fail(num != 0, -EINVAL); - spa_log_debug(this->log, NAME" %p: port %d.%d %d %u", this, direction, port_id, seq, id); + spa_log_debug(this->log, "%p: port %d.%d %d %u", this, direction, port_id, seq, id); result.id = id; result.next = start; @@ -1059,7 +1061,7 @@ impl_node_port_set_param(void *object, spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_debug(this->log, NAME " %p: set param %u on port %d:%d %p", + spa_log_debug(this->log, "%p: set param %u on port %d:%d %p", this, id, direction, port_id, param); switch (id) { @@ -1167,7 +1169,7 @@ static int impl_node_process(void *object) spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_trace_fp(this->log, NAME " %p: process %d %d", this, this->n_links, this->n_nodes); + spa_log_trace_fp(this->log, "%p: process %d %d", this, this->n_links, this->n_nodes); while (1) { res = SPA_STATUS_OK; @@ -1175,7 +1177,7 @@ static int impl_node_process(void *object) for (i = 0; i < this->n_nodes; i++) { r = spa_node_process(this->nodes[i]); - spa_log_trace_fp(this->log, NAME " %p: process %d %d: %s", + spa_log_trace_fp(this->log, "%p: process %d %d: %s", this, i, r, r < 0 ? spa_strerror(r) : "ok"); if (SPA_UNLIKELY(r < 0)) @@ -1195,7 +1197,7 @@ static int impl_node_process(void *object) break; } - spa_log_trace_fp(this->log, NAME " %p: process result: %d", this, res); + spa_log_trace_fp(this->log, "%p: process result: %d", this, res); return res; } @@ -1298,8 +1300,9 @@ impl_init(const struct spa_handle_factory *factory, this = (struct impl *) handle; this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); - this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); + spa_log_topic_init(this->log, log_topic); + this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); if (this->cpu) this->max_align = spa_cpu_get_max_align(this->cpu); diff --git a/spa/plugins/audioconvert/channelmix.c b/spa/plugins/audioconvert/channelmix.c index a93a5ee8b..0fdd1e577 100644 --- a/spa/plugins/audioconvert/channelmix.c +++ b/spa/plugins/audioconvert/channelmix.c @@ -44,7 +44,9 @@ #include "channelmix-ops.h" -#define NAME "channelmix" +#undef SPA_LOG_TOPIC_DEFAULT +#define SPA_LOG_TOPIC_DEFAULT log_topic +static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.channelmix"); #define DEFAULT_RATE 48000 #define DEFAULT_CHANNELS 2 @@ -335,7 +337,7 @@ static int setup_convert(struct impl *this, if (dst_mask & 1 || dst_chan == 1) dst_mask = default_mask(dst_chan); - spa_log_info(this->log, NAME " %p: %s/%d@%d->%s/%d@%d %08"PRIx64":%08"PRIx64, this, + spa_log_info(this->log, "%p: %s/%d@%d->%s/%d@%d %08"PRIx64":%08"PRIx64, this, spa_debug_type_find_name(spa_type_audio_format, src_info->info.raw.format), src_chan, src_info->info.raw.rate, @@ -365,7 +367,7 @@ static int setup_convert(struct impl *this, this->is_passthrough = SPA_FLAG_IS_SET(this->mix.flags, CHANNELMIX_FLAG_IDENTITY); - spa_log_debug(this->log, NAME " %p: got channelmix features %08x:%08x flags:%08x passthrough:%d", + spa_log_debug(this->log, "%p: got channelmix features %08x:%08x flags:%08x passthrough:%d", this, this->cpu_flags, this->mix.cpu_flags, this->mix.flags, this->is_passthrough); @@ -611,7 +613,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size) spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_debug(this->log, NAME " %p: io %d %p/%zd", this, id, data, size); + spa_log_debug(this->log, "%p: io %d %p/%zd", this, id, data, size); switch (id) { case SPA_IO_Position: @@ -922,7 +924,7 @@ impl_node_port_enum_params(void *object, int seq, static int clear_buffers(struct impl *this, struct port *port) { if (port->n_buffers > 0) { - spa_log_debug(this->log, NAME " %p: clear buffers %p", this, port); + spa_log_debug(this->log, "%p: clear buffers %p", this, port); port->n_buffers = 0; spa_list_init(&port->queue); } @@ -981,7 +983,7 @@ static int port_set_format(void *object, port->format = info; port->have_format = true; - spa_log_debug(this->log, NAME " %p: set format on port %d %d", this, port_id, res); + spa_log_debug(this->log, "%p: set format on port %d %d", this, port_id, res); } port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS; @@ -1037,7 +1039,7 @@ impl_node_port_use_buffers(void *object, if (IS_DATA_PORT(this, direction, port_id)) spa_return_val_if_fail(port->have_format, -EIO); - spa_log_debug(this->log, NAME " %p: use buffers %d on port %d", this, n_buffers, port_id); + spa_log_debug(this->log, "%p: use buffers %d on port %d", this, n_buffers, port_id); clear_buffers(this, port); @@ -1059,12 +1061,12 @@ impl_node_port_use_buffers(void *object, return -EINVAL; if (d[j].data == NULL) { - spa_log_error(this->log, NAME " %p: invalid memory on buffer %p", this, + spa_log_error(this->log, "%p: invalid memory on buffer %p", this, buffers[i]); return -EINVAL; } if (!SPA_IS_ALIGNED(d[j].data, 16)) { - spa_log_warn(this->log, NAME " %p: memory %d on buffer %d not aligned", + spa_log_warn(this->log, "%p: memory %d on buffer %d not aligned", this, j, i); } b->datas[j] = d[j].data; @@ -1114,7 +1116,7 @@ static void recycle_buffer(struct impl *this, uint32_t id) if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) { spa_list_append(&port->queue, &b->link); SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); - spa_log_trace_fp(this->log, NAME " %p: recycle buffer %d", this, id); + spa_log_trace_fp(this->log, "%p: recycle buffer %d", this, id); } } @@ -1187,7 +1189,7 @@ static int channelmix_process_control(struct impl *this, struct port *ctrlport, chunk = SPA_MIN(avail_samples, c->offset - ctrlport->ctrl_offset); - spa_log_trace_fp(this->log, NAME " %p: process %d %d", this, + spa_log_trace_fp(this->log, "%p: process %d %d", this, c->offset, chunk); channelmix_process(&this->mix, n_dst, dst, n_src, src, chunk); @@ -1204,7 +1206,7 @@ static int channelmix_process_control(struct impl *this, struct port *ctrlport, /* when we get here we run out of control points but still have some * remaining samples */ - spa_log_trace_fp(this->log, NAME " %p: remain %d", this, avail_samples); + spa_log_trace_fp(this->log, "%p: remain %d", this, avail_samples); if (avail_samples > 0) channelmix_process(&this->mix, n_dst, dst, n_src, src, avail_samples); @@ -1232,7 +1234,7 @@ static int impl_node_process(void *object) spa_return_val_if_fail(outio != NULL, -EIO); spa_return_val_if_fail(inio != NULL, -EIO); - spa_log_trace_fp(this->log, NAME " %p: status %p %d %d -> %p %d %d", this, + spa_log_trace_fp(this->log, "%p: status %p %d %d -> %p %d %d", this, inio, inio->status, inio->buffer_id, outio, outio->status, outio->buffer_id); @@ -1292,7 +1294,7 @@ static int impl_node_process(void *object) db->datas[i].chunk->size = n_samples * outport->stride; } - spa_log_trace_fp(this->log, NAME " %p: n_src:%d n_dst:%d n_samples:%d p:%d", + spa_log_trace_fp(this->log, "%p: n_src:%d n_dst:%d n_samples:%d p:%d", this, n_src_datas, n_dst_datas, n_samples, is_passthrough); if (!is_passthrough) { @@ -1412,8 +1414,9 @@ impl_init(const struct spa_handle_factory *factory, this = (struct impl *) handle; this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); - this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); + spa_log_topic_init(this->log, log_topic); + this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); if (this->cpu) this->cpu_flags = spa_cpu_get_flags(this->cpu); diff --git a/spa/plugins/audioconvert/fmtconvert.c b/spa/plugins/audioconvert/fmtconvert.c index 8b91ccfbe..f7dc2eb57 100644 --- a/spa/plugins/audioconvert/fmtconvert.c +++ b/spa/plugins/audioconvert/fmtconvert.c @@ -45,7 +45,9 @@ #include "fmt-ops.h" -#define NAME "fmtconvert" +#undef SPA_LOG_TOPIC_DEFAULT +#define SPA_LOG_TOPIC_DEFAULT log_topic +static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.fmtconvert"); #define DEFAULT_RATE 48000 #define DEFAULT_CHANNELS 2 @@ -174,7 +176,7 @@ static int setup_convert(struct impl *this) src_fmt = informat.info.raw.format; dst_fmt = outformat.info.raw.format; - spa_log_info(this->log, NAME " %p: %s/%d@%d->%s/%d@%d", this, + spa_log_info(this->log, "%p: %s/%d@%d->%s/%d@%d", this, spa_debug_type_find_name(spa_type_audio_format, src_fmt), informat.info.raw.channels, informat.info.raw.rate, @@ -203,7 +205,7 @@ static int setup_convert(struct impl *this) else this->dst_remap[j] = 0; } - spa_log_debug(this->log, NAME " %p: channel %d -> %d (%s -> %s)", this, + spa_log_debug(this->log, "%p: channel %d -> %d (%s -> %s)", this, i, j, spa_debug_type_find_short_name(spa_type_audio_channel, informat.info.raw.position[i]), @@ -223,7 +225,7 @@ static int setup_convert(struct impl *this) this->is_passthrough = this->conv.is_passthrough; - spa_log_debug(this->log, NAME " %p: got converter features %08x:%08x passthrough:%d", this, + spa_log_debug(this->log, "%p: got converter features %08x:%08x passthrough:%d", this, this->cpu_flags, this->conv.cpu_flags, this->is_passthrough); return 0; @@ -248,7 +250,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size) spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_debug(this->log, NAME " %p: io %d %p/%zd", this, id, data, size); + spa_log_debug(this->log, "%p: io %d %p/%zd", this, id, data, size); switch (id) { case SPA_IO_Position: @@ -370,7 +372,7 @@ static int port_enum_formats(void *object, port = GET_PORT(this, direction, port_id); other = GET_PORT(this, SPA_DIRECTION_REVERSE(direction), 0); - spa_log_debug(this->log, NAME " %p: enum %p %d %d", this, other, port->have_format, other->have_format); + spa_log_debug(this->log, "%p: enum %p %d %d", this, other, port->have_format, other->have_format); switch (index) { case 0: if (port->have_format) { @@ -627,7 +629,7 @@ static int calc_width(struct spa_audio_info *info) static int clear_buffers(struct impl *this, struct port *port) { if (port->n_buffers > 0) { - spa_log_debug(this->log, NAME " %p: clear buffers %p", this, port); + spa_log_debug(this->log, "%p: clear buffers %p", this, port); port->n_buffers = 0; spa_list_init(&port->queue); } @@ -667,7 +669,7 @@ static int port_set_format(void *object, return -EINVAL; if (other->have_format) { - spa_log_debug(this->log, NAME "%p: channels:%d<>%d rate:%d<>%d format:%d<>%d", this, + spa_log_debug(this->log, "%p: channels:%d<>%d rate:%d<>%d format:%d<>%d", this, info.info.raw.channels, other->format.info.raw.channels, info.info.raw.rate, other->format.info.raw.rate, info.info.raw.format, other->format.info.raw.format); @@ -691,7 +693,7 @@ static int port_set_format(void *object, if ((res = setup_convert(this)) < 0) return res; - spa_log_debug(this->log, NAME " %p: set format on port %d:%d res:%d stride:%d", + spa_log_debug(this->log, "%p: set format on port %d:%d res:%d stride:%d", this, direction, port_id, res, port->stride); } if (port->have_format) { @@ -721,7 +723,7 @@ impl_node_port_set_param(void *object, port = GET_PORT(this, direction, port_id); - spa_log_debug(this->log, NAME " %p: set param %u on port %d:%d %p", + spa_log_debug(this->log, "%p: set param %u on port %d:%d %p", this, id, direction, port_id, param); switch (id) { @@ -770,7 +772,7 @@ impl_node_port_use_buffers(void *object, spa_return_val_if_fail(port->have_format, -EIO); - spa_log_debug(this->log, NAME " %p: use buffers %d on port %d", this, n_buffers, port_id); + spa_log_debug(this->log, "%p: use buffers %d on port %d", this, n_buffers, port_id); clear_buffers(this, port); @@ -786,7 +788,7 @@ impl_node_port_use_buffers(void *object, b->h = spa_buffer_find_meta_data(buffers[i], SPA_META_Header, sizeof(*b->h)); if (n_datas != port->blocks) { - spa_log_error(this->log, NAME " %p: expected %d blocks on buffer %d", this, + spa_log_error(this->log, "%p: expected %d blocks on buffer %d", this, port->blocks, i); return -EINVAL; } @@ -795,18 +797,18 @@ impl_node_port_use_buffers(void *object, if (size == SPA_ID_INVALID) size = d[j].maxsize; else if (size != d[j].maxsize) { - spa_log_error(this->log, NAME " %p: expected size %d on buffer %d", + spa_log_error(this->log, "%p: expected size %d on buffer %d", this, size, i); return -EINVAL; } if (d[j].data == NULL) { - spa_log_error(this->log, NAME " %p: invalid memory %d on buffer %d", + spa_log_error(this->log, "%p: invalid memory %d on buffer %d", this, j, i); return -EINVAL; } if (!SPA_IS_ALIGNED(d[j].data, MAX_ALIGN)) { - spa_log_warn(this->log, NAME " %p: memory %d on buffer %d not aligned", + spa_log_warn(this->log, "%p: memory %d on buffer %d not aligned", this, j, i); } b->datas[j] = d[j].data; @@ -823,7 +825,7 @@ impl_node_port_use_buffers(void *object, port->n_buffers = n_buffers; port->size = size; - spa_log_debug(this->log, NAME " %p: buffer size %d", this, size); + spa_log_debug(this->log, "%p: buffer size %d", this, size); return 0; } @@ -841,7 +843,7 @@ impl_node_port_set_io(void *object, port = GET_PORT(this, direction, port_id); - spa_log_debug(this->log, NAME " %p: port %d:%d update io %d %p", + spa_log_debug(this->log, "%p: port %d:%d update io %d %p", this, direction, port_id, id, data); switch (id) { @@ -861,7 +863,7 @@ static void recycle_buffer(struct impl *this, struct port *port, uint32_t id) if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) { spa_list_append(&port->queue, &b->link); SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); - spa_log_trace_fp(this->log, NAME " %p: recycle buffer %d", this, id); + spa_log_trace_fp(this->log, "%p: recycle buffer %d", this, id); } } @@ -912,12 +914,12 @@ static int impl_node_process(void *object) outio = outport->io; inio = inport->io; - spa_log_trace_fp(this->log, NAME " %p: io %p %p", this, inio, outio); + spa_log_trace_fp(this->log, "%p: io %p %p", this, inio, outio); spa_return_val_if_fail(outio != NULL, -EIO); spa_return_val_if_fail(inio != NULL, -EIO); - spa_log_trace_fp(this->log, NAME " %p: status %p %d %d -> %p %d %d", this, + spa_log_trace_fp(this->log, "%p: status %p %d %d -> %p %d %d", this, inio, inio->status, inio->buffer_id, outio, outio->status, outio->buffer_id); @@ -961,7 +963,7 @@ static int impl_node_process(void *object) maxsize = outb->datas[0].maxsize; n_samples = SPA_MIN(n_samples, maxsize / outport->stride); - spa_log_trace_fp(this->log, NAME " %p: n_src:%d n_dst:%d size:%d maxsize:%d n_samples:%d p:%d", + spa_log_trace_fp(this->log, "%p: n_src:%d n_dst:%d size:%d maxsize:%d n_samples:%d p:%d", this, n_src_datas, n_dst_datas, size, maxsize, n_samples, this->is_passthrough); @@ -1080,8 +1082,9 @@ impl_init(const struct spa_handle_factory *factory, this = (struct impl *) handle; this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); - this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); + spa_log_topic_init(this->log, log_topic); + this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); if (this->cpu) this->cpu_flags = spa_cpu_get_flags(this->cpu); diff --git a/spa/plugins/audioconvert/merger.c b/spa/plugins/audioconvert/merger.c index 8e4f2a041..d04d92e08 100644 --- a/spa/plugins/audioconvert/merger.c +++ b/spa/plugins/audioconvert/merger.c @@ -48,7 +48,9 @@ #include "volume-ops.h" #include "fmt-ops.h" -#define NAME "merger" +#undef SPA_LOG_TOPIC_DEFAULT +#define SPA_LOG_TOPIC_DEFAULT log_topic +static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.merger"); #define DEFAULT_RATE 48000 #define DEFAULT_CHANNELS 2 @@ -258,7 +260,7 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p port->format.info.dsp.format = SPA_AUDIO_FORMAT_DSP_F32; spa_list_init(&port->queue); - spa_log_debug(this->log, NAME " %p: add port %d:%d position:%s", + spa_log_debug(this->log, "%p: add port %d:%d position:%s", this, direction, port_id, port->position); emit_port_info(this, port, true); @@ -416,7 +418,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size) spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_debug(this->log, NAME " %p: io %d %p/%zd", this, id, data, size); + spa_log_debug(this->log, "%p: io %d %p/%zd", this, id, data, size); switch (id) { case SPA_IO_Position: @@ -544,7 +546,7 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags, if (this->have_profile && memcmp(&this->format, &info, sizeof(info)) == 0) return 0; - spa_log_debug(this->log, NAME " %p: port config %d/%d %d", this, + spa_log_debug(this->log, "%p: port config %d/%d %d", this, info.info.raw.rate, info.info.raw.channels, monitor); for (i = 0; i < this->port_count; i++) { @@ -632,7 +634,7 @@ impl_node_add_listener(void *object, spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_trace(this->log, NAME" %p: add listener %p", this, listener); + spa_log_trace(this->log, "%p: add listener %p", this, listener); spa_hook_list_isolate(&this->hooks, &save, listener, events, data); emit_node_info(this, true); @@ -845,7 +847,7 @@ impl_node_port_enum_params(void *object, int seq, static int clear_buffers(struct impl *this, struct port *port) { if (port->n_buffers > 0) { - spa_log_debug(this->log, NAME " %p: clear buffers %p", this, port); + spa_log_debug(this->log, "%p: clear buffers %p", this, port); port->n_buffers = 0; spa_list_init(&port->queue); } @@ -867,7 +869,7 @@ static int setup_convert(struct impl *this) src_fmt = SPA_AUDIO_FORMAT_DSP_F32; dst_fmt = outformat.info.raw.format; - spa_log_info(this->log, NAME " %p: %s/%d@%dx%d->%s/%d@%d", this, + spa_log_info(this->log, "%p: %s/%d@%dx%d->%s/%d@%d", this, spa_debug_type_find_name(spa_type_audio_format, src_fmt), 1, informat.info.raw.rate, @@ -883,7 +885,7 @@ static int setup_convert(struct impl *this) continue; this->src_remap[j] = i; this->dst_remap[i] = j; - spa_log_debug(this->log, NAME " %p: channel %d -> %d (%s -> %s)", this, + spa_log_debug(this->log, "%p: channel %d -> %d (%s -> %s)", this, i, j, spa_debug_type_find_short_name(spa_type_audio_channel, informat.info.raw.position[i]), @@ -904,7 +906,7 @@ static int setup_convert(struct impl *this) this->is_passthrough = this->conv.is_passthrough; - spa_log_debug(this->log, NAME " %p: got converter features %08x:%08x passthrough:%d", this, + spa_log_debug(this->log, "%p: got converter features %08x:%08x passthrough:%d", this, this->cpu_flags, this->conv.cpu_flags, this->is_passthrough); return 0; @@ -944,7 +946,7 @@ static int port_set_latency(void *object, enum spa_direction other = SPA_DIRECTION_REVERSE(direction); uint32_t i; - spa_log_debug(this->log, NAME " %p: set latency direction:%d", this, direction); + spa_log_debug(this->log, "%p: set latency direction:%d", this, direction); if (latency == NULL) { this->latency[other] = SPA_LATENCY_INFO(other); @@ -980,7 +982,7 @@ static int port_set_format(void *object, port = GET_PORT(this, direction, port_id); - spa_log_debug(this->log, NAME " %p: set format", this); + spa_log_debug(this->log, "%p: set format", this); if (format == NULL) { if (port->have_format) { @@ -1044,7 +1046,7 @@ static int port_set_format(void *object, } port->format = info; - spa_log_debug(this->log, NAME " %p: %d %d %d", this, + spa_log_debug(this->log, "%p: %d %d %d", this, port_id, port->stride, port->blocks); if (!PORT_IS_DSP(direction, port_id)) @@ -1097,7 +1099,7 @@ static void queue_buffer(struct impl *this, struct port *port, uint32_t id) { struct buffer *b = &port->buffers[id]; - spa_log_trace_fp(this->log, NAME " %p: queue buffer %d on port %d %d", + spa_log_trace_fp(this->log, "%p: queue buffer %d on port %d %d", this, id, port->id, b->flags); if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_QUEUED)) return; @@ -1116,7 +1118,7 @@ static struct buffer *dequeue_buffer(struct impl *this, struct port *port) b = spa_list_first(&port->queue, struct buffer, link); spa_list_remove(&b->link); SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_QUEUED); - spa_log_trace_fp(this->log, NAME " %p: dequeue buffer %d on port %d %u", + spa_log_trace_fp(this->log, "%p: dequeue buffer %d on port %d %u", this, b->id, port->id, b->flags); return b; @@ -1142,7 +1144,7 @@ impl_node_port_use_buffers(void *object, spa_return_val_if_fail(port->have_format, -EIO); - spa_log_debug(this->log, NAME " %p: use buffers %d on port %d:%d", + spa_log_debug(this->log, "%p: use buffers %d on port %d:%d", this, n_buffers, direction, port_id); clear_buffers(this, port); @@ -1158,19 +1160,19 @@ impl_node_port_use_buffers(void *object, b->buf = buffers[i]; if (n_datas != port->blocks) { - spa_log_error(this->log, NAME " %p: invalid blocks %d on buffer %d", + spa_log_error(this->log, "%p: invalid blocks %d on buffer %d", this, n_datas, i); return -EINVAL; } for (j = 0; j < n_datas; j++) { if (d[j].data == NULL) { - spa_log_error(this->log, NAME " %p: invalid memory %d on buffer %d %d %p", + spa_log_error(this->log, "%p: invalid memory %d on buffer %d %d %p", this, j, i, d[j].type, d[j].data); return -EINVAL; } if (!SPA_IS_ALIGNED(d[j].data, MAX_ALIGN)) { - spa_log_warn(this->log, NAME " %p: memory %d on buffer %d not aligned", + spa_log_warn(this->log, "%p: memory %d on buffer %d not aligned", this, j, i); } b->datas[j] = d[j].data; @@ -1197,7 +1199,7 @@ impl_node_port_set_io(void *object, spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_debug(this->log, NAME " %p: set io %d on port %d:%d %p", + spa_log_debug(this->log, "%p: set io %d on port %d:%d %p", this, id, direction, port_id, data); spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL); @@ -1234,13 +1236,13 @@ static inline int get_in_buffer(struct impl *this, struct port *port, struct buf struct spa_io_buffers *io; if ((io = port->io) == NULL) { - spa_log_trace_fp(this->log, NAME " %p: no io on port %d", + spa_log_trace_fp(this->log, "%p: no io on port %d", this, port->id); return -EIO; } if (io->status != SPA_STATUS_HAVE_DATA || io->buffer_id >= port->n_buffers) { - spa_log_trace_fp(this->log, NAME " %p: empty port %d %p %d %d %d", + spa_log_trace_fp(this->log, "%p: empty port %d %p %d %d %d", this, port->id, io, io->status, io->buffer_id, port->n_buffers); return -EPIPE; @@ -1316,7 +1318,7 @@ static int impl_node_process(void *object) spa_return_val_if_fail(outio != NULL, -EIO); spa_return_val_if_fail(this->conv.process != NULL, -EIO); - spa_log_trace_fp(this->log, NAME " %p: status %p %d %d", this, + spa_log_trace_fp(this->log, "%p: status %p %d %d", this, outio, outio->status, outio->buffer_id); if (SPA_UNLIKELY((res = get_out_buffer(this, outport, &dbuf)) != 0)) @@ -1353,7 +1355,7 @@ static int impl_node_process(void *object) n_samples = SPA_MIN(n_samples, sd->chunk->size / inport->stride); - spa_log_trace_fp(this->log, NAME " %p: %d %d %d %p", this, + spa_log_trace_fp(this->log, "%p: %d %d %d %p", this, sd->chunk->size, maxsize, n_samples, src_datas[i]); } @@ -1382,7 +1384,7 @@ static int impl_node_process(void *object) dd[i].chunk->size = n_samples * outport->stride; } - spa_log_trace_fp(this->log, NAME " %p: n_src:%d n_dst:%d n_samples:%d max:%d p:%d", this, + spa_log_trace_fp(this->log, "%p: n_src:%d n_dst:%d n_samples:%d max:%d p:%d", this, n_src_datas, n_dst_datas, n_samples, maxsize, this->is_passthrough); if (!this->is_passthrough) @@ -1458,8 +1460,9 @@ impl_init(const struct spa_handle_factory *factory, this = (struct impl *) handle; this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); - this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); + spa_log_topic_init(this->log, log_topic); + this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); if (this->cpu) this->cpu_flags = spa_cpu_get_flags(this->cpu); diff --git a/spa/plugins/audioconvert/resample.c b/spa/plugins/audioconvert/resample.c index d667c591a..d4a2cf3fb 100644 --- a/spa/plugins/audioconvert/resample.c +++ b/spa/plugins/audioconvert/resample.c @@ -41,7 +41,9 @@ #include "resample.h" -#define NAME "resample" +#undef SPA_LOG_TOPIC_DEFAULT +#define SPA_LOG_TOPIC_DEFAULT log_topic +static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.resample"); #define DEFAULT_RATE 48000 #define DEFAULT_CHANNELS 2 @@ -149,7 +151,7 @@ static int setup_convert(struct impl *this, dst_info = info; } - spa_log_info(this->log, NAME " %p: %s/%d@%d->%s/%d@%d", this, + spa_log_info(this->log, "%p: %s/%d@%d->%s/%d@%d", this, spa_debug_type_find_name(spa_type_audio_format, src_info->info.raw.format), src_info->info.raw.channels, src_info->info.raw.rate, @@ -232,7 +234,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size) spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_debug(this->log, NAME " %p: io %d %p/%zd", this, id, data, size); + spa_log_debug(this->log, "%p: io %d %p/%zd", this, id, data, size); switch (id) { case SPA_IO_Position: @@ -263,7 +265,7 @@ static void update_rate_match(struct impl *this, bool passthrough, uint32_t out_ } match_size -= SPA_MIN(match_size, in_queued); this->io_rate_match->size = match_size; - spa_log_trace_fp(this->log, NAME " %p: next match %u", this, match_size); + spa_log_trace_fp(this->log, "%p: next match %u", this, match_size); } else { resample_update_rate(&this->resample, this->rate_scale * this->props.rate); } @@ -544,7 +546,7 @@ impl_node_port_enum_params(void *object, int seq, static int clear_buffers(struct impl *this, struct port *port) { if (port->n_buffers > 0) { - spa_log_debug(this->log, NAME " %p: clear buffers %p", this, port); + spa_log_debug(this->log, "%p: clear buffers %p", this, port); port->n_buffers = 0; spa_list_init(&port->queue); } @@ -595,7 +597,7 @@ static int port_set_format(void *object, port->format = info; port->have_format = true; - spa_log_debug(this->log, NAME " %p: set format on port %d %d", this, port_id, res); + spa_log_debug(this->log, "%p: set format on port %d %d", this, port_id, res); } port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS; @@ -648,7 +650,7 @@ impl_node_port_use_buffers(void *object, spa_return_val_if_fail(port->have_format, -EIO); - spa_log_debug(this->log, NAME " %p: use buffers %d on port %d:%d", this, + spa_log_debug(this->log, "%p: use buffers %d on port %d:%d", this, n_buffers, direction, port_id); clear_buffers(this, port); @@ -668,13 +670,13 @@ impl_node_port_use_buffers(void *object, size = d[j].maxsize; else if (size != d[j].maxsize) { - spa_log_error(this->log, NAME " %p: invalid size %d on buffer %p", this, + spa_log_error(this->log, "%p: invalid size %d on buffer %p", this, size, buffers[i]); return -EINVAL; } if (d[j].data == NULL) { - spa_log_error(this->log, NAME " %p: invalid memory on buffer %p", this, + spa_log_error(this->log, "%p: invalid memory on buffer %p", this, buffers[i]); return -EINVAL; } @@ -705,7 +707,7 @@ impl_node_port_set_io(void *object, spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL); - spa_log_trace_fp(this->log, NAME " %p: %d:%d io %d", this, direction, port_id, id); + spa_log_trace_fp(this->log, "%p: %d:%d io %d", this, direction, port_id, id); port = GET_PORT(this, direction, port_id); @@ -730,7 +732,7 @@ static void recycle_buffer(struct impl *this, uint32_t id) if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) { spa_list_append(&port->queue, &b->link); SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT); - spa_log_trace_fp(this->log, NAME " %p: recycle buffer %d", this, id); + spa_log_trace_fp(this->log, "%p: recycle buffer %d", this, id); } } @@ -794,7 +796,7 @@ static int impl_node_process(void *object) spa_return_val_if_fail(outio != NULL, -EIO); spa_return_val_if_fail(inio != NULL, -EIO); - spa_log_trace_fp(this->log, NAME " %p: status %p %d %d -> %p %d %d", this, + spa_log_trace_fp(this->log, "%p: status %p %d %d -> %p %d %d", this, inio, inio->status, inio->buffer_id, outio, outio->status, outio->buffer_id); @@ -902,7 +904,7 @@ static int impl_node_process(void *object) } #ifndef FASTPATH - spa_log_trace_fp(this->log, NAME " %p: in %d/%d %zd %d out %d/%d %zd %d max:%d", + spa_log_trace_fp(this->log, "%p: in %d/%d %zd %d out %d/%d %zd %d max:%d", this, pin_len, in_len, size / sizeof(float), inport->offset, pout_len, out_len, maxsize / sizeof(float), outport->offset, max); @@ -916,7 +918,7 @@ static int impl_node_process(void *object) inport->offset += in_len * sizeof(float); if (inport->offset >= size || flush_in) { inio->status = SPA_STATUS_NEED_DATA; - spa_log_trace_fp(this->log, NAME" %p: return input buffer of %zd samples", + spa_log_trace_fp(this->log, "%p: return input buffer of %zd samples", this, size / sizeof(float)); inport->offset = 0; size = 0; @@ -927,7 +929,7 @@ static int impl_node_process(void *object) if (outport->offset > 0 && (outport->offset >= maxsize || flush_out)) { outio->status = SPA_STATUS_HAVE_DATA; outio->buffer_id = dbuf->id; - spa_log_trace_fp(this->log, NAME" %p: have output buffer of %zd samples", + spa_log_trace_fp(this->log, "%p: have output buffer of %zd samples", this, outport->offset / sizeof(float)); dequeue_buffer(this, dbuf); outport->offset = 0; @@ -938,7 +940,7 @@ static int impl_node_process(void *object) outio->status = SPA_STATUS_HAVE_DATA; outio->buffer_id = SPA_ID_INVALID; SPA_FLAG_SET(res, SPA_STATUS_HAVE_DATA); - spa_log_trace_fp(this->log, NAME " %p: no output buffer", this); + spa_log_trace_fp(this->log, "%p: no output buffer", this); } update_rate_match(this, passthrough, max - outport->offset / sizeof(float), @@ -1021,8 +1023,9 @@ impl_init(const struct spa_handle_factory *factory, this = (struct impl *) handle; this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); - this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); + spa_log_topic_init(this->log, log_topic); + this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); if (this->cpu) this->resample.cpu_flags = spa_cpu_get_flags(this->cpu); diff --git a/spa/plugins/audioconvert/splitter.c b/spa/plugins/audioconvert/splitter.c index b5c5ca2af..296364fff 100644 --- a/spa/plugins/audioconvert/splitter.c +++ b/spa/plugins/audioconvert/splitter.c @@ -45,7 +45,9 @@ #include "fmt-ops.h" -#define NAME "splitter" +#undef SPA_LOG_TOPIC_DEFAULT +#define SPA_LOG_TOPIC_DEFAULT log_topic +static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.splitter"); #define DEFAULT_RATE 48000 #define DEFAULT_CHANNELS 2 @@ -203,7 +205,7 @@ static int init_port(struct impl *this, enum spa_direction direction, port->format.media_subtype = SPA_MEDIA_SUBTYPE_dsp; port->format.info.dsp.format = SPA_AUDIO_FORMAT_DSP_F32; - spa_log_debug(this->log, NAME " %p: init port %d:%d position:%s", + spa_log_debug(this->log, "%p: init port %d:%d position:%s", this, direction, port_id, port->position); emit_port_info(this, port, true); @@ -253,7 +255,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size) spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_debug(this->log, NAME " %p: io %d %p/%zd", this, id, data, size); + spa_log_debug(this->log, "%p: io %d %p/%zd", this, id, data, size); switch (id) { case SPA_IO_Position: @@ -327,7 +329,7 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags, if (this->have_profile && memcmp(&this->format, &info, sizeof(info)) == 0) return 0; - spa_log_debug(this->log, NAME " %p: port config %d/%d", this, + spa_log_debug(this->log, "%p: port config %d/%d", this, info.info.raw.rate, info.info.raw.channels); for (i = 0; i < this->port_count; i++) @@ -600,7 +602,7 @@ impl_node_port_enum_params(void *object, int seq, static int clear_buffers(struct impl *this, struct port *port) { if (port->n_buffers > 0) { - spa_log_debug(this->log, NAME " %p: clear buffers %p", this, port); + spa_log_debug(this->log, "%p: clear buffers %p", this, port); port->n_buffers = 0; spa_list_init(&port->queue); } @@ -622,7 +624,7 @@ static int setup_convert(struct impl *this) src_fmt = informat.info.raw.format; dst_fmt = SPA_AUDIO_FORMAT_DSP_F32; - spa_log_info(this->log, NAME " %p: %s/%d@%d->%s/%d@%dx%d", this, + spa_log_info(this->log, "%p: %s/%d@%d->%s/%d@%dx%d", this, spa_debug_type_find_name(spa_type_audio_format, src_fmt), informat.info.raw.channels, informat.info.raw.rate, @@ -638,7 +640,7 @@ static int setup_convert(struct impl *this) continue; this->src_remap[i] = j; this->dst_remap[j] = i; - spa_log_debug(this->log, NAME " %p: channel %d -> %d (%s -> %s)", this, + spa_log_debug(this->log, "%p: channel %d -> %d (%s -> %s)", this, i, j, spa_debug_type_find_short_name(spa_type_audio_channel, informat.info.raw.position[i]), @@ -659,7 +661,7 @@ static int setup_convert(struct impl *this) this->is_passthrough &= this->conv.is_passthrough; - spa_log_debug(this->log, NAME " %p: got converter features %08x:%08x passthrough:%d", this, + spa_log_debug(this->log, "%p: got converter features %08x:%08x passthrough:%d", this, this->cpu_flags, this->conv.cpu_flags, this->is_passthrough); return 0; @@ -699,7 +701,7 @@ static int port_set_latency(void *object, enum spa_direction other = SPA_DIRECTION_REVERSE(direction); uint32_t i; - spa_log_debug(this->log, NAME " %p: set latency direction:%d", this, direction); + spa_log_debug(this->log, "%p: set latency direction:%d", this, direction); if (latency == NULL) { this->latency[other] = SPA_LATENCY_INFO(other); @@ -735,7 +737,7 @@ static int port_set_format(void *object, port = GET_PORT(this, direction, port_id); - spa_log_debug(this->log, NAME " %p: set format", this); + spa_log_debug(this->log, "%p: set format", this); if (format == NULL) { if (port->have_format) { @@ -784,7 +786,7 @@ static int port_set_format(void *object, port->format = info; - spa_log_debug(this->log, NAME " %p: %d %d %d", this, port_id, port->stride, port->blocks); + spa_log_debug(this->log, "%p: %d %d %d", this, port_id, port->stride, port->blocks); if (direction == SPA_DIRECTION_INPUT) if ((res = setup_convert(this)) < 0) @@ -835,7 +837,7 @@ static void queue_buffer(struct impl *this, struct port *port, uint32_t id) { struct buffer *b = &port->buffers[id]; - spa_log_trace_fp(this->log, NAME " %p: queue buffer %d on port %d %d", + spa_log_trace_fp(this->log, "%p: queue buffer %d on port %d %d", this, id, port->id, b->flags); if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_QUEUED)) return; @@ -854,7 +856,7 @@ static struct buffer *dequeue_buffer(struct impl *this, struct port *port) b = spa_list_first(&port->queue, struct buffer, link); spa_list_remove(&b->link); SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_QUEUED); - spa_log_trace_fp(this->log, NAME " %p: dequeue buffer %d on port %d %u", + spa_log_trace_fp(this->log, "%p: dequeue buffer %d on port %d %u", this, b->id, port->id, b->flags); return b; @@ -879,7 +881,7 @@ impl_node_port_use_buffers(void *object, spa_return_val_if_fail(port->have_format, -EIO); - spa_log_debug(this->log, NAME " %p: use buffers %d on port %d", this, n_buffers, port_id); + spa_log_debug(this->log, "%p: use buffers %d on port %d", this, n_buffers, port_id); clear_buffers(this, port); @@ -895,12 +897,12 @@ impl_node_port_use_buffers(void *object, for (j = 0; j < n_datas; j++) { if (d[j].data == NULL) { - spa_log_error(this->log, NAME " %p: invalid memory %d on buffer %d %d %p", + spa_log_error(this->log, "%p: invalid memory %d on buffer %d %d %p", this, j, i, d[j].type, d[j].data); return -EINVAL; } if (!SPA_IS_ALIGNED(d[j].data, MAX_ALIGN)) { - spa_log_warn(this->log, NAME " %p: memory %d on buffer %d not aligned", + spa_log_warn(this->log, "%p: memory %d on buffer %d not aligned", this, j, i); } b->datas[j] = d[j].data; @@ -908,7 +910,7 @@ impl_node_port_use_buffers(void *object, !SPA_FLAG_IS_SET(d[j].flags, SPA_DATA_FLAG_DYNAMIC)) this->is_passthrough = false; - spa_log_debug(this->log, NAME " %p: buffer %d data %d flags:%08x %p", + spa_log_debug(this->log, "%p: buffer %d data %d flags:%08x %p", this, i, j, d[j].flags, b->datas[j]); } @@ -977,7 +979,7 @@ static int impl_node_process(void *object) spa_return_val_if_fail(inio != NULL, -EIO); spa_return_val_if_fail(this->conv.process != NULL, -EIO); - spa_log_trace_fp(this->log, NAME " %p: status %p %d %d", this, + spa_log_trace_fp(this->log, "%p: status %p %d %d", this, inio, inio->status, inio->buffer_id); if (SPA_UNLIKELY(inio->status != SPA_STATUS_HAVE_DATA)) @@ -1012,7 +1014,7 @@ static int impl_node_process(void *object) if (SPA_UNLIKELY((outio = outport->io) == NULL)) goto empty; - spa_log_trace_fp(this->log, NAME " %p: %d %p %d %d %d", this, i, + spa_log_trace_fp(this->log, "%p: %d %p %d %d %d", this, i, outio, outio->status, outio->buffer_id, outport->stride); if (SPA_UNLIKELY(outio->status == SPA_STATUS_HAVE_DATA)) @@ -1026,7 +1028,7 @@ static int impl_node_process(void *object) if (SPA_UNLIKELY((dbuf = dequeue_buffer(this, outport)) == NULL)) { outio->status = -EPIPE; empty: - spa_log_trace_fp(this->log, NAME" %p: %d skip output", this, i); + spa_log_trace_fp(this->log, "%p: %d skip output", this, i); dst_datas[dst_remap] = SPA_PTR_ALIGN(this->empty, MAX_ALIGN, void); continue; } @@ -1048,7 +1050,7 @@ static int impl_node_process(void *object) outio->buffer_id = dbuf->id; } - spa_log_trace_fp(this->log, NAME " %p: n_src:%d n_dst:%d n_samples:%d max:%d stride:%d p:%d", this, + spa_log_trace_fp(this->log, "%p: n_src:%d n_dst:%d n_samples:%d max:%d stride:%d p:%d", this, n_src_datas, n_dst_datas, n_samples, maxsize, inport->stride, this->is_passthrough); @@ -1128,8 +1130,9 @@ impl_init(const struct spa_handle_factory *factory, this = (struct impl *) handle; this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); - this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); + spa_log_topic_init(this->log, log_topic); + this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); if (this->cpu) this->cpu_flags = spa_cpu_get_flags(this->cpu); diff --git a/spa/plugins/audiomixer/audiomixer.c b/spa/plugins/audiomixer/audiomixer.c index 5ff1d6f24..a4b8b924e 100644 --- a/spa/plugins/audiomixer/audiomixer.c +++ b/spa/plugins/audiomixer/audiomixer.c @@ -41,7 +41,9 @@ #include "mix-ops.h" -#define NAME "audiomixer" +#undef SPA_LOG_TOPIC_DEFAULT +#define SPA_LOG_TOPIC_DEFAULT log_topic +static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.audiomixer"); #define MAX_SAMPLES 8192 #define MAX_BUFFERS 64 @@ -269,7 +271,7 @@ static int impl_node_add_port(void *object, enum spa_direction direction, uint32 this->last_port = port_id + 1; port->valid = true; - spa_log_debug(this->log, NAME " %p: add port %d:%d %d", this, + spa_log_debug(this->log, "%p: add port %d:%d %d", this, direction, port_id, this->last_port); emit_port_info(this, port, true); @@ -304,7 +306,7 @@ impl_node_remove_port(void *object, enum spa_direction direction, uint32_t port_ this->last_port = i + 1; } - spa_log_debug(this->log, NAME " %p: remove port %d:%d %d", this, + spa_log_debug(this->log, "%p: remove port %d:%d %d", this, direction, port_id, this->last_port); spa_node_emit_port_info(&this->hooks, direction, port_id, NULL); @@ -460,7 +462,7 @@ impl_node_port_enum_params(void *object, int seq, static int clear_buffers(struct impl *this, struct port *port) { if (port->n_buffers > 0) { - spa_log_debug(this->log, NAME " %p: clear buffers %p", this, port); + spa_log_debug(this->log, "%p: clear buffers %p", this, port); port->n_buffers = 0; spa_list_init(&port->queue); } @@ -474,7 +476,7 @@ static int queue_buffer(struct impl *this, struct port *port, struct buffer *b) spa_list_append(&port->queue, &b->link); SPA_FLAG_SET(b->flags, BUFFER_FLAG_QUEUED); - spa_log_trace_fp(this->log, NAME " %p: queue buffer %d", this, b->id); + spa_log_trace_fp(this->log, "%p: queue buffer %d", this, b->id); return 0; } @@ -488,7 +490,7 @@ static struct buffer *dequeue_buffer(struct impl *this, struct port *port) b = spa_list_first(&port->queue, struct buffer, link); spa_list_remove(&b->link); SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_QUEUED); - spa_log_trace_fp(this->log, NAME " %p: dequeue buffer %d", this, b->id); + spa_log_trace_fp(this->log, "%p: dequeue buffer %d", this, b->id); return b; } @@ -575,7 +577,7 @@ static int port_set_format(void *object, if (!port->have_format) { this->n_formats++; port->have_format = true; - spa_log_debug(this->log, NAME " %p: set format on port %d", + spa_log_debug(this->log, "%p: set format on port %d", this, port_id); } } @@ -625,7 +627,7 @@ impl_node_port_use_buffers(void *object, spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_debug(this->log, NAME " %p: use %d buffers on port %d:%d", + spa_log_debug(this->log, "%p: use %d buffers on port %d:%d", this, n_buffers, direction, port_id); spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL); @@ -647,17 +649,17 @@ impl_node_port_use_buffers(void *object, b->h = spa_buffer_find_meta_data(buffers[i], SPA_META_Header, sizeof(*b->h)); if (d[0].data == NULL) { - spa_log_error(this->log, NAME " %p: invalid memory on buffer %p", this, + spa_log_error(this->log, "%p: invalid memory on buffer %p", this, buffers[i]); return -EINVAL; } if (!SPA_IS_ALIGNED(d[0].data, 16)) { - spa_log_warn(this->log, NAME " %p: memory on buffer %d not aligned", this, i); + spa_log_warn(this->log, "%p: memory on buffer %d not aligned", this, i); } if (direction == SPA_DIRECTION_OUTPUT) queue_buffer(this, port, b); - spa_log_debug(this->log, NAME " %p: port %d:%d buffer:%d n_data:%d data:%p maxsize:%d", + spa_log_debug(this->log, "%p: port %d:%d buffer:%d n_data:%d data:%p maxsize:%d", this, direction, port_id, i, buffers[i]->n_datas, d[0].data, d[0].maxsize); } @@ -676,7 +678,7 @@ impl_node_port_set_io(void *object, spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_debug(this->log, NAME " %p: port %d:%d io %d %p/%zd", this, + spa_log_debug(this->log, "%p: port %d:%d io %d %p/%zd", this, direction, port_id, id, data, size); spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL); @@ -724,7 +726,7 @@ static int impl_node_process(void *object) outio = outport->io; spa_return_val_if_fail(outio != NULL, -EIO); - spa_log_trace_fp(this->log, NAME " %p: status %p %d %d", + spa_log_trace_fp(this->log, "%p: status %p %d %d", this, outio, outio->status, outio->buffer_id); if (SPA_UNLIKELY(outio->status == SPA_STATUS_HAVE_DATA)) @@ -751,7 +753,7 @@ static int impl_node_process(void *object) (inio = inport->io) == NULL || inio->buffer_id >= inport->n_buffers || inio->status != SPA_STATUS_HAVE_DATA)) { - spa_log_trace_fp(this->log, NAME " %p: skip input idx:%d valid:%d " + spa_log_trace_fp(this->log, "%p: skip input idx:%d valid:%d " "io:%p status:%d buf_id:%d n_buffers:%d", this, i, inport->valid, inio, inio ? inio->status : -1, @@ -763,7 +765,7 @@ static int impl_node_process(void *object) inb = &inport->buffers[inio->buffer_id]; maxsize = SPA_MIN(inb->buffer->datas[0].chunk->size, maxsize); - spa_log_trace_fp(this->log, NAME " %p: mix input %d %p->%p %d %d %d", this, + spa_log_trace_fp(this->log, "%p: mix input %d %p->%p %d %d %d", this, i, inio, outio, inio->status, inio->buffer_id, maxsize); datas[n_buffers] = inb->buffer->datas[0].data; @@ -773,7 +775,7 @@ static int impl_node_process(void *object) outb = dequeue_buffer(this, outport); if (SPA_UNLIKELY(outb == NULL)) { - spa_log_trace(this->log, NAME " %p: out of buffers", this); + spa_log_trace(this->log, "%p: out of buffers", this); return -EPIPE; } @@ -874,8 +876,9 @@ impl_init(const struct spa_handle_factory *factory, this = (struct impl *) handle; this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); - this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); + spa_log_topic_init(this->log, log_topic); + this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); if (this->cpu) this->cpu_flags = spa_cpu_get_flags(this->cpu); diff --git a/spa/plugins/audiomixer/mixer-dsp.c b/spa/plugins/audiomixer/mixer-dsp.c index 95f28da4b..2da3e0884 100644 --- a/spa/plugins/audiomixer/mixer-dsp.c +++ b/spa/plugins/audiomixer/mixer-dsp.c @@ -41,7 +41,9 @@ #include "mix-ops.h" -#define NAME "mixer-dsp" +#undef SPA_LOG_TOPIC_DEFAULT +#define SPA_LOG_TOPIC_DEFAULT log_topic +static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.mixer-dsp"); #define MAX_BUFFERS 64 #define MAX_PORTS 128 @@ -266,7 +268,7 @@ static int impl_node_add_port(void *object, enum spa_direction direction, uint32 this->last_port = port_id + 1; port->valid = true; - spa_log_debug(this->log, NAME " %p: add port %d:%d %d", this, + spa_log_debug(this->log, "%p: add port %d:%d %d", this, direction, port_id, this->last_port); emit_port_info(this, port, true); @@ -301,7 +303,7 @@ impl_node_remove_port(void *object, enum spa_direction direction, uint32_t port_ this->last_port = i + 1; } - spa_log_debug(this->log, NAME " %p: remove port %d:%d %d", this, + spa_log_debug(this->log, "%p: remove port %d:%d %d", this, direction, port_id, this->last_port); spa_node_emit_port_info(&this->hooks, direction, port_id, NULL); @@ -440,7 +442,7 @@ next: static int clear_buffers(struct impl *this, struct port *port) { if (port->n_buffers > 0) { - spa_log_debug(this->log, NAME " %p: clear buffers %p", this, port); + spa_log_debug(this->log, "%p: clear buffers %p", this, port); port->n_buffers = 0; spa_list_init(&port->queue); } @@ -454,7 +456,7 @@ static int queue_buffer(struct impl *this, struct port *port, struct buffer *b) spa_list_append(&port->queue, &b->link); SPA_FLAG_SET(b->flags, BUFFER_FLAG_QUEUED); - spa_log_trace_fp(this->log, NAME " %p: queue buffer %d", this, b->id); + spa_log_trace_fp(this->log, "%p: queue buffer %d", this, b->id); return 0; } @@ -468,7 +470,7 @@ static struct buffer *dequeue_buffer(struct impl *this, struct port *port) b = spa_list_first(&port->queue, struct buffer, link); spa_list_remove(&b->link); SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_QUEUED); - spa_log_trace_fp(this->log, NAME " %p: dequeue buffer %d", this, b->id); + spa_log_trace_fp(this->log, "%p: dequeue buffer %d", this, b->id); return b; } @@ -522,7 +524,7 @@ static int port_set_format(void *object, if (!port->have_format) { this->n_formats++; port->have_format = true; - spa_log_debug(this->log, NAME " %p: set format on port %d:%d", + spa_log_debug(this->log, "%p: set format on port %d:%d", this, direction, port_id); } } @@ -572,7 +574,7 @@ impl_node_port_use_buffers(void *object, spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_debug(this->log, NAME " %p: use %d buffers on port %d:%d", + spa_log_debug(this->log, "%p: use %d buffers on port %d:%d", this, n_buffers, direction, port_id); spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL); @@ -594,16 +596,16 @@ impl_node_port_use_buffers(void *object, b->h = spa_buffer_find_meta_data(buffers[i], SPA_META_Header, sizeof(*b->h)); if (d[0].data == NULL) { - spa_log_error(this->log, NAME " %p: invalid memory on buffer %d", this, i); + spa_log_error(this->log, "%p: invalid memory on buffer %d", this, i); return -EINVAL; } if (!SPA_IS_ALIGNED(d[0].data, 16)) { - spa_log_warn(this->log, NAME " %p: memory on buffer %d not aligned", this, i); + spa_log_warn(this->log, "%p: memory on buffer %d not aligned", this, i); } if (direction == SPA_DIRECTION_OUTPUT) queue_buffer(this, port, b); - spa_log_debug(this->log, NAME " %p: port %d:%d buffer:%d n_data:%d data:%p maxsize:%d", + spa_log_debug(this->log, "%p: port %d:%d buffer:%d n_data:%d data:%p maxsize:%d", this, direction, port_id, i, buffers[i]->n_datas, d[0].data, d[0].maxsize); } @@ -622,7 +624,7 @@ impl_node_port_set_io(void *object, spa_return_val_if_fail(this != NULL, -EINVAL); - spa_log_debug(this->log, NAME " %p: port %d:%d io %d %p/%zd", this, + spa_log_debug(this->log, "%p: port %d:%d io %d %p/%zd", this, direction, port_id, id, data, size); spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL); @@ -670,7 +672,7 @@ static int impl_node_process(void *object) outio = outport->io; spa_return_val_if_fail(outio != NULL, -EIO); - spa_log_trace_fp(this->log, NAME " %p: status %p %d %d", + spa_log_trace_fp(this->log, "%p: status %p %d %d", this, outio, outio->status, outio->buffer_id); if (SPA_UNLIKELY(outio->status == SPA_STATUS_HAVE_DATA)) @@ -697,7 +699,7 @@ static int impl_node_process(void *object) (inio = inport->io) == NULL || inio->buffer_id >= inport->n_buffers || inio->status != SPA_STATUS_HAVE_DATA)) { - spa_log_trace_fp(this->log, NAME " %p: skip input idx:%d valid:%d " + spa_log_trace_fp(this->log, "%p: skip input idx:%d valid:%d " "io:%p status:%d buf_id:%d n_buffers:%d", this, i, inport->valid, inio, inio ? inio->status : -1, @@ -709,7 +711,7 @@ static int impl_node_process(void *object) inb = &inport->buffers[inio->buffer_id]; maxsize = SPA_MIN(inb->buffer->datas[0].chunk->size, maxsize); - spa_log_trace_fp(this->log, NAME " %p: mix input %d %p->%p %d %d %d", this, + spa_log_trace_fp(this->log, "%p: mix input %d %p->%p %d %d %d", this, i, inio, outio, inio->status, inio->buffer_id, maxsize); datas[n_buffers] = inb->buffer->datas[0].data; @@ -719,7 +721,7 @@ static int impl_node_process(void *object) outb = dequeue_buffer(this, outport); if (SPA_UNLIKELY(outb == NULL)) { - spa_log_trace(this->log, NAME " %p: out of buffers", this); + spa_log_trace(this->log, "%p: out of buffers", this); return -EPIPE; } @@ -812,8 +814,9 @@ impl_init(const struct spa_handle_factory *factory, this = (struct impl *) handle; this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); - this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); + spa_log_topic_init(this->log, log_topic); + this->cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU); if (this->cpu) this->cpu_flags = spa_cpu_get_flags(this->cpu);