[BT_COMPONENT_CLASS_TYPE_FILTER] = bt_component_filter_destroy,
};
-static
-enum bt_component_status (* const component_validation_funcs[])(
- struct bt_component *) = {
- [BT_COMPONENT_CLASS_TYPE_SOURCE] = bt_component_source_validate,
- [BT_COMPONENT_CLASS_TYPE_SINK] = bt_component_sink_validate,
- [BT_COMPONENT_CLASS_TYPE_FILTER] = bt_component_filter_validate,
-};
-
static
void bt_component_destroy(struct bt_object *obj)
{
goto end;
}
- component->initializing = BT_TRUE;
-
if (component_class->methods.init) {
BT_LOGD_STR("Calling user's initialization method.");
ret = component_class->methods.init(
init_method_data);
BT_LOGD("User method returned: status=%s",
bt_component_status_string(ret));
- component->initializing = BT_FALSE;
if (ret != BT_COMPONENT_STATUS_OK) {
BT_LOGW_STR("Initialization method failed.");
BT_PUT(component);
}
}
- component->initializing = BT_FALSE;
- ret = component_validation_funcs[type](component);
- if (ret != BT_COMPONENT_STATUS_OK) {
- BT_LOGW("Component is invalid: status=%s",
- bt_component_status_string(ret));
- BT_PUT(component);
- goto end;
- }
-
BT_LOGD_STR("Freezing component class.");
bt_component_class_freeze(component->class);
BT_LOGD("Created component from component class: "
goto end;
}
- if (!component->initializing) {
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
component->user_data = data;
BT_LOGV("Set component's user data: "
"comp-addr=%p, comp-name=\"%s\", user-data-addr=%p",