Commit ea3b58c2 authored by Julian Bouzas's avatar Julian Bouzas
Browse files

properties: add wp_properties_matches API

parent 58f321f8
......@@ -262,3 +262,24 @@ wp_properties_to_pw_properties (WpProperties * self)
return pw_properties_new_dict (wp_properties_peek_dict (self));
}
gboolean
wp_properties_matches (WpProperties * self, WpProperties *other)
{
const struct spa_dict * dict;
const struct spa_dict_item *item;
const gchar *value;
g_return_val_if_fail (self != NULL, FALSE);
/* Check if the property vakues matches the ones from 'other' */
dict = wp_properties_peek_dict (self);
spa_dict_for_each(item, dict) {
value = wp_properties_get (other, item->key);
if (value && g_strcmp0 (item->value, value) != 0)
return FALSE;
}
return TRUE;
}
......@@ -57,6 +57,7 @@ gint wp_properties_setf_valist (WpProperties * self, const gchar * key,
const struct spa_dict * wp_properties_peek_dict (WpProperties * self);
struct pw_properties * wp_properties_to_pw_properties (WpProperties * self);
gboolean wp_properties_matches (WpProperties * self, WpProperties *other);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WpProperties, wp_properties_unref)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment