mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-28 05:40:26 -04:00
spa: revert peer_enum_params node event again
It's not used anymore because it does work so well. The problem is that while it transparently proxies param enums on ports to peers, it fails to emit events when those peer params change in a way that would make the enum result change as well. This makes it quite hard to use this correctly.
This commit is contained in:
parent
7b8b6d92d9
commit
ea7e0e9152
7 changed files with 4 additions and 121 deletions
|
|
@ -30,7 +30,7 @@ extern "C" {
|
|||
|
||||
#define SPA_TYPE_INTERFACE_Node SPA_TYPE_INFO_INTERFACE_BASE "Node"
|
||||
|
||||
#define SPA_VERSION_NODE 1
|
||||
#define SPA_VERSION_NODE 0
|
||||
struct spa_node { struct spa_interface iface; };
|
||||
|
||||
/**
|
||||
|
|
@ -126,8 +126,7 @@ struct spa_result_node_params {
|
|||
#define SPA_NODE_EVENT_PORT_INFO 1
|
||||
#define SPA_NODE_EVENT_RESULT 2
|
||||
#define SPA_NODE_EVENT_EVENT 3
|
||||
#define SPA_NODE_EVENT_PEER_ENUM_PARAM 4
|
||||
#define SPA_NODE_EVENT_NUM 5
|
||||
#define SPA_NODE_EVENT_NUM 4
|
||||
|
||||
/** events from the spa_node.
|
||||
*
|
||||
|
|
@ -136,7 +135,7 @@ struct spa_result_node_params {
|
|||
* spa_node_add_listener().
|
||||
*/
|
||||
struct spa_node_events {
|
||||
#define SPA_VERSION_NODE_EVENTS 1
|
||||
#define SPA_VERSION_NODE_EVENTS 0
|
||||
uint32_t version; /**< version of this structure */
|
||||
|
||||
/** Emitted when info changes */
|
||||
|
|
@ -174,21 +173,6 @@ struct spa_node_events {
|
|||
* on \a node.
|
||||
*/
|
||||
void (*event) (void *data, const struct spa_event *event);
|
||||
|
||||
/**
|
||||
* \param data the data when registering the listener
|
||||
*
|
||||
* Register the given events and data as a listener to the
|
||||
* peer of the given port and enumerate the params.
|
||||
*
|
||||
* since 1:1
|
||||
*/
|
||||
void (*peer_enum_params) (void *data, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t max,
|
||||
const struct spa_pod *filter,
|
||||
const struct spa_node_events *events, void *events_data,
|
||||
int *res);
|
||||
};
|
||||
|
||||
#define SPA_NODE_CALLBACK_READY 0
|
||||
|
|
|
|||
|
|
@ -113,7 +113,6 @@ static inline int spa_node_port_enum_params_sync(struct spa_node *node,
|
|||
#define spa_node_emit_port_info(hooks,...) spa_node_emit(hooks,port_info, 0, __VA_ARGS__)
|
||||
#define spa_node_emit_result(hooks,...) spa_node_emit(hooks,result, 0, __VA_ARGS__)
|
||||
#define spa_node_emit_event(hooks,...) spa_node_emit(hooks,event, 0, __VA_ARGS__)
|
||||
#define spa_node_emit_peer_enum_params(hooks,...) spa_node_emit(hooks,peer_enum_params,1, __VA_ARGS__)
|
||||
|
||||
|
||||
#define spa_node_call(callbacks,method,version,...) \
|
||||
|
|
|
|||
|
|
@ -368,17 +368,6 @@ static int port_enum_formats(void *object, struct port *port,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void peer_result(void *data, int seq, int res, uint32_t type, const void *result)
|
||||
{
|
||||
struct impl *this = data;
|
||||
spa_node_emit_result(&this->hooks, seq, res, type, result);
|
||||
}
|
||||
|
||||
static const struct spa_node_events peer_node_events = {
|
||||
SPA_VERSION_NODE_EVENTS,
|
||||
.result = peer_result,
|
||||
};
|
||||
|
||||
static int
|
||||
impl_node_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -468,12 +457,6 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
return 0;
|
||||
}
|
||||
break;
|
||||
case SPA_PARAM_Latency:
|
||||
case SPA_PARAM_Tag:
|
||||
res = -ENOTSUP;
|
||||
spa_node_emit_peer_enum_params(&this->hooks, seq, direction, port_id,
|
||||
id, start, num, filter, &peer_node_events, this, &res);
|
||||
return res;
|
||||
default:
|
||||
return -ENOENT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -343,17 +343,6 @@ static int port_enum_formats(void *object, struct port *port,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void peer_result(void *data, int seq, int res, uint32_t type, const void *result)
|
||||
{
|
||||
struct impl *this = data;
|
||||
spa_node_emit_result(&this->hooks, seq, res, type, result);
|
||||
}
|
||||
|
||||
static const struct spa_node_events peer_node_events = {
|
||||
SPA_VERSION_NODE_EVENTS,
|
||||
.result = peer_result,
|
||||
};
|
||||
|
||||
static int
|
||||
impl_node_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -445,12 +434,6 @@ next:
|
|||
return 0;
|
||||
}
|
||||
break;
|
||||
case SPA_PARAM_Latency:
|
||||
case SPA_PARAM_Tag:
|
||||
res = -ENOTSUP;
|
||||
spa_node_emit_peer_enum_params(&this->hooks, seq, direction, port_id,
|
||||
id, start, num, filter, &peer_node_events, this, &res);
|
||||
return res;
|
||||
default:
|
||||
return -ENOENT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,17 +303,6 @@ static int port_enum_formats(void *object, struct port *port,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void peer_result(void *data, int seq, int res, uint32_t type, const void *result)
|
||||
{
|
||||
struct impl *this = data;
|
||||
spa_node_emit_result(&this->hooks, seq, res, type, result);
|
||||
}
|
||||
|
||||
static const struct spa_node_events peer_node_events = {
|
||||
SPA_VERSION_NODE_EVENTS,
|
||||
.result = peer_result,
|
||||
};
|
||||
|
||||
static int
|
||||
impl_node_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -388,12 +377,6 @@ next:
|
|||
return 0;
|
||||
}
|
||||
break;
|
||||
case SPA_PARAM_Latency:
|
||||
case SPA_PARAM_Tag:
|
||||
res = -ENOTSUP;
|
||||
spa_node_emit_peer_enum_params(&this->hooks, seq, direction, port_id,
|
||||
id, start, num, filter, &peer_node_events, this, &res);
|
||||
return res;
|
||||
default:
|
||||
return -ENOENT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ struct impl {
|
|||
struct pw_impl_port this;
|
||||
struct spa_node mix_node; /**< mix node implementation */
|
||||
struct spa_hook_list mix_hooks;
|
||||
struct spa_hook mix_listener;
|
||||
|
||||
struct {
|
||||
struct spa_list mix_list;
|
||||
|
|
@ -128,17 +127,6 @@ static int mix_add_listener(void *object, struct spa_hook *listener,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void mix_result(void *data, int seq, int res, uint32_t type, const void *result)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
spa_node_emit_result(&impl->mix_hooks, seq, res, type, result);
|
||||
}
|
||||
|
||||
static const struct spa_node_events mix_node_events = {
|
||||
SPA_VERSION_NODE_EVENTS,
|
||||
.result = mix_result,
|
||||
};
|
||||
|
||||
static int mix_port_enum_params(void *object, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t max,
|
||||
|
|
@ -182,8 +170,6 @@ next:
|
|||
break;
|
||||
default:
|
||||
res = -ENOTSUP;
|
||||
spa_node_emit_peer_enum_params(&impl->mix_hooks, seq, direction, port_id,
|
||||
id, start, max, filter, &mix_node_events, impl, &res);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -810,30 +796,6 @@ error_no_mem:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void mix_peer_enum_params(void *data, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t max,
|
||||
const struct spa_pod *filter,
|
||||
const struct spa_node_events *events, void *events_data,
|
||||
int *res)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
struct pw_impl_port *port = &impl->this;
|
||||
struct spa_hook listener;
|
||||
|
||||
spa_zero(listener);
|
||||
spa_node_add_listener(port->node->node, &listener, events, events_data);
|
||||
*res = spa_node_port_enum_params(port->node->node, seq,
|
||||
port->direction, port->port_id,
|
||||
id, start, max, filter);
|
||||
spa_hook_remove(&listener);
|
||||
}
|
||||
|
||||
static const struct spa_node_events mix_peer_node_events = {
|
||||
SPA_VERSION_NODE_EVENTS,
|
||||
.peer_enum_params = mix_peer_enum_params,
|
||||
};
|
||||
|
||||
SPA_EXPORT
|
||||
int pw_impl_port_set_mix(struct pw_impl_port *port, struct spa_node *node, uint32_t flags)
|
||||
{
|
||||
|
|
@ -855,8 +817,6 @@ int pw_impl_port_set_mix(struct pw_impl_port *port, struct spa_node *node, uint3
|
|||
pw_direction_reverse(port->direction), 0,
|
||||
SPA_IO_Buffers, NULL, 0);
|
||||
}
|
||||
if (port->mix)
|
||||
spa_hook_remove(&impl->mix_listener);
|
||||
|
||||
if (port->mix_handle != NULL) {
|
||||
pw_unload_spa_handle(port->mix_handle);
|
||||
|
|
@ -865,8 +825,6 @@ int pw_impl_port_set_mix(struct pw_impl_port *port, struct spa_node *node, uint3
|
|||
|
||||
port->mix_flags = flags;
|
||||
port->mix = node;
|
||||
if (port->mix)
|
||||
spa_node_add_listener(port->mix, &impl->mix_listener, &mix_peer_node_events, impl);
|
||||
|
||||
if (port->mix && !port->destroying) {
|
||||
spa_list_for_each(mix, &port->mix_list, link)
|
||||
|
|
|
|||
|
|
@ -126,12 +126,6 @@ PWTEST(node_node_abi)
|
|||
void (*result) (void *data, int seq, int res,
|
||||
uint32_t type, const void *result);
|
||||
void (*event) (void *data, const struct spa_event *event);
|
||||
void (*peer_enum_params) (void *data, int seq,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t start, uint32_t max,
|
||||
const struct spa_pod *filter,
|
||||
const struct spa_node_events *events, void *events_data,
|
||||
int *res);
|
||||
} events = { SPA_VERSION_NODE_EVENTS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
|
|
@ -195,8 +189,7 @@ PWTEST(node_node_abi)
|
|||
TEST_FUNC(e, events, port_info, SPA_NODE_EVENT_PORT_INFO);
|
||||
TEST_FUNC(e, events, result, SPA_NODE_EVENT_RESULT);
|
||||
TEST_FUNC(e, events, event, SPA_NODE_EVENT_EVENT);
|
||||
TEST_FUNC(e, events, peer_enum_params, SPA_NODE_EVENT_PEER_ENUM_PARAM);
|
||||
pwtest_int_eq(SPA_NODE_EVENT_NUM, 5);
|
||||
pwtest_int_eq(SPA_NODE_EVENT_NUM, 4);
|
||||
pwtest_int_eq(sizeof(e), sizeof(events));
|
||||
|
||||
TEST_FUNC(c, callbacks, version, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue