- plugin->shared_lib_handle->init_called = true;
-
- /* Add described component classes to plugin */
- for (i = 0; i < comp_class_full_descriptors->len; i++) {
- struct comp_class_full_descriptor *cc_full_descr =
- &g_array_index(comp_class_full_descriptors,
- struct comp_class_full_descriptor, i);
- struct bt_component_class *comp_class;
-
- switch (cc_full_descr->descriptor->type) {
- case BT_COMPONENT_CLASS_TYPE_SOURCE:
- comp_class = bt_component_class_source_create(
- cc_full_descr->descriptor->name,
- cc_full_descr->descriptor->methods.source.notif_iter_get,
- cc_full_descr->descriptor->methods.source.notif_iter_next);
- break;
- case BT_COMPONENT_CLASS_TYPE_FILTER:
- comp_class = bt_component_class_filter_create(
- cc_full_descr->descriptor->name,
- cc_full_descr->descriptor->methods.source.notif_iter_get,
- cc_full_descr->descriptor->methods.source.notif_iter_next);
- break;
- case BT_COMPONENT_CLASS_TYPE_SINK:
- comp_class = bt_component_class_sink_create(
- cc_full_descr->descriptor->name,
- cc_full_descr->descriptor->methods.sink.consume);
- break;
- default:
- printf_verbose("WARNING: Unknown component class type %d for component class %s in plugin %s\n",
- cc_full_descr->descriptor->type,
- cc_full_descr->descriptor->name,
- descriptor->name);
- continue;
- }
-
- if (!comp_class) {
- status = BT_PLUGIN_STATUS_ERROR;
- goto end;
- }
-
- if (cc_full_descr->description) {
- ret = bt_component_class_set_description(comp_class,
- cc_full_descr->description);
- if (ret) {
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
- }
- }
-
- if (cc_full_descr->init_method) {
- ret = bt_component_class_set_init_method(comp_class,
- cc_full_descr->init_method);
- if (ret) {
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
- }
- }
-
- if (cc_full_descr->destroy_method) {
- ret = bt_component_class_set_destroy_method(comp_class,
- cc_full_descr->destroy_method);
- if (ret) {
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
- }
- }
-
- switch (cc_full_descr->descriptor->type) {
- case BT_COMPONENT_CLASS_TYPE_SOURCE:
- if (cc_full_descr->iterator_methods.init) {
- ret = bt_component_class_source_set_notification_iterator_init_method(
- comp_class,
- cc_full_descr->iterator_methods.init);
- if (ret) {
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
- }
- }
-
- if (cc_full_descr->iterator_methods.destroy) {
- ret = bt_component_class_source_set_notification_iterator_destroy_method(
- comp_class,
- cc_full_descr->iterator_methods.destroy);
- if (ret) {
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
- }
- }
-
- if (cc_full_descr->iterator_methods.seek_time) {
- ret = bt_component_class_source_set_notification_iterator_seek_time_method(
- comp_class,
- cc_full_descr->iterator_methods.seek_time);
- if (ret) {
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
- }
- }
- break;
- case BT_COMPONENT_CLASS_TYPE_FILTER:
- if (cc_full_descr->filter_add_iterator_method) {
- ret = bt_component_class_filter_set_add_iterator_method(
- comp_class,
- cc_full_descr->filter_add_iterator_method);
- if (ret) {
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
- }
- }
-
- if (cc_full_descr->iterator_methods.init) {
- ret = bt_component_class_filter_set_notification_iterator_init_method(
- comp_class,
- cc_full_descr->iterator_methods.init);
- if (ret) {
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
- }
- }
-
- if (cc_full_descr->iterator_methods.destroy) {
- ret = bt_component_class_filter_set_notification_iterator_destroy_method(
- comp_class,
- cc_full_descr->iterator_methods.destroy);
- if (ret) {
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
- }
- }
-
- if (cc_full_descr->iterator_methods.seek_time) {
- ret = bt_component_class_filter_set_notification_iterator_seek_time_method(
- comp_class,
- cc_full_descr->iterator_methods.seek_time);
- if (ret) {
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
- }
- }
- break;
- case BT_COMPONENT_CLASS_TYPE_SINK:
- if (cc_full_descr->sink_add_iterator_method) {
- ret = bt_component_class_sink_set_add_iterator_method(
- comp_class,
- cc_full_descr->sink_add_iterator_method);
- if (ret) {
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
- }
- }
- break;
- default:
- assert(false);
- break;
- }
-
- /* Add component class to the plugin object */
- status = bt_plugin_add_component_class(plugin,
- comp_class);
- BT_PUT(comp_class);
- if (status < 0) {
- printf_verbose("Cannot add component class %s (type %d) to plugin `%s`: status = %d\n",
- cc_full_descr->descriptor->name,
- cc_full_descr->descriptor->type,
- plugin->name, status);
- goto end;
- }