mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2025-12-24 20:10:03 +01:00
m-default-profile: use sync API to enum available profiles
This commit is contained in:
parent
8fdd99d956
commit
c3338458e5
1 changed files with 13 additions and 27 deletions
|
|
@ -213,41 +213,27 @@ on_device_param_info_notified (WpPipewireObject * device, GParamSpec * param,
|
|||
(GAsyncReadyCallback) on_device_profile_notified, self);
|
||||
}
|
||||
|
||||
static void
|
||||
on_device_enum_profile_done (WpPipewireObject *device, GAsyncResult *res,
|
||||
WpDefaultProfile *self)
|
||||
{
|
||||
g_autoptr (WpIterator) profiles = NULL;
|
||||
g_autoptr (GError) error = NULL;
|
||||
|
||||
/* Finish */
|
||||
profiles = wp_pipewire_object_enum_params_finish (device, res, &error);
|
||||
if (error) {
|
||||
wp_warning_object (self, "failed to enum profiles in device "
|
||||
WP_OBJECT_FORMAT, WP_OBJECT_ARGS (device));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Keep a reference of the profiles in the device object */
|
||||
g_object_set_qdata_full (G_OBJECT (device), profiles_quark (),
|
||||
g_steal_pointer (&profiles), (GDestroyNotify) wp_iterator_unref);
|
||||
|
||||
/* Watch for param info changes */
|
||||
g_signal_connect_object (device, "notify::param-info",
|
||||
G_CALLBACK (on_device_param_info_notified), self, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
on_device_added (WpObjectManager *om, WpPipewireObject *proxy, gpointer d)
|
||||
{
|
||||
WpDefaultProfile *self = WP_DEFAULT_PROFILE (d);
|
||||
g_autoptr (WpIterator) profiles = NULL;
|
||||
|
||||
wp_debug_object (self, "device " WP_OBJECT_FORMAT " added",
|
||||
WP_OBJECT_ARGS (proxy));
|
||||
|
||||
/* Enum available profiles */
|
||||
wp_pipewire_object_enum_params (proxy, "EnumProfile", NULL, NULL,
|
||||
(GAsyncReadyCallback) on_device_enum_profile_done, self);
|
||||
profiles = wp_pipewire_object_enum_params_sync (proxy, "EnumProfile", NULL);
|
||||
if (!profiles)
|
||||
return;
|
||||
|
||||
/* Keep a reference of the profiles in the device object */
|
||||
g_object_set_qdata_full (G_OBJECT (proxy), profiles_quark (),
|
||||
g_steal_pointer (&profiles), (GDestroyNotify) wp_iterator_unref);
|
||||
|
||||
/* Watch for param info changes */
|
||||
g_signal_connect_object (proxy, "notify::param-info",
|
||||
G_CALLBACK (on_device_param_info_notified), self, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -262,7 +248,7 @@ wp_default_profile_enable (WpPlugin * plugin, WpTransition * transition)
|
|||
priv->devices_om = wp_object_manager_new ();
|
||||
wp_object_manager_add_interest (priv->devices_om, WP_TYPE_DEVICE, NULL);
|
||||
wp_object_manager_request_object_features (priv->devices_om,
|
||||
WP_TYPE_DEVICE, WP_PIPEWIRE_OBJECT_FEATURES_MINIMAL);
|
||||
WP_TYPE_DEVICE, WP_PIPEWIRE_OBJECT_FEATURES_ALL);
|
||||
g_signal_connect_object (priv->devices_om, "object-added",
|
||||
G_CALLBACK (on_device_added), self, 0);
|
||||
wp_core_install_object_manager (core, priv->devices_om);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue