mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-10 13:30:05 -05:00
node: remove port_alloc_buffers
Remove the now obsolete port_alloc_buffer, rework to use the port_use_buffers with the ALLOC flag.
This commit is contained in:
parent
2f3351ef9b
commit
deb6c52f76
21 changed files with 60 additions and 462 deletions
|
|
@ -594,18 +594,6 @@ impl_node_port_use_buffers(void *object,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_alloc_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_set_io(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -816,7 +804,6 @@ static const struct spa_node_methods impl_node = {
|
|||
.port_enum_params = impl_node_port_enum_params,
|
||||
.port_set_param = impl_node_port_set_param,
|
||||
.port_use_buffers = impl_node_port_use_buffers,
|
||||
.port_alloc_buffers = impl_node_port_alloc_buffers,
|
||||
.port_set_io = impl_node_port_set_io,
|
||||
.port_reuse_buffer = impl_node_port_reuse_buffer,
|
||||
.process = impl_node_process,
|
||||
|
|
|
|||
|
|
@ -594,18 +594,6 @@ impl_node_port_use_buffers(void *object,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_alloc_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_set_io(void *object,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -813,7 +801,6 @@ static const struct spa_node_methods impl_node = {
|
|||
.port_enum_params = impl_node_port_enum_params,
|
||||
.port_set_param = impl_node_port_set_param,
|
||||
.port_use_buffers = impl_node_port_use_buffers,
|
||||
.port_alloc_buffers = impl_node_port_alloc_buffers,
|
||||
.port_set_io = impl_node_port_set_io,
|
||||
.port_reuse_buffer = impl_node_port_reuse_buffer,
|
||||
.process = impl_node_process,
|
||||
|
|
|
|||
|
|
@ -837,31 +837,6 @@ impl_node_port_use_buffers(void *object,
|
|||
SPA_ID_INVALID, flags, buffers, n_buffers);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_alloc_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
{
|
||||
struct node *this = object;
|
||||
struct port *port;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(buffers != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
||||
if (!port->have_format)
|
||||
return -EIO;
|
||||
|
||||
spa_log_warn(this->log, "not supported");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int
|
||||
impl_node_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
|
|
@ -1043,7 +1018,6 @@ static const struct spa_node_methods impl_node = {
|
|||
.port_enum_params = impl_node_port_enum_params,
|
||||
.port_set_param = impl_node_port_set_param,
|
||||
.port_use_buffers = impl_node_port_use_buffers,
|
||||
.port_alloc_buffers = impl_node_port_alloc_buffers,
|
||||
.port_set_io = impl_node_port_set_io,
|
||||
.port_reuse_buffer = impl_node_port_reuse_buffer,
|
||||
.process = impl_node_process,
|
||||
|
|
@ -1358,18 +1332,6 @@ impl_mix_port_use_buffers(void *object,
|
|||
return do_port_use_buffers(impl, direction, port->id, mix_id, flags, buffers, n_buffers);
|
||||
}
|
||||
|
||||
static int
|
||||
impl_mix_port_alloc_buffers(void *object,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_pod **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int impl_mix_port_set_io(void *object,
|
||||
enum spa_direction direction, uint32_t mix_id,
|
||||
uint32_t id, void *data, size_t size)
|
||||
|
|
@ -1414,7 +1376,6 @@ static const struct spa_node_methods impl_port_mix = {
|
|||
.add_port = impl_mix_add_port,
|
||||
.remove_port = impl_mix_remove_port,
|
||||
.port_use_buffers = impl_mix_port_use_buffers,
|
||||
.port_alloc_buffers = impl_mix_port_alloc_buffers,
|
||||
.port_set_io = impl_mix_port_set_io,
|
||||
.port_reuse_buffer = impl_mix_port_reuse_buffer,
|
||||
.process = impl_mix_process,
|
||||
|
|
|
|||
|
|
@ -1092,15 +1092,16 @@ int pw_port_alloc_buffers(struct pw_port *port,
|
|||
if (port->state < PW_PORT_STATE_READY)
|
||||
return -EIO;
|
||||
|
||||
if ((res = spa_node_port_alloc_buffers(node->node, port->direction, port->port_id,
|
||||
params, n_params,
|
||||
buffers, n_buffers)) < 0) {
|
||||
if ((res = spa_node_port_use_buffers(node->node,
|
||||
port->direction, port->port_id,
|
||||
SPA_NODE_BUFFERS_FLAG_ALLOC,
|
||||
buffers, *n_buffers)) < 0) {
|
||||
pw_log_error("port %p: %d alloc failed: %d (%s)", port, port->port_id,
|
||||
res, spa_strerror(res));
|
||||
}
|
||||
|
||||
if (res >= 0) {
|
||||
res = pw_port_call_alloc_buffers(port, params, n_params, buffers, n_buffers);
|
||||
res = pw_port_call_use_buffers(port, SPA_NODE_BUFFERS_FLAG_ALLOC, buffers, *n_buffers);
|
||||
if (res < 0) {
|
||||
pw_log_error("port %p: %d implementation alloc failed: %d (%s)",
|
||||
port, port->port_id, res, spa_strerror(res));
|
||||
|
|
|
|||
|
|
@ -477,8 +477,6 @@ struct pw_port_implementation {
|
|||
int (*init_mix) (void *data, struct pw_port_mix *mix);
|
||||
int (*release_mix) (void *data, struct pw_port_mix *mix);
|
||||
int (*use_buffers) (void *data, uint32_t flags, struct spa_buffer **buffers, uint32_t n_buffers);
|
||||
int (*alloc_buffers) (void *data, struct spa_pod **params, uint32_t n_params,
|
||||
struct spa_buffer **buffers, uint32_t *n_buffers);
|
||||
};
|
||||
|
||||
#define pw_port_call(p,m,v,...) \
|
||||
|
|
@ -493,7 +491,6 @@ struct pw_port_implementation {
|
|||
#define pw_port_call_init_mix(p,m) pw_port_call(p,init_mix,0,m)
|
||||
#define pw_port_call_release_mix(p,m) pw_port_call(p,release_mix,0,m)
|
||||
#define pw_port_call_use_buffers(p,f,b,n) pw_port_call(p,use_buffers,0,f,b,n)
|
||||
#define pw_port_call_alloc_buffers(p,pp,np,b,n) pw_port_call(p,alloc_buffers,0,pp,np,b,n)
|
||||
|
||||
#define pw_port_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_port_events, m, v, ##__VA_ARGS__)
|
||||
#define pw_port_emit_destroy(p) pw_port_emit(p, destroy, 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue