mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-04-25 21:30:40 +02:00
properties: add wp_properties_matches API
This commit is contained in:
parent
58f321f815
commit
ea3b58c2cd
2 changed files with 22 additions and 0 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue