-bt_value *get_default_params(struct muxer_comp *muxer_comp)
-{
- bt_value *params;
- int ret;
-
- params = bt_value_map_create();
- if (!params) {
- BT_COMP_LOGE_STR("Cannot create a map value object.");
- goto error;
- }
-
- ret = bt_value_map_insert_bool_entry(params,
- ASSUME_ABSOLUTE_CLOCK_CLASSES_PARAM_NAME, false);
- if (ret) {
- BT_COMP_LOGE_STR("Cannot add boolean value to map value object.");
- goto error;
- }
-
- goto end;
-
-error:
- BT_VALUE_PUT_REF_AND_RESET(params);
-
-end:
- return params;
-}
-
-static
-int configure_muxer_comp(struct muxer_comp *muxer_comp,
- const bt_value *params)
-{
- bt_value *default_params = NULL;
- bt_value *real_params = NULL;
- const bt_value *assume_absolute_clock_classes = NULL;
- int ret = 0;
- bt_bool bool_val;
-
- default_params = get_default_params(muxer_comp);
- if (!default_params) {
- BT_COMP_LOGE("Cannot get default parameters: "
- "muxer-comp-addr=%p", muxer_comp);
- goto error;
- }
-
- ret = bt_value_map_extend(default_params, params, &real_params);
- if (ret) {
- BT_COMP_LOGE("Cannot extend default parameters map value: "
- "muxer-comp-addr=%p, def-params-addr=%p, "
- "params-addr=%p", muxer_comp, default_params,
- params);
- goto error;
- }
-
- assume_absolute_clock_classes = bt_value_map_borrow_entry_value(real_params,
- ASSUME_ABSOLUTE_CLOCK_CLASSES_PARAM_NAME);
- if (assume_absolute_clock_classes &&
- !bt_value_is_bool(assume_absolute_clock_classes)) {
- BT_COMP_LOGE("Expecting a boolean value for the `%s` parameter: "
- "muxer-comp-addr=%p, value-type=%s",
- ASSUME_ABSOLUTE_CLOCK_CLASSES_PARAM_NAME, muxer_comp,
- bt_common_value_type_string(
- bt_value_get_type(assume_absolute_clock_classes)));
- goto error;
- }
-
- bool_val = bt_value_bool_get(assume_absolute_clock_classes);
- muxer_comp->assume_absolute_clock_classes = (bool) bool_val;
- BT_COMP_LOGI("Configured muxer component: muxer-comp-addr=%p, "
- "assume-absolute-clock-classes=%d",
- muxer_comp, muxer_comp->assume_absolute_clock_classes);
- goto end;
-
-error:
- ret = -1;
-
-end:
- bt_value_put_ref(default_params);
- bt_value_put_ref(real_params);
- return ret;
-}