mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
spa: use log topics
This commit is contained in:
parent
eabd00e012
commit
c8c4923fcb
9 changed files with 204 additions and 176 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue