diff --git a/src/pipewire/context.c b/src/pipewire/context.c index 69201ab82..f86179121 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -592,98 +592,6 @@ struct pw_global *pw_context_find_global(struct pw_context *context, uint32_t id return global; } -/** Find a port to link with - * - * \param context a context - * \param other_port a port to find a link with - * \param id the id of a port or PW_ID_ANY - * \param props extra properties - * \param n_format_filters number of filters - * \param format_filters array of format filters - * \param[out] error an error when something is wrong - * \return a port that can be used to link to \a otherport or NULL on error - */ -struct pw_impl_port *pw_context_find_port(struct pw_context *context, - struct pw_impl_port *other_port, - uint32_t id, - struct pw_properties *props, - uint32_t n_format_filters, - struct spa_pod **format_filters, - char **error) -{ - struct pw_impl_port *best = NULL; - bool have_id; - struct pw_impl_node *n; - - have_id = id != PW_ID_ANY; - - pw_log_debug("%p: id:%u", context, id); - - spa_list_for_each(n, &context->node_list, link) { - if (n->global == NULL) - continue; - - if (other_port->node == n) - continue; - - if (!global_can_read(context, n->global)) - continue; - - pw_log_debug("%p: node id:%d", context, n->global->id); - - if (have_id) { - if (n->global->id == id) { - pw_log_debug("%p: id:%u matches node %p", context, id, n); - - best = - pw_impl_node_find_port(n, - pw_direction_reverse(other_port->direction), - PW_ID_ANY); - if (best) - break; - } - } else { - struct pw_impl_port *p, *pin, *pout; - uint8_t buf[4096]; - struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf)); - struct spa_pod *dummy; - - p = pw_impl_node_find_port(n, - pw_direction_reverse(other_port->direction), - PW_ID_ANY); - if (p == NULL) - continue; - - if (p->direction == PW_DIRECTION_OUTPUT) { - pin = other_port; - pout = p; - } else { - pin = p; - pout = other_port; - } - - if (pw_context_find_format(context, - pout, - pin, - props, - n_format_filters, - format_filters, - &dummy, - &b, - error) < 0) { - free(*error); - continue; - } - best = p; - break; - } - } - if (best == NULL) { - *error = spa_aprintf("No matching Node found"); - } - return best; -} - SPA_PRINTF_FUNC(7, 8) int pw_context_debug_port_params(struct pw_context *this, struct spa_node *node, enum spa_direction direction, uint32_t port_id, uint32_t id, int err, const char *debug, ...) diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 354475437..144e21bf1 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -1153,16 +1153,6 @@ int pw_context_find_format(struct pw_context *context, struct spa_pod_builder *builder, char **error); -/** Find a ports compatible with \a other_port and the format filters */ -struct pw_impl_port * -pw_context_find_port(struct pw_context *context, - struct pw_impl_port *other_port, - uint32_t id, - struct pw_properties *props, - uint32_t n_format_filters, - struct spa_pod **format_filters, - char **error); - int pw_context_debug_port_params(struct pw_context *context, struct spa_node *node, enum spa_direction direction, uint32_t port_id, uint32_t id, int err, const char *debug, ...);