+/*
+ * Create `struct implicit_component_args` structures for each of the source
+ * components we identified. Add them to `component_args`.
+ */
+
+static
+void create_implicit_component_args_from_auto_discovered_sources(
+ const struct auto_source_discovery *auto_disc, GPtrArray *component_args)
+{
+ gchar *cc_name = NULL;
+ struct implicit_component_args *comp = NULL;
+ int status;
+ guint i, len;
+
+ len = auto_disc->results->len;
+
+ for (i = 0; i < len; i++) {
+ struct auto_source_discovery_result *res =
+ g_ptr_array_index(auto_disc->results, i);
+
+ g_free(cc_name);
+ cc_name = g_strdup_printf("source.%s.%s", res->plugin_name, res->source_cc_name);
+ if (!cc_name) {
+ BT_CLI_LOGE_APPEND_CAUSE_OOM();
+ goto end;
+ }
+
+ comp = create_implicit_component_args(cc_name);
+ if (!comp) {
+ goto end;
+ }
+
+ status = append_parameter_to_args(comp->extra_params, "inputs", res->inputs);
+ if (status != 0) {
+ goto end;
+ }
+
+ g_ptr_array_add(component_args, comp);
+ comp = NULL;
+ }
+
+end:
+ g_free(cc_name);
+
+ if (comp) {
+ destroy_implicit_component_args(comp);
+ }
+}
+