spa: use log topics everywhere

Use log topics properly everywhere, convert from "#define NAME".
This commit is contained in:
Pauli Virtanen 2024-03-10 17:32:56 +02:00
parent c963ca47c1
commit e784de3933
27 changed files with 170 additions and 102 deletions

View file

@ -23,7 +23,9 @@
#include <spa/param/param.h>
#include <spa/pod/filter.h>
#define NAME "videotestsrc"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.videotestsrc");
#define FRAMES_TO_TIME(port,f) ((port->current_format.info.raw.framerate.denom * (f) * SPA_NSEC_PER_SEC) / \
(port->current_format.info.raw.framerate.num))
@ -289,7 +291,7 @@ static int read_timer(struct impl *this)
if ((res = spa_system_timerfd_read(this->data_system,
this->timer_source.fd, &expirations)) < 0) {
if (res != -EAGAIN)
spa_log_error(this->log, NAME " %p: timerfd error: %s",
spa_log_error(this->log, "%p: timerfd error: %s",
this, spa_strerror(res));
}
}
@ -308,7 +310,7 @@ static int make_buffer(struct impl *this)
if (spa_list_is_empty(&port->empty)) {
set_timer(this, false);
spa_log_error(this->log, NAME " %p: out of buffers", this);
spa_log_error(this->log, "%p: out of buffers", this);
return -EPIPE;
}
b = spa_list_first(&port->empty, struct buffer, link);
@ -317,7 +319,7 @@ static int make_buffer(struct impl *this)
n_bytes = b->outbuf->datas[0].maxsize;
spa_log_trace(this->log, NAME " %p: dequeue buffer %d", this, b->id);
spa_log_trace(this->log, "%p: dequeue buffer %d", this, b->id);
fill_buffer(this, b);
@ -612,7 +614,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", this);
spa_log_debug(this->log, "%p: clear buffers", this);
port->n_buffers = 0;
spa_list_init(&port->empty);
this->started = false;
@ -729,7 +731,7 @@ 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;
}
@ -769,7 +771,7 @@ static inline void reuse_buffer(struct impl *this, struct port *port, uint32_t i
struct buffer *b = &port->buffers[id];
spa_return_if_fail(b->outstanding);
spa_log_trace(this->log, NAME " %p: reuse buffer %d", this, id);
spa_log_trace(this->log, "%p: reuse buffer %d", this, id);
b->outstanding = false;
spa_list_append(&port->empty, &b->link);
@ -990,7 +992,7 @@ static const struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
const struct spa_handle_factory spa_videotestsrc_factory = {
SPA_VERSION_HANDLE_FACTORY,
NAME,
"videotestsrc",
&info,
impl_get_size,
impl_init,