mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-21 08:56:56 -05:00
spa: use log topics everywhere
Use log topics properly everywhere, convert from "#define NAME".
This commit is contained in:
parent
c963ca47c1
commit
e784de3933
27 changed files with 170 additions and 102 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue