- if (comp->class->methods.accept_port_connection) {
- status = comp->class->methods.accept_port_connection(
- bt_private_component_from_component(comp),
- bt_private_port_from_port(self_port),
- other_port);
+ break;
+ }
+ case BT_COMPONENT_CLASS_TYPE_FILTER:
+ {
+ struct bt_component_class_filter *flt_cc = (void *) comp->class;
+
+ switch (self_port->type) {
+ case BT_PORT_TYPE_INPUT:
+ method = (method_t) flt_cc->methods.input_port_connected;
+ break;
+ case BT_PORT_TYPE_OUTPUT:
+ method = (method_t) flt_cc->methods.output_port_connected;
+ break;
+ default:
+ abort();
+ }
+
+ break;
+ }
+ case BT_COMPONENT_CLASS_TYPE_SINK:
+ {
+ struct bt_component_class_sink *sink_cc = (void *) comp->class;
+
+ switch (self_port->type) {
+ case BT_PORT_TYPE_INPUT:
+ method = (method_t) sink_cc->methods.input_port_connected;
+ break;
+ default:
+ abort();
+ }
+
+ break;
+ }
+ default:
+ abort();
+ }
+
+ if (method) {
+ BT_LIB_LOGD("Calling user's \"port connected\" method: "
+ "%![comp-]+c, %![self-port-]+p, %![other-port-]+p",
+ comp, self_port, other_port);
+ status = method(comp, self_port, (void *) other_port);
+ BT_LOGD("User method returned: status=%s",
+ bt_self_component_status_string(status));
+ BT_ASSERT_PRE(status == BT_SELF_COMPONENT_STATUS_OK ||
+ status == BT_SELF_COMPONENT_STATUS_ERROR ||
+ status == BT_SELF_COMPONENT_STATUS_NOMEM,
+ "Unexpected returned component status: status=%s",
+ bt_self_component_status_string(status));