From 17ee195902d5551086cf09df5ddc94525f8655ea Mon Sep 17 00:00:00 2001 From: Julian Bouzas <julian.bouzas@collabora.com> Date: Wed, 6 May 2020 10:27:58 -0400 Subject: [PATCH] spa-pod: rename wp_spa_pod_iterator_new to wp_spa_pod_iterate --- lib/wp/spa-pod.c | 4 ++-- lib/wp/spa-pod.h | 6 +++--- lib/wp/spa-props.c | 2 +- modules/module-pipewire/algorithms.c | 14 +++++++------- tests/wp/spa-pod.c | 12 ++++++------ 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/wp/spa-pod.c b/lib/wp/spa-pod.c index a3b57a63..5cd9e1ea 100644 --- a/lib/wp/spa-pod.c +++ b/lib/wp/spa-pod.c @@ -3003,7 +3003,7 @@ wp_spa_pod_iterator_finalize (WpIterator *iterator) } /** - * wp_spa_pod_iterator_new: + * wp_spa_pod_iterate: * @pod: a spa pod object * * Creates a new iterator for a spa pod object. The @pod object must be valid @@ -3012,7 +3012,7 @@ wp_spa_pod_iterator_finalize (WpIterator *iterator) * Returns: (transfer full): the new spa pod iterator */ WpIterator * -wp_spa_pod_iterator_new (const WpSpaPod *pod) +wp_spa_pod_iterate (const WpSpaPod *pod) { static const WpIteratorMethods methods = { .reset = wp_spa_pod_iterator_reset, diff --git a/lib/wp/spa-pod.h b/lib/wp/spa-pod.h index 1b2d2041..7098c48d 100644 --- a/lib/wp/spa-pod.h +++ b/lib/wp/spa-pod.h @@ -278,6 +278,9 @@ WpSpaPod *wp_spa_pod_get_choice_child (WpSpaPod *self); WP_API WpSpaPod *wp_spa_pod_get_array_child (WpSpaPod *self); +WP_API +WpIterator *wp_spa_pod_iterate (const WpSpaPod *pod); + G_DEFINE_AUTOPTR_CLEANUP_FUNC (WpSpaPod, wp_spa_pod_unref) @@ -460,9 +463,6 @@ void wp_spa_pod_parser_end (WpSpaPodParser *self); G_DEFINE_AUTOPTR_CLEANUP_FUNC (WpSpaPodParser, wp_spa_pod_parser_unref) -WP_API -WpIterator *wp_spa_pod_iterator_new (const WpSpaPod *pod); - G_END_DECLS #endif diff --git a/lib/wp/spa-props.c b/lib/wp/spa-props.c index 108779a0..3dfe9f58 100644 --- a/lib/wp/spa-props.c +++ b/lib/wp/spa-props.c @@ -146,7 +146,7 @@ wp_spa_props_store_from_props (WpSpaProps * self, const WpSpaPod * props, if (g_strcmp0 (wp_spa_pod_get_object_type_name (props), "Props") != 0) return FALSE; - it = wp_spa_pod_iterator_new (props); + it = wp_spa_pod_iterate (props); while (wp_iterator_next (it, &next)) { WpSpaPod *p = g_value_get_boxed (&next); const char *key_name = NULL; diff --git a/modules/module-pipewire/algorithms.c b/modules/module-pipewire/algorithms.c index 53d3ebd2..1129fcd9 100644 --- a/modules/module-pipewire/algorithms.c +++ b/modules/module-pipewire/algorithms.c @@ -208,7 +208,7 @@ select_format (WpSpaPod *value) /* Enum */ else if (g_strcmp0 ("Enum", choice_type_name) == 0) { - g_autoptr (WpIterator) it = wp_spa_pod_iterator_new (value); + g_autoptr (WpIterator) it = wp_spa_pod_iterate (value); GValue next = G_VALUE_INIT; while (wp_iterator_next (it, &next)) { enum spa_audio_format *format_id = (enum spa_audio_format *) @@ -250,7 +250,7 @@ select_rate (WpSpaPod *value) /* Enum */ else if (g_strcmp0 ("Enum", choice_type_name) == 0) { /* pick the one closest to 48Khz */ - g_autoptr (WpIterator) it = wp_spa_pod_iterator_new (value); + g_autoptr (WpIterator) it = wp_spa_pod_iterate (value); GValue next = G_VALUE_INIT; while (wp_iterator_next (it, &next)) { gint *rate = (gint *) g_value_get_pointer (&next); @@ -266,7 +266,7 @@ select_rate (WpSpaPod *value) however, sometimes ALSA drivers give bad min & max values and pipewire picks a bad default... try to fix that here; the default should be the one closest to 48K */ - g_autoptr (WpIterator) it = wp_spa_pod_iterator_new (value); + g_autoptr (WpIterator) it = wp_spa_pod_iterate (value); GValue next = G_VALUE_INIT; gint vals[3]; gint i = 0, min, max; @@ -305,7 +305,7 @@ select_channels (WpSpaPod *value, gint preference) /* Enum */ else if (g_strcmp0 ("Enum", choice_type_name) == 0) { /* choose the most channels */ - g_autoptr (WpIterator) it = wp_spa_pod_iterator_new (value); + g_autoptr (WpIterator) it = wp_spa_pod_iterate (value); GValue next = G_VALUE_INIT; gint diff = SPA_AUDIO_MAX_CHANNELS; while (wp_iterator_next (it, &next)) { @@ -323,7 +323,7 @@ select_channels (WpSpaPod *value, gint preference) /* a range is typically 3 items: default, min, max; we want the most channels, but let's not trust max to really be the max... ALSA drivers can be broken */ - g_autoptr (WpIterator) it = wp_spa_pod_iterator_new (value); + g_autoptr (WpIterator) it = wp_spa_pod_iterate (value); GValue next = G_VALUE_INIT; gint vals[3]; gint i = 0; @@ -375,7 +375,7 @@ choose_sensible_raw_audio_format (GPtrArray *formats, continue; /* go through the fields and populate raw[i] */ - g_autoptr (WpIterator) it = wp_spa_pod_iterator_new (pod); + g_autoptr (WpIterator) it = wp_spa_pod_iterate (pod); GValue next = G_VALUE_INIT; while (wp_iterator_next (it, &next)) { WpSpaPod *p = g_value_get_boxed (&next); @@ -403,7 +403,7 @@ choose_sensible_raw_audio_format (GPtrArray *formats, /* just copy the array, there is no choice here */ g_return_val_if_fail (wp_spa_pod_is_array (value), FALSE); SPA_FLAG_CLEAR (raw[i].flags, SPA_AUDIO_FLAG_UNPOSITIONED); - g_autoptr (WpIterator) array_it = wp_spa_pod_iterator_new (value); + g_autoptr (WpIterator) array_it = wp_spa_pod_iterate (value); GValue array_next = G_VALUE_INIT; guint j = 0; while (wp_iterator_next (array_it, &array_next)) { diff --git a/tests/wp/spa-pod.c b/tests/wp/spa-pod.c index 07eaa60e..7fd92394 100644 --- a/tests/wp/spa-pod.c +++ b/tests/wp/spa-pod.c @@ -703,7 +703,7 @@ test_spa_pod_iterator (void) g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b); g_assert_nonnull (pod); - g_autoptr (WpIterator) it = wp_spa_pod_iterator_new (pod); + g_autoptr (WpIterator) it = wp_spa_pod_iterate (pod); g_assert_nonnull (it); { @@ -752,7 +752,7 @@ test_spa_pod_iterator (void) g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b); g_assert_nonnull (pod); - g_autoptr (WpIterator) it = wp_spa_pod_iterator_new (pod); + g_autoptr (WpIterator) it = wp_spa_pod_iterate (pod); g_assert_nonnull (it); { @@ -802,7 +802,7 @@ test_spa_pod_iterator (void) g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b); g_assert_nonnull (pod); - g_autoptr (WpIterator) it = wp_spa_pod_iterator_new (pod); + g_autoptr (WpIterator) it = wp_spa_pod_iterate (pod); g_assert_nonnull (it); { @@ -855,7 +855,7 @@ test_spa_pod_iterator (void) g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b); g_assert_nonnull (pod); - g_autoptr (WpIterator) it = wp_spa_pod_iterator_new (pod); + g_autoptr (WpIterator) it = wp_spa_pod_iterate (pod); g_assert_nonnull (it); { @@ -910,7 +910,7 @@ test_spa_pod_iterator (void) g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b); g_assert_nonnull (pod); - g_autoptr (WpIterator) it = wp_spa_pod_iterator_new (pod); + g_autoptr (WpIterator) it = wp_spa_pod_iterate (pod); g_assert_nonnull (it); { @@ -979,7 +979,7 @@ test_spa_pod_unique_owner (void) GValue next = G_VALUE_INIT; g_autoptr (WpSpaPod) property = NULL; { - g_autoptr (WpIterator) it = wp_spa_pod_iterator_new (pod); + g_autoptr (WpIterator) it = wp_spa_pod_iterate (pod); g_assert_nonnull (it); g_assert_true (wp_iterator_next (it, &next)); property = g_value_dup_boxed (&next); -- GitLab