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

@ -20,7 +20,9 @@
#include <spa/pod/filter.h>
#include <spa/debug/types.h>
#define NAME "test-source"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.test-source");
#define DEFAULT_RATE 44100
#define DEFAULT_CHANNELS 2
@ -135,7 +137,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_info(this, true);
@ -494,7 +496,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);
}
@ -571,7 +573,7 @@ static int port_set_format(void *object,
port->have_format = true;
port->format = info;
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;
@ -599,7 +601,7 @@ impl_node_port_set_param(void *object,
spa_return_val_if_fail(object != NULL, -EINVAL);
spa_return_val_if_fail(CHECK_PORT(object, direction, port_id), -EINVAL);
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:
@ -616,7 +618,7 @@ static void recycle_buffer(struct impl *this, struct port *port, struct buffer *
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, b->id);
spa_log_trace_fp(this->log, "%p: recycle buffer %d", this, b->id);
}
}
@ -637,7 +639,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);
@ -659,12 +661,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);
}
}
@ -742,7 +744,7 @@ static int impl_node_process(void *object)
if ((io = port->io) == NULL)
return -EIO;
spa_log_trace_fp(this->log, NAME " %p: status %d", this, io->status);
spa_log_trace_fp(this->log, "%p: status %d", this, io->status);
if (io->status == SPA_STATUS_HAVE_DATA)
goto done;
@ -839,7 +841,7 @@ impl_init(const struct spa_handle_factory *factory,
spa_atou32(s, &this->quantum_limit, 0);
}
spa_log_debug(this->log, NAME " %p: init", this);
spa_log_debug(this->log, "%p: init", this);
spa_hook_list_init(&this->hooks);
this->node.iface = SPA_INTERFACE_INIT(

View file

@ -25,7 +25,9 @@
#include <spa/pod/filter.h>
#include <spa/control/control.h>
#define NAME "audiotestsrc"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.audiotestsrc");
#define SAMPLES_TO_TIME(this,s) ((s) * SPA_NSEC_PER_SEC / (port)->current_format.info.raw.rate)
#define BYTES_TO_SAMPLES(this,b) ((b)/(port)->bpf)
@ -338,7 +340,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));
}
}
@ -369,7 +371,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);
@ -382,7 +384,7 @@ static int make_buffer(struct impl *this)
n_bytes = maxsize;
spa_log_trace(this->log, NAME " %p: dequeue buffer %d %d %d", this, b->id,
spa_log_trace(this->log, "%p: dequeue buffer %d %d %d", this, b->id,
maxsize, n_bytes);
filled = 0;
@ -704,7 +706,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_info(this->log, NAME " %p: clear buffers", this);
spa_log_info(this->log, "%p: clear buffers", this);
port->n_buffers = 0;
spa_list_init(&port->empty);
this->started = false;
@ -837,7 +839,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;
}
@ -882,7 +884,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);
@ -1102,7 +1104,7 @@ impl_init(const struct spa_handle_factory *factory,
port->info.n_params = 5;
spa_list_init(&port->empty);
spa_log_info(this->log, NAME " %p: initialized", this);
spa_log_info(this->log, "%p: initialized", this);
return 0;
}
@ -1141,7 +1143,7 @@ static const struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
const struct spa_handle_factory spa_audiotestsrc_factory = {
SPA_VERSION_HANDLE_FACTORY,
NAME,
"audiotestsrc",
&info,
impl_get_size,
impl_init,

View file

@ -5,9 +5,12 @@
#include <errno.h>
#include <spa/support/plugin.h>
#include <spa/support/log.h>
extern const struct spa_handle_factory spa_audiotestsrc_factory;
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
{

View file

@ -21,7 +21,9 @@
#include <spa/control/control.h>
#include <spa/pod/filter.h>
#define NAME "control-mixer"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.control-mixer");
#define MAX_BUFFERS 64
#define MAX_PORTS 512
@ -226,7 +228,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", this, port_id, this->last_port);
spa_log_debug(this->log, "%p: add port %d %d", this, port_id, this->last_port);
emit_port_info(this, port, true);
return 0;
@ -260,7 +262,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", this, port_id, this->last_port);
spa_log_debug(this->log, "%p: remove port %d %d", this, port_id, this->last_port);
spa_node_emit_port_info(&this->hooks, direction, port_id, NULL);
@ -371,7 +373,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);
}
@ -385,7 +387,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;
}
@ -399,7 +401,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;
}
@ -438,7 +440,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);
}
}
@ -491,7 +493,7 @@ impl_node_port_use_buffers(void *object,
port = GET_PORT(this, direction, port_id);
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);
spa_return_val_if_fail(!this->started || port->io == NULL, -EIO);
@ -513,7 +515,7 @@ impl_node_port_use_buffers(void *object,
b->id = i;
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 (direction == SPA_DIRECTION_OUTPUT)
@ -548,7 +550,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);
@ -634,7 +636,7 @@ static int impl_node_process(void *object)
if ((outio = outport->io) == NULL)
return -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 (outio->status == SPA_STATUS_HAVE_DATA)
@ -649,7 +651,7 @@ static int impl_node_process(void *object)
/* get output buffer */
if ((outb = dequeue_buffer(this, outport)) == NULL) {
if (outport->n_buffers > 0)
spa_log_warn(this->log, NAME " %p: out of buffers (%d)",
spa_log_warn(this->log, "%p: out of buffers (%d)",
this, outport->n_buffers);
return -EPIPE;
}
@ -668,7 +670,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,
@ -677,20 +679,20 @@ static int impl_node_process(void *object)
continue;
}
spa_log_trace_fp(this->log, NAME " %p: mix input %d %p->%p %d %d", this,
spa_log_trace_fp(this->log, "%p: mix input %d %p->%p %d %d", this,
i, inio, outio, inio->status, inio->buffer_id);
d = inport->buffers[inio->buffer_id].buffer->datas;
if ((pod = spa_pod_from_data(d->data, d->maxsize,
d->chunk->offset, d->chunk->size)) == NULL) {
spa_log_trace_fp(this->log, NAME " %p: skip input idx:%d max:%u "
spa_log_trace_fp(this->log, "%p: skip input idx:%d max:%u "
"offset:%u size:%u", this, i,
d->maxsize, d->chunk->offset, d->chunk->size);
continue;
}
if (!spa_pod_is_sequence(pod)) {
spa_log_trace_fp(this->log, NAME " %p: skip input idx:%d", this, i);
spa_log_trace_fp(this->log, "%p: skip input idx:%d", this, i);
continue;
}

View file

@ -5,9 +5,12 @@
#include <errno.h>
#include <spa/support/plugin.h>
#include <spa/support/log.h>
extern const struct spa_handle_factory spa_control_mixer_factory;
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
{

View file

@ -20,6 +20,10 @@
#include "ffmpeg.h"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.ffmpeg.dec");
#define IS_VALID_PORT(this,d,id) ((id) == 0)
#define GET_IN_PORT(this,p) (&this->in_ports[p])
#define GET_OUT_PORT(this,p) (&this->out_ports[p])

View file

@ -19,6 +19,10 @@
#include "ffmpeg.h"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.ffmpeg.enc");
#define IS_VALID_PORT(this,d,id) ((id) == 0)
#define GET_IN_PORT(this,p) (&this->in_ports[p])
#define GET_OUT_PORT(this,p) (&this->out_ports[p])

View file

@ -6,6 +6,7 @@
#include <stdio.h>
#include <spa/support/plugin.h>
#include <spa/support/log.h>
#include <spa/node/node.h>
#include <libavcodec/avcodec.h>
@ -104,6 +105,8 @@ static const AVCodec *find_codec_by_index(uint32_t index)
}
#endif
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
{

View file

@ -28,7 +28,9 @@
#include "jack-client.h"
#define NAME "jack-device"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.jack-device");
#define MAX_DEVICES 64
@ -108,7 +110,7 @@ static int activate_profile(struct impl *this, uint32_t id)
res = spa_jack_client_open(&this->client, "PipeWire", NULL);
if (res < 0) {
spa_log_error(this->log, NAME" %p: can't open client: %s",
spa_log_error(this->log, "%p: can't open client: %s",
this, spa_strerror(res));
return res;
}

View file

@ -27,7 +27,9 @@
#include "jack-client.h"
#define NAME "jack-sink"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.jack-sink");
#define MAX_PORTS 128
#define MAX_BUFFERS 8
@ -404,7 +406,7 @@ static int init_ports(struct impl *this)
NULL, JACK_DEFAULT_AUDIO_TYPE,
JackPortIsPhysical|JackPortIsInput);
if (ports == NULL) {
spa_log_error(this->log, NAME" %p: can't enumerate ports", this);
spa_log_error(this->log, "%p: can't enumerate ports", this);
res = -ENODEV;
goto exit;
}
@ -421,7 +423,7 @@ static int init_ports(struct impl *this)
jack_port_type(p),
JackPortIsOutput, 0);
if (port->jack_port == NULL) {
spa_log_error(this->log, NAME" %p: jack_port_register() %d (%s) failed",
spa_log_error(this->log, "%p: jack_port_register() %d (%s) failed",
this, i, ports[i]);
res = -EFAULT;
goto exit_free;
@ -452,7 +454,7 @@ static int init_ports(struct impl *this)
for (i = 0; ports[i]; i++) {
struct port *port = GET_IN_PORT(this, i);
if (jack_connect(client, jack_port_name(port->jack_port), ports[i])) {
spa_log_warn(this->log, NAME" %p: Failed to connect %s to %s",
spa_log_warn(this->log, "%p: Failed to connect %s to %s",
this, jack_port_name(port->jack_port), ports[i]);
}
}
@ -591,7 +593,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;
this->started = false;
}
@ -739,7 +741,7 @@ static int impl_node_process(void *object)
uint32_t i;
int res = 0;
spa_log_trace(this->log, NAME" %p: process %d", this, this->n_in_ports);
spa_log_trace(this->log, "%p: process %d", this, this->n_in_ports);
for (i = 0; i < this->n_in_ports; i++) {
struct port *port = GET_IN_PORT(this, i);
@ -758,7 +760,7 @@ static int impl_node_process(void *object)
continue;
}
spa_log_trace(this->log, NAME" %p: port %d: buffer %d", this, i, io->buffer_id);
spa_log_trace(this->log, "%p: port %d: buffer %d", this, i, io->buffer_id);
b = &port->buffers[io->buffer_id];
src = &b->outbuf->datas[0];
@ -840,7 +842,7 @@ impl_init(const struct spa_handle_factory *factory,
sscanf(str, "pointer:%p", &this->client);
if (this->client == NULL) {
spa_log_error(this->log, NAME" %p: missing "SPA_KEY_API_JACK_CLIENT
spa_log_error(this->log, "%p: missing "SPA_KEY_API_JACK_CLIENT
" property", this);
return -EINVAL;
}

View file

@ -27,7 +27,9 @@
#include "jack-client.h"
#define NAME "jack-source"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.jack-source");
#define MAX_PORTS 128
#define MAX_BUFFERS 8
@ -209,7 +211,7 @@ static inline void reuse_buffer(struct impl *this, struct port *port, uint32_t i
struct buffer *b = &port->buffers[id];
if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) {
spa_log_trace(this->log, NAME " %p: reuse buffer %d", this, id);
spa_log_trace(this->log, "%p: reuse buffer %d", this, id);
SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT);
spa_list_append(&port->empty, &b->link);
}
@ -404,7 +406,7 @@ static int init_ports(struct impl *this)
NULL, JACK_DEFAULT_AUDIO_TYPE,
JackPortIsPhysical|JackPortIsOutput);
if (ports == NULL) {
spa_log_error(this->log, NAME" %p: can't enumerate ports", this);
spa_log_error(this->log, "%p: can't enumerate ports", this);
res = -ENODEV;
goto exit;
}
@ -421,7 +423,7 @@ static int init_ports(struct impl *this)
jack_port_type(p),
JackPortIsInput, 0);
if (port->jack_port == NULL) {
spa_log_error(this->log, NAME" %p: jack_port_register() %d (%s) failed",
spa_log_error(this->log, "%p: jack_port_register() %d (%s) failed",
this, i, ports[i]);
res = -EFAULT;
goto exit_free;
@ -452,7 +454,7 @@ static int init_ports(struct impl *this)
for (i = 0; ports[i]; i++) {
struct port *port = GET_OUT_PORT(this, i);
if (jack_connect(client, ports[i], jack_port_name(port->jack_port))) {
spa_log_warn(this->log, NAME" %p: Failed to connect %s to %s",
spa_log_warn(this->log, "%p: Failed to connect %s to %s",
this, jack_port_name(port->jack_port), ports[i]);
}
}
@ -591,7 +593,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;
@ -753,7 +755,7 @@ static int impl_node_process(void *object)
uint32_t i;
int res = 0;
spa_log_trace(this->log, NAME" %p: process %d", this, this->n_out_ports);
spa_log_trace(this->log, "%p: process %d", this, this->n_out_ports);
for (i = 0; i < this->n_out_ports; i++) {
struct port *port = GET_OUT_PORT(this, i);
@ -772,7 +774,7 @@ static int impl_node_process(void *object)
}
if ((b = dequeue_buffer(this, port)) == NULL) {
spa_log_trace(this->log, NAME" %p: out of buffers", this);
spa_log_trace(this->log, "%p: out of buffers", this);
io->status = -EPIPE;
continue;
}
@ -865,7 +867,7 @@ impl_init(const struct spa_handle_factory *factory,
sscanf(str, "pointer:%p", &this->client);
if (this->client == NULL) {
spa_log_error(this->log, NAME" %p: missing "SPA_KEY_API_JACK_CLIENT
spa_log_error(this->log, "%p: missing "SPA_KEY_API_JACK_CLIENT
" property", this);
return -EINVAL;
}

View file

@ -5,11 +5,14 @@
#include <errno.h>
#include <spa/support/plugin.h>
#include <spa/support/log.h>
extern const struct spa_handle_factory spa_jack_device_factory;
extern const struct spa_handle_factory spa_jack_source_factory;
extern const struct spa_handle_factory spa_jack_sink_factory;
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
{

View file

@ -558,6 +558,8 @@ static const struct spa_handle_factory dbus_factory = {
impl_enum_interface_info,
};
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
{

View file

@ -6,9 +6,12 @@
#include <stdio.h>
#include <spa/support/plugin.h>
#include <spa/support/log.h>
extern const struct spa_handle_factory spa_support_evl_system_factory;
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
{

View file

@ -24,7 +24,9 @@
#include <spa/utils/result.h>
#include <spa/utils/string.h>
#define NAME "evl-system"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.evl-system");
#define MAX_POLL 512
@ -465,11 +467,11 @@ impl_init(const struct spa_handle_factory *factory,
impl->pid = getpid();
if ((res = evl_init()) < 0) {
spa_log_error(impl->log, NAME " %p: init failed: %s", impl, spa_strerror(res));
spa_log_error(impl->log, "%p: init failed: %s", impl, spa_strerror(res));
return res;
}
spa_log_info(impl->log, NAME " %p: initialized", impl);
spa_log_info(impl->log, "%p: initialized", impl);
return 0;
}

View file

@ -21,7 +21,9 @@
#include <systemd/sd-journal.h>
#define NAME "journal"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.journal");
#define DEFAULT_LOG_LEVEL SPA_LOG_LEVEL_INFO
@ -250,7 +252,7 @@ impl_init(const struct spa_handle_factory *factory,
else
impl->chain_log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
spa_log_debug(&impl->log, NAME " %p: initialized", impl);
spa_log_debug(&impl->log, "%p: initialized", impl);
return 0;
}
@ -289,6 +291,7 @@ static const struct spa_handle_factory journal_factory = {
.enum_interface_info = impl_enum_interface_info,
};
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)

View file

@ -24,7 +24,9 @@
#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
#endif
#define NAME "logger"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.logger");
#define DEFAULT_LOG_LEVEL SPA_LOG_LEVEL_INFO
@ -357,7 +359,7 @@ impl_init(const struct spa_handle_factory *factory,
spa_ringbuffer_init(&this->trace_rb);
spa_log_debug(&this->log, NAME " %p: initialized to %s linebuf:%u", this, dest, linebuf);
spa_log_debug(&this->log, "%p: initialized to %s linebuf:%u", this, dest, linebuf);
return 0;
}

View file

@ -29,7 +29,9 @@
#include <spa/pod/filter.h>
#include <spa/control/control.h>
#define NAME "null-audio-sink"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.null-audio-sink");
#define DEFAULT_CLOCK_NAME "clock.system.monotonic"
@ -227,7 +229,7 @@ static int reassign_follower(struct impl *this)
following = is_following(this);
if (following != this->following) {
spa_log_debug(this->log, NAME" %p: reassign follower %d->%d", this, this->following, following);
spa_log_debug(this->log, "%p: reassign follower %d->%d", this, this->following, following);
this->following = following;
spa_loop_invoke(this->data_loop, do_set_timers, 0, NULL, 0, true, this);
}
@ -274,7 +276,7 @@ static void on_timeout(struct spa_source *source)
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));
return;
}
@ -573,7 +575,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_info(this->log, NAME " %p: clear buffers", this);
spa_log_info(this->log, "%p: clear buffers", this);
port->n_buffers = 0;
this->started = false;
}
@ -728,7 +730,7 @@ impl_node_port_use_buffers(void *object,
b->outbuf = buffers[i];
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;
}
@ -994,7 +996,7 @@ impl_init(const struct spa_handle_factory *factory,
if (this->props.n_pos > 0)
this->props.channels = this->props.n_pos;
spa_log_info(this->log, NAME " %p: initialized", this);
spa_log_info(this->log, "%p: initialized", this);
return 0;
}

View file

@ -22,7 +22,9 @@
#include <spa/pod/parser.h>
#include <spa/pod/filter.h>
#define NAME "fakesink"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.fakesink");
struct props {
bool live;
@ -205,7 +207,7 @@ static inline 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));
}
}
@ -231,7 +233,7 @@ static int consume_buffer(struct impl *this)
spa_node_call_ready(&this->callbacks, SPA_STATUS_NEED_DATA);
}
if (spa_list_is_empty(&port->ready)) {
spa_log_error(this->log, NAME " %p: no buffers", this);
spa_log_error(this->log, "%p: no buffers", this);
return -EPIPE;
}
@ -240,7 +242,7 @@ static int consume_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);
render_buffer(this, b);
@ -505,7 +507,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->ready);
this->started = false;
@ -583,7 +585,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]);
}
}
@ -635,13 +637,13 @@ static int impl_node_process(void *object)
struct buffer *b = &port->buffers[io->buffer_id];
if (!b->outstanding) {
spa_log_warn(this->log, NAME " %p: buffer %u in use", this,
spa_log_warn(this->log, "%p: buffer %u in use", this,
io->buffer_id);
io->status = -EINVAL;
return -EINVAL;
}
spa_log_trace(this->log, NAME " %p: queue buffer %u", this, io->buffer_id);
spa_log_trace(this->log, "%p: queue buffer %u", this, io->buffer_id);
spa_list_append(&port->ready, &b->link);
b->outstanding = false;
@ -818,7 +820,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
const struct spa_handle_factory spa_fakesink_factory = {
SPA_VERSION_HANDLE_FACTORY,
NAME,
"fakesink",
NULL,
impl_get_size,
impl_init,

View file

@ -22,7 +22,9 @@
#include <spa/pod/parser.h>
#include <spa/pod/filter.h>
#define NAME "fakesrc"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.fakesrc");
struct props {
bool live;
@ -220,7 +222,7 @@ static inline 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));
}
}
@ -240,7 +242,7 @@ static int make_buffer(struct impl *this)
if (spa_list_is_empty(&port->empty)) {
set_timer(this, false);
this->underrun = true;
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);
@ -249,7 +251,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);
@ -518,7 +520,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;
@ -595,7 +597,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]);
}
spa_list_append(&port->empty, &b->link);
@ -633,7 +635,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);
@ -848,7 +850,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
const struct spa_handle_factory spa_fakesrc_factory = {
SPA_VERSION_HANDLE_FACTORY,
NAME,
"fakesrc",
NULL,
impl_get_size,
impl_init,

View file

@ -5,10 +5,13 @@
#include <errno.h>
#include <spa/support/plugin.h>
#include <spa/support/log.h>
extern const struct spa_handle_factory spa_fakesrc_factory;
extern const struct spa_handle_factory spa_fakesink_factory;
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
{

View file

@ -23,7 +23,9 @@
#include "v4l2.h"
#define NAME "v4l2-device"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.v4l2-device");
static const char default_device[] = "/dev/video0";

View file

@ -5,9 +5,12 @@
#include <errno.h>
#include <spa/support/plugin.h>
#include <spa/support/log.h>
extern const struct spa_handle_factory spa_videotestsrc_factory;
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
{

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,

View file

@ -5,9 +5,12 @@
#include <errno.h>
#include <spa/support/plugin.h>
#include <spa/support/log.h>
extern const struct spa_handle_factory spa_volume_factory;
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
{

View file

@ -17,7 +17,9 @@
#include <spa/param/param.h>
#include <spa/pod/filter.h>
#define NAME "volume"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.volume");
#define DEFAULT_RATE 48000
#define DEFAULT_CHANNELS 2
@ -417,7 +419,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);
}
@ -529,7 +531,7 @@ impl_node_port_use_buffers(void *object,
b->ptr = d[0].data;
b->size = d[0].maxsize;
} else {
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;
}
@ -572,13 +574,13 @@ static void recycle_buffer(struct impl *this, uint32_t id)
struct buffer *b = &port->buffers[id];
if (!SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUT)) {
spa_log_warn(this->log, NAME " %p: buffer %d not outstanding", this, id);
spa_log_warn(this->log, "%p: buffer %d not outstanding", this, id);
return;
}
spa_list_append(&port->empty, &b->link);
SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_OUT);
spa_log_trace(this->log, NAME " %p: recycle buffer %d", this, id);
spa_log_trace(this->log, "%p: recycle buffer %d", this, id);
}
static int impl_node_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
@ -695,13 +697,13 @@ static int impl_node_process(void *object)
}
if ((dbuf = find_free_buffer(this, out_port)) == NULL) {
spa_log_error(this->log, NAME " %p: out of buffers", this);
spa_log_error(this->log, "%p: out of buffers", this);
return -EPIPE;
}
sbuf = &in_port->buffers[input->buffer_id];
spa_log_trace(this->log, NAME " %p: do volume %d -> %d", this, sbuf->id, dbuf->id);
spa_log_trace(this->log, "%p: do volume %d -> %d", this, sbuf->id, dbuf->id);
do_volume(this, dbuf->outbuf, sbuf->outbuf);
output->buffer_id = dbuf->id;
@ -866,7 +868,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
const struct spa_handle_factory spa_volume_factory = {
SPA_VERSION_HANDLE_FACTORY,
NAME,
"volume",
NULL,
impl_get_size,
impl_init,

View file

@ -5,12 +5,15 @@
#include <errno.h>
#include <spa/support/plugin.h>
#include <spa/support/log.h>
extern const struct spa_handle_factory spa_vulkan_compute_filter_factory;
extern const struct spa_handle_factory spa_vulkan_compute_source_factory;
extern const struct spa_handle_factory spa_vulkan_blit_filter_factory;
extern const struct spa_handle_factory spa_vulkan_blit_dsp_filter_factory;
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
{