mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
small cleanups
This commit is contained in:
parent
5833b7b2a7
commit
170c3e4d6c
4 changed files with 49 additions and 48 deletions
|
|
@ -91,7 +91,6 @@ struct impl {
|
|||
struct spa_node *resample;
|
||||
|
||||
struct spa_hook listener[4];
|
||||
unsigned int listening:1;
|
||||
};
|
||||
|
||||
static int make_link(struct impl *this,
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@
|
|||
#include "modules/spa/spa-node.h"
|
||||
#include "client-node.h"
|
||||
|
||||
#define NAME "client-node"
|
||||
|
||||
/** \cond */
|
||||
|
||||
#define MAX_INPUTS 64
|
||||
|
|
@ -237,7 +239,7 @@ static struct mem *ensure_mem(struct impl *impl, int fd, uint32_t type, uint32_t
|
|||
m->flags = flags;
|
||||
m->ref = 0;
|
||||
|
||||
pw_log_debug("client-node %p: add mem %d", impl, m->id);
|
||||
pw_log_debug(NAME " %p: add mem %d", impl, m->id);
|
||||
|
||||
pw_client_node_resource_add_mem(impl->node.resource,
|
||||
m->id,
|
||||
|
|
@ -246,7 +248,7 @@ static struct mem *ensure_mem(struct impl *impl, int fd, uint32_t type, uint32_t
|
|||
m->flags);
|
||||
found:
|
||||
m->ref++;
|
||||
pw_log_debug("client-node %p: mem %d, ref %d", impl, m->id, m->ref);
|
||||
pw_log_debug(NAME " %p: mem %d, ref %d", impl, m->id, m->ref);
|
||||
return m;
|
||||
}
|
||||
|
||||
|
|
@ -364,12 +366,12 @@ static int clear_buffers(struct node *this, struct mix *mix)
|
|||
id = SPA_PTR_TO_UINT32(b->buffer.datas[j].data);
|
||||
m = pw_array_get_unchecked(&impl->mems, id, struct mem);
|
||||
m->ref--;
|
||||
pw_log_debug("client-node %p: mem %d, ref %d", impl, m->id, m->ref);
|
||||
pw_log_debug(NAME " %p: mem %d, ref %d", impl, m->id, m->ref);
|
||||
}
|
||||
}
|
||||
m = pw_array_get_unchecked(&impl->mems, b->memid, struct mem);
|
||||
m->ref--;
|
||||
pw_log_debug("client-node %p: mem %d, ref %d", impl, m->id, m->ref);
|
||||
pw_log_debug(NAME " %p: mem %d, ref %d", impl, m->id, m->ref);
|
||||
}
|
||||
mix->n_buffers = 0;
|
||||
return 0;
|
||||
|
|
@ -419,7 +421,7 @@ static int impl_node_enum_params(void *object, int seq,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) != 0)
|
||||
continue;
|
||||
|
||||
pw_log_debug("client-node %p: %d param %u", this, seq, result.index);
|
||||
pw_log_debug(NAME " %p: %d param %u", this, seq, result.index);
|
||||
spa_node_emit_result(&this->hooks, seq, 0, SPA_RESULT_TYPE_NODE_PARAMS, &result);
|
||||
|
||||
if (++count == num)
|
||||
|
|
@ -498,7 +500,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
|
|||
if (this->resource == NULL)
|
||||
return -EIO;
|
||||
|
||||
pw_log_debug("client-node %p: send command %d", this, SPA_COMMAND_TYPE(command));
|
||||
pw_log_debug(NAME " %p: send command %d", this, SPA_COMMAND_TYPE(command));
|
||||
return pw_client_node_resource_command(this->resource, command);
|
||||
}
|
||||
|
||||
|
|
@ -556,7 +558,7 @@ impl_node_sync(void *object, int seq)
|
|||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
|
||||
pw_log_debug("client-node %p: sync", this);
|
||||
pw_log_debug(NAME " %p: sync", this);
|
||||
if (this->resource == NULL)
|
||||
return -EIO;
|
||||
|
||||
|
|
@ -688,7 +690,7 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
||||
pw_log_debug("client-node %p: %d port %d.%d %u %u %u", this, seq,
|
||||
pw_log_debug(NAME " %p: %d port %d.%d %u %u %u", this, seq,
|
||||
direction, port_id, id, start, num);
|
||||
|
||||
result.id = id;
|
||||
|
|
@ -710,7 +712,7 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
continue;
|
||||
|
||||
pw_log_debug("client-node %p: %d param %u", this, seq, result.index);
|
||||
pw_log_debug(NAME " %p: %d param %u", this, seq, result.index);
|
||||
spa_node_emit_result(&this->hooks, seq, 0, SPA_RESULT_TYPE_NODE_PARAMS, &result);
|
||||
|
||||
if (++count == num)
|
||||
|
|
@ -755,7 +757,7 @@ static int do_port_set_io(struct impl *impl,
|
|||
struct port *port;
|
||||
struct mix *mix;
|
||||
|
||||
pw_log_debug("client-node %p: %s port %d.%d set io %p %zd", impl,
|
||||
pw_log_debug(NAME " %p: %s port %d.%d set io %p %zd", impl,
|
||||
direction == SPA_DIRECTION_INPUT ? "input" : "output",
|
||||
port_id, mix_id, data, size);
|
||||
|
||||
|
|
@ -826,7 +828,7 @@ do_port_use_buffers(struct impl *impl,
|
|||
uint32_t i, j;
|
||||
struct pw_client_node_buffer *mb;
|
||||
|
||||
spa_log_debug(this->log, "client-node %p: %s port %d.%d use buffers %p %u", impl,
|
||||
spa_log_debug(this->log, NAME " %p: %s port %d.%d use buffers %p %u", impl,
|
||||
direction == SPA_DIRECTION_INPUT ? "input" : "output",
|
||||
port_id, mix_id, buffers, n_buffers);
|
||||
|
||||
|
|
@ -1236,7 +1238,7 @@ static void client_node_resource_destroy(void *data)
|
|||
struct pw_client_node *this = &impl->this;
|
||||
struct node *node = &impl->node;
|
||||
|
||||
pw_log_debug("client-node %p: destroy", impl);
|
||||
pw_log_debug(NAME " %p: destroy", impl);
|
||||
|
||||
impl->node.resource = this->resource = NULL;
|
||||
spa_hook_remove(&impl->resource_listener);
|
||||
|
|
@ -1260,7 +1262,7 @@ static void client_node_resource_error(void *data, int seq, int res, const char
|
|||
struct node *this = &impl->node;
|
||||
struct spa_result_node_error result;
|
||||
|
||||
pw_log_error("client-node %p: error seq:%d %d (%s)", this, seq, res, message);
|
||||
pw_log_error(NAME " %p: error seq:%d %d (%s)", this, seq, res, message);
|
||||
result.message = message;
|
||||
spa_node_emit_result(&this->hooks, seq, res, SPA_RESULT_TYPE_NODE_ERROR, &result);
|
||||
}
|
||||
|
|
@ -1270,7 +1272,7 @@ static void client_node_resource_pong(void *data, int seq)
|
|||
struct impl *impl = data;
|
||||
struct node *this = &impl->node;
|
||||
|
||||
pw_log_debug("client-node %p: got pong, emit result %d", this, seq);
|
||||
pw_log_debug(NAME " %p: got pong, emit result %d", this, seq);
|
||||
spa_node_emit_result(&this->hooks, seq, 0, 0, NULL);
|
||||
}
|
||||
|
||||
|
|
@ -1281,7 +1283,7 @@ void pw_client_node_registered(struct pw_client_node *this, struct pw_global *gl
|
|||
uint32_t node_id = global->id;
|
||||
struct mem *m;
|
||||
|
||||
pw_log_debug("client-node %p: %d", this, node_id);
|
||||
pw_log_debug(NAME " %p: %d", this, node_id);
|
||||
pw_client_node_resource_transport(this->resource,
|
||||
node_id,
|
||||
impl->other_fds[0],
|
||||
|
|
@ -1289,7 +1291,7 @@ void pw_client_node_registered(struct pw_client_node *this, struct pw_global *gl
|
|||
|
||||
m = ensure_mem(impl, node->activation->fd, SPA_DATA_MemFd, node->activation->flags);
|
||||
if (m == NULL) {
|
||||
pw_log_debug("client-node %p: can't ensure mem: %m", this);
|
||||
pw_log_debug(NAME " %p: can't ensure mem: %m", this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1326,7 +1328,7 @@ static void node_initialized(void *data)
|
|||
impl->other_fds[1] = impl->fds[0];
|
||||
|
||||
spa_loop_add_source(impl->node.data_loop, &impl->node.data_source);
|
||||
pw_log_debug("client-node %p: transport fd %d %d", node, impl->fds[0], impl->fds[1]);
|
||||
pw_log_debug(NAME " %p: transport fd %d %d", node, impl->fds[0], impl->fds[1]);
|
||||
|
||||
size = sizeof(struct spa_io_buffers) * MAX_AREAS;
|
||||
|
||||
|
|
@ -1337,7 +1339,7 @@ static void node_initialized(void *data)
|
|||
&impl->io_areas) < 0)
|
||||
return;
|
||||
|
||||
pw_log_debug("client-node %p: io areas %p", node, impl->io_areas->ptr);
|
||||
pw_log_debug(NAME " %p: io areas %p", node, impl->io_areas->ptr);
|
||||
|
||||
if ((global = pw_node_get_global(node)) != NULL)
|
||||
pw_client_node_registered(this, global);
|
||||
|
|
@ -1348,7 +1350,7 @@ static void node_free(void *data)
|
|||
struct impl *impl = data;
|
||||
struct spa_system *data_system = impl->node.data_system;
|
||||
|
||||
pw_log_debug("client-node %p: free", &impl->this);
|
||||
pw_log_debug(NAME " %p: free", &impl->this);
|
||||
node_clear(&impl->node);
|
||||
|
||||
spa_hook_remove(&impl->node_listener);
|
||||
|
|
@ -1384,7 +1386,7 @@ static int port_init_mix(void *data, struct pw_port_mix *mix)
|
|||
mix->io->buffer_id = SPA_ID_INVALID;
|
||||
mix->io->status = SPA_STATUS_NEED_BUFFER;
|
||||
|
||||
pw_log_debug("client-node %p: init mix io %d %p %p", impl, mix->id, mix->io,
|
||||
pw_log_debug(NAME " %p: init mix io %d %p %p", impl, mix->id, mix->io,
|
||||
impl->io_areas->ptr);
|
||||
|
||||
return 0;
|
||||
|
|
@ -1397,7 +1399,7 @@ static int port_release_mix(void *data, struct pw_port_mix *mix)
|
|||
struct node *this = &impl->node;
|
||||
struct mix *m;
|
||||
|
||||
pw_log_debug("client-node %p: remove mix io %d %p %p", impl, mix->id, mix->io,
|
||||
pw_log_debug(NAME " %p: remove mix io %d %p %p", impl, mix->id, mix->io,
|
||||
impl->io_areas->ptr);
|
||||
|
||||
if ((m = find_mix(port, mix->port.port_id)) == NULL || !m->valid)
|
||||
|
|
@ -1441,7 +1443,7 @@ impl_mix_add_port(void *object, enum spa_direction direction, uint32_t mix_id,
|
|||
const struct spa_dict *props)
|
||||
{
|
||||
struct port *port = object;
|
||||
pw_log_debug("client-node %p: add port %d:%d.%d", object, direction, port->id, mix_id);
|
||||
pw_log_debug(NAME " %p: add port %d:%d.%d", object, direction, port->id, mix_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1449,7 +1451,7 @@ static int
|
|||
impl_mix_remove_port(void *object, enum spa_direction direction, uint32_t mix_id)
|
||||
{
|
||||
struct port *port = object;
|
||||
pw_log_debug("client-node %p: remove port %d:%d.%d", object, direction, port->id, mix_id);
|
||||
pw_log_debug(NAME " %p: remove port %d:%d.%d", object, direction, port->id, mix_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1534,7 +1536,7 @@ static void node_port_init(void *data, struct pw_port *port)
|
|||
struct port *p = pw_port_get_user_data(port);
|
||||
struct node *this = &impl->node;
|
||||
|
||||
pw_log_debug("client-node %p: port %p init", &impl->this, port);
|
||||
pw_log_debug(NAME " %p: port %p init", &impl->this, port);
|
||||
|
||||
*p = this->dummy;
|
||||
p->port = port;
|
||||
|
|
@ -1577,7 +1579,7 @@ static void node_port_removed(void *data, struct pw_port *port)
|
|||
struct node *this = &impl->node;
|
||||
struct port *p = pw_port_get_user_data(port);
|
||||
|
||||
pw_log_debug("client-node %p: port %p remove", &impl->this, port);
|
||||
pw_log_debug(NAME " %p: port %p remove", &impl->this, port);
|
||||
|
||||
p->removed = true;
|
||||
clear_port(this, p);
|
||||
|
|
@ -1594,11 +1596,11 @@ static void node_peer_added(void *data, struct pw_node *peer)
|
|||
|
||||
m = ensure_mem(impl, peer->activation->fd, SPA_DATA_MemFd, peer->activation->flags);
|
||||
if (m == NULL) {
|
||||
pw_log_debug("client-node %p: can't ensure mem: %m", this);
|
||||
pw_log_debug(NAME " %p: can't ensure mem: %m", this);
|
||||
return;
|
||||
}
|
||||
|
||||
pw_log_debug("client-node %p: peer %p %u added %u", &impl->this, peer,
|
||||
pw_log_debug(NAME " %p: peer %p %u added %u", &impl->this, peer,
|
||||
peer->info.id, m->id);
|
||||
|
||||
pw_client_node_resource_set_activation(this->resource,
|
||||
|
|
@ -1653,7 +1655,7 @@ static const struct pw_resource_events resource_events = {
|
|||
static int process_node(void *data)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
pw_log_trace_fp("client-node %p: process", impl);
|
||||
pw_log_trace_fp(NAME " %p: process", impl);
|
||||
return spa_node_process((struct spa_node*)&impl->node.node);
|
||||
}
|
||||
|
||||
|
|
@ -1692,7 +1694,7 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
|||
|
||||
impl->core = core;
|
||||
impl->fds[0] = impl->fds[1] = -1;
|
||||
pw_log_debug("client-node %p: new", impl);
|
||||
pw_log_debug(NAME " %p: new", impl);
|
||||
|
||||
support = pw_core_get_support(impl->core, &n_support);
|
||||
node_init(&impl->node, NULL, support, n_support);
|
||||
|
|
@ -1704,7 +1706,7 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
|||
pw_array_init(&impl->mems, 64);
|
||||
|
||||
if ((name = pw_properties_get(properties, PW_KEY_NODE_NAME)) == NULL)
|
||||
name = "client-node";
|
||||
name = NAME;
|
||||
|
||||
this->resource = resource;
|
||||
this->parent = parent;
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ static void try_link_controls(struct impl *impl)
|
|||
target = pw_node_find_port(impl->this.node, impl->direction, 0);
|
||||
|
||||
if (target == NULL) {
|
||||
pw_log_warn("client-stream %p: can't link controls", &impl->this);
|
||||
pw_log_warn(NAME " %p: can't link controls", &impl->this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -968,7 +968,7 @@ static void client_node_initialized(void *data)
|
|||
struct spa_dict_item items[1];
|
||||
const struct pw_node_info *info;
|
||||
|
||||
pw_log_debug("client-stream %p: initialized", &impl->this);
|
||||
pw_log_debug(NAME " %p: initialized", &impl->this);
|
||||
|
||||
info = pw_node_get_info(impl->client_node->node);
|
||||
if (info == NULL)
|
||||
|
|
@ -983,7 +983,7 @@ static void client_node_initialized(void *data)
|
|||
dir = "Output";
|
||||
}
|
||||
|
||||
pw_log_debug("client-stream %p: in %d/%d out %d/%d -> %s", &impl->this,
|
||||
pw_log_debug(NAME " %p: in %d/%d out %d/%d -> %s", &impl->this,
|
||||
info->n_input_ports, info->max_input_ports,
|
||||
info->n_output_ports, info->max_output_ports,
|
||||
dir);
|
||||
|
|
@ -1021,7 +1021,7 @@ static void client_node_initialized(void *data)
|
|||
impl->direction, 0,
|
||||
SPA_PARAM_EnumFormat, &state,
|
||||
NULL, &format, &b)) != 1) {
|
||||
pw_log_warn("client-stream %p: no format given", &impl->this);
|
||||
pw_log_warn(NAME " %p: no format given", &impl->this);
|
||||
impl->adapter = impl->cnode;
|
||||
impl->adapter_mix = impl->client_port->mix;
|
||||
impl->adapter_mix_port = 0;
|
||||
|
|
@ -1034,7 +1034,7 @@ static void client_node_initialized(void *data)
|
|||
if (spa_format_parse(format, &media_type, &media_subtype) < 0)
|
||||
return;
|
||||
|
||||
pw_log_debug("client-stream %p: %s/%s", &impl->this,
|
||||
pw_log_debug(NAME " %p: %s/%s", &impl->this,
|
||||
spa_debug_type_find_name(spa_type_media_type, media_type),
|
||||
spa_debug_type_find_name(spa_type_media_subtype, media_subtype));
|
||||
|
||||
|
|
@ -1114,7 +1114,7 @@ static void client_node_initialized(void *data)
|
|||
|
||||
static void cleanup(struct impl *impl)
|
||||
{
|
||||
pw_log_debug("client-stream %p: cleanup", &impl->this);
|
||||
pw_log_debug(NAME " %p: cleanup", &impl->this);
|
||||
if (impl->use_converter) {
|
||||
if (impl->handle)
|
||||
pw_unload_spa_handle(impl->handle);
|
||||
|
|
@ -1129,7 +1129,7 @@ static void cleanup(struct impl *impl)
|
|||
static void client_node_destroy(void *data)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
pw_log_debug("client-stream %p: destroy", &impl->this);
|
||||
pw_log_debug(NAME " %p: destroy", &impl->this);
|
||||
|
||||
pw_node_set_driver(impl->client_node->node, NULL);
|
||||
|
||||
|
|
@ -1141,7 +1141,7 @@ static void client_node_destroy(void *data)
|
|||
static void client_node_free(void *data)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
pw_log_debug("client-stream %p: free", &impl->this);
|
||||
pw_log_debug(NAME " %p: free", &impl->this);
|
||||
spa_hook_remove(&impl->client_node_listener);
|
||||
cleanup(impl);
|
||||
}
|
||||
|
|
@ -1150,7 +1150,7 @@ static void client_node_result(void *data, int seq, int res, uint32_t type, cons
|
|||
{
|
||||
struct impl *impl = data;
|
||||
struct node *node = &impl->node;
|
||||
pw_log_debug("client-stream %p: result %d %d", &impl->this, seq, res);
|
||||
pw_log_debug(NAME " %p: result %d %d", &impl->this, seq, res);
|
||||
spa_node_emit_result(&node->hooks, seq, res, type, result);
|
||||
}
|
||||
|
||||
|
|
@ -1158,7 +1158,7 @@ static void client_node_active_changed(void *data, bool active)
|
|||
{
|
||||
struct impl *impl = data;
|
||||
|
||||
pw_log_debug("client-stream %p: active %d", &impl->this, active);
|
||||
pw_log_debug(NAME " %p: active %d", &impl->this, active);
|
||||
impl->active = active;
|
||||
}
|
||||
|
||||
|
|
@ -1167,7 +1167,7 @@ static void client_node_info_changed(void *data, const struct pw_node_info *info
|
|||
struct impl *impl = data;
|
||||
struct pw_client_stream *this = &impl->this;
|
||||
|
||||
pw_log_debug("client-stream %p: info changed", this);
|
||||
pw_log_debug(NAME " %p: info changed", this);
|
||||
|
||||
if (this->node)
|
||||
pw_node_update_properties(this->node, info->props);
|
||||
|
|
@ -1186,14 +1186,14 @@ static const struct pw_node_events client_node_events = {
|
|||
static void node_destroy(void *data)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
pw_log_debug("client-stream %p: destroy", &impl->this);
|
||||
pw_log_debug(NAME " %p: destroy", &impl->this);
|
||||
spa_hook_remove(&impl->client_node_listener);
|
||||
}
|
||||
|
||||
static void node_free(void *data)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
pw_log_debug("client-stream %p: free", &impl->this);
|
||||
pw_log_debug(NAME " %p: free", &impl->this);
|
||||
pw_client_node_destroy(impl->client_node);
|
||||
spa_hook_remove(&impl->node_listener);
|
||||
cleanup(impl);
|
||||
|
|
@ -1216,7 +1216,7 @@ static const struct pw_node_events node_events = {
|
|||
static int node_ready(void *data, int status)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
pw_log_trace_fp("client-stream %p: ready %d", &impl->this, status);
|
||||
pw_log_trace_fp(NAME " %p: ready %d", &impl->this, status);
|
||||
|
||||
impl->driver = false;
|
||||
impl_node_process(&impl->node.node);
|
||||
|
|
@ -1265,7 +1265,7 @@ struct pw_client_stream *pw_client_stream_new(struct pw_resource *resource,
|
|||
|
||||
impl->core = core;
|
||||
|
||||
pw_log_debug("client-stream %p: new", impl);
|
||||
pw_log_debug(NAME " %p: new", impl);
|
||||
|
||||
props = pw_properties_copy(properties);
|
||||
pw_properties_set(props, PW_KEY_NODE_DRIVER, NULL);
|
||||
|
|
@ -1289,7 +1289,7 @@ struct pw_client_stream *pw_client_stream_new(struct pw_resource *resource,
|
|||
impl->node.impl = impl;
|
||||
|
||||
if ((name = pw_properties_get(properties, PW_KEY_NODE_NAME)) == NULL)
|
||||
name = "client-stream";
|
||||
name = NAME;
|
||||
|
||||
this->node = pw_spa_node_new(core,
|
||||
client,
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ core_create_object(void *object,
|
|||
|
||||
error_no_factory:
|
||||
res = -ENOENT;
|
||||
pw_log_error("can't find node factory %s", factory_name);
|
||||
pw_log_error("can't find factory '%s'", factory_name);
|
||||
pw_resource_error(resource, res, "unknown factory name %s", factory_name);
|
||||
goto error_exit;
|
||||
error_version:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue