mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-04-17 09:20:49 +02:00
pipewire-object: change params-changed signal to take a string param name
To be consistent with the rest of the API where strings are used to identify param types
This commit is contained in:
parent
a0d0069f18
commit
7355215cf1
5 changed files with 29 additions and 20 deletions
|
|
@ -353,10 +353,14 @@ on_si_endpoint_properties_changed (WpSiEndpoint * item, WpImplEndpoint * self)
|
|||
}
|
||||
|
||||
static void
|
||||
on_node_params_changed (WpNode * node, guint32 param_id, WpImplEndpoint * self)
|
||||
on_node_params_changed (WpNode * node, const gchar *param_name,
|
||||
WpImplEndpoint * self)
|
||||
{
|
||||
if (param_id == SPA_PARAM_PropInfo || param_id == SPA_PARAM_Props)
|
||||
if (!g_strcmp0 (param_name, "PropInfo") || !g_strcmp0 (param_name, "Props")) {
|
||||
guint32 param_id = wp_spa_id_value_number (
|
||||
wp_spa_id_value_from_short_name ("Spa:Enum:ParamId", param_name));
|
||||
wp_pw_object_mixin_notify_params_changed (self, param_id);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -580,6 +580,7 @@ enum_params_for_cache_done (GObject * object, GAsyncResult * res, gpointer data)
|
|||
guint32 param_id = GPOINTER_TO_UINT (data);
|
||||
g_autoptr (GError) error = NULL;
|
||||
g_autoptr (GPtrArray) params = NULL;
|
||||
const gchar *name = NULL;
|
||||
|
||||
params = g_task_propagate_pointer (G_TASK (res), &error);
|
||||
if (error) {
|
||||
|
|
@ -587,8 +588,11 @@ enum_params_for_cache_done (GObject * object, GAsyncResult * res, gpointer data)
|
|||
return;
|
||||
}
|
||||
|
||||
wp_debug_object (object, "cached params id:%u, n_params:%u", param_id,
|
||||
params->len);
|
||||
name = wp_spa_id_value_short_name (wp_spa_id_value_from_number (
|
||||
"Spa:Enum:ParamId", param_id));
|
||||
|
||||
wp_debug_object (object, "cached params id:%u (%s), n_params:%u", param_id,
|
||||
name, params->len);
|
||||
|
||||
wp_pw_object_mixin_store_param (d, param_id,
|
||||
WP_PW_OBJECT_MIXIN_STORE_PARAM_ARRAY |
|
||||
|
|
@ -596,7 +600,7 @@ enum_params_for_cache_done (GObject * object, GAsyncResult * res, gpointer data)
|
|||
WP_PW_OBJECT_MIXIN_STORE_PARAM_APPEND,
|
||||
g_steal_pointer (¶ms));
|
||||
|
||||
g_signal_emit_by_name (object, "params-changed", param_id);
|
||||
g_signal_emit_by_name (object, "params-changed", name);
|
||||
}
|
||||
|
||||
G_DEFINE_QUARK (WpPwObjectMixinParamCacheActivatedFeatures, activated_features)
|
||||
|
|
@ -962,6 +966,7 @@ wp_pw_object_mixin_notify_params_changed (gpointer instance, guint32 id)
|
|||
WpPwObjectMixinPrivInterface *iface =
|
||||
WP_PW_OBJECT_MIXIN_PRIV_GET_IFACE (instance);
|
||||
gboolean subscribed = FALSE;
|
||||
const gchar *name = NULL;
|
||||
|
||||
struct spa_param_info * info = find_param_info (instance, id);
|
||||
g_return_if_fail (info);
|
||||
|
|
@ -975,12 +980,10 @@ wp_pw_object_mixin_notify_params_changed (gpointer instance, guint32 id)
|
|||
}
|
||||
}
|
||||
|
||||
if (wp_log_level_is_enabled (G_LOG_LEVEL_DEBUG)) {
|
||||
const gchar *name = NULL;
|
||||
name = wp_spa_id_value_short_name (wp_spa_id_value_from_number (
|
||||
name = wp_spa_id_value_short_name (wp_spa_id_value_from_number (
|
||||
"Spa:Enum:ParamId", id));
|
||||
wp_debug_object (instance, "notify param id:%u (%s)", id, name);
|
||||
}
|
||||
|
||||
wp_debug_object (instance, "notify param id:%u (%s)", id, name);
|
||||
|
||||
/* toggle the serial flag; this notifies that there is a data change */
|
||||
info->flags ^= SPA_PARAM_INFO_SERIAL;
|
||||
|
|
@ -992,5 +995,6 @@ wp_pw_object_mixin_notify_params_changed (gpointer instance, guint32 id)
|
|||
|
||||
if (subscribed)
|
||||
wp_pw_object_mixin_impl_enum_params (instance, 1, id, 0, -1, NULL);
|
||||
g_signal_emit_by_name (instance, "params-changed", id);
|
||||
|
||||
g_signal_emit_by_name (instance, "params-changed", name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
* \parblock
|
||||
* \code
|
||||
* params_changed_callback (WpPipewireObject * self,
|
||||
* guint id,
|
||||
* const gchar *id,
|
||||
* gpointer user_data)
|
||||
* \endcode
|
||||
*
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
* WP_PIPEWIRE_OBJECT_FEATURE_PARAM_* has been activated.
|
||||
*
|
||||
* Parameters:
|
||||
* - `id` - the parameter id
|
||||
* - `id` - the parameter id as a string (ex "Props", "EnumRoute")
|
||||
*
|
||||
* Flags: G_SIGNAL_RUN_FIRST
|
||||
* \endparblock
|
||||
|
|
@ -77,7 +77,7 @@ wp_pipewire_object_default_init (WpPipewireObjectInterface * iface)
|
|||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_signal_new ("params-changed", G_TYPE_FROM_INTERFACE (iface),
|
||||
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -242,10 +242,11 @@ on_sync_done (WpCore * core, GAsyncResult * res, WpMixerApi * self)
|
|||
}
|
||||
|
||||
static void
|
||||
on_params_changed (WpPipewireObject * obj, guint param_id, WpMixerApi * self)
|
||||
on_params_changed (WpPipewireObject * obj, const gchar * param_name,
|
||||
WpMixerApi * self)
|
||||
{
|
||||
if ((WP_IS_NODE (obj) && param_id == SPA_PARAM_Props) ||
|
||||
(WP_IS_DEVICE (obj) && param_id == SPA_PARAM_Route)) {
|
||||
if ((WP_IS_NODE (obj) && !g_strcmp0 (param_name, "Props")) ||
|
||||
(WP_IS_DEVICE (obj) && !g_strcmp0 (param_name, "Route"))) {
|
||||
g_autoptr (WpCore) core = wp_object_get_core (WP_OBJECT (self));
|
||||
wp_core_sync (core, NULL, (GAsyncReadyCallback) on_sync_done, self);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,13 +272,13 @@ test_endpoint_activate_done (WpObject * object, GAsyncResult * res,
|
|||
|
||||
static void
|
||||
test_endpoint_params_changed (WpPipewireObject * proxy,
|
||||
guint32 id, TestEndpointFixture *fixture)
|
||||
const gchar * param_name, TestEndpointFixture *fixture)
|
||||
{
|
||||
wp_debug_object (proxy, "params changed: %u", id);
|
||||
wp_debug_object (proxy, "params changed: %s", param_name);
|
||||
|
||||
/* only count changes of id 2 (Props); PipeWire 0.3.22+git changed
|
||||
behaviour and emits changes to PropInfo as well then the Props change */
|
||||
if (id == 2 && ++fixture->n_events == 3)
|
||||
if (!g_strcmp0 (param_name, "Props") && ++fixture->n_events == 3)
|
||||
g_main_loop_quit (fixture->base.loop);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue