Skip to content

Settings improvements

This MR refactors WpSettings to use WpSpaJson in order to parse the property values. This is because the wireplumber configuration is written in JSON, so WpSettings should only hold JSON values. To fix this, 2 API changes have been done:

  • wp_settings_get_int() only accepts gint values, instead of gint64 values. This is because the WpSpaJson API only parses int values, like spa_json_parse_int().

  • wp_settings_get_string() now returns a newly allocated string, this is because the string needs to be decoded in case it has quotes.

Appart from this, 3 new APIs are added:

  • wp_settings_is_null() allows user to check whether a property is NULL or not.
  • wp_settings_get_json() This is useful for properties that are not primitive values (eg JSON arrays and objects).
  • wp_settings_get_json_all() This is useful if the user whats to get a group of properties matching a pattern, which simplifies the Lua scripts.

All the memory leaks in WpSettings have been fixed also.

Edited by Julian Bouzas

Merge request reports