Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Julian Bouzas
WirePlumber
Commits
dc693ee0
Commit
dc693ee0
authored
May 17, 2021
by
Julian Bouzas
Browse files
m-device-activation: use sync API to enum available profiles
parent
e1917239
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/module-device-activation.c
View file @
dc693ee0
...
...
@@ -104,22 +104,13 @@ set_device_profile (WpDeviceActivation *self, WpPipewireObject *device, gint ind
}
static
void
on
_device_
enum_
profile
_done
(
WpPipewireObject
*
proxy
,
GAsyncResult
*
res
,
Wp
DeviceActivation
*
self
)
handle
_device_profile
s
(
WpDeviceActivation
*
self
,
WpPipewireObject
*
proxy
,
Wp
Iterator
*
profiles
)
{
g_autoptr
(
WpPlugin
)
dp
=
g_weak_ref_get
(
&
self
->
default_profile
);
g_autoptr
(
WpIterator
)
profiles
=
NULL
;
g_autoptr
(
GError
)
error
=
NULL
;
const
gchar
*
name
=
NULL
;
gint
index
=
-
1
;
/* Finish */
profiles
=
wp_pipewire_object_enum_params_finish
(
proxy
,
res
,
&
error
);
if
(
error
)
{
wp_warning_object
(
self
,
"failed to enum profiles on device"
);
return
;
}
/* Get the default profile name if default-profile module is loaded */
if
(
dp
)
g_signal_emit_by_name
(
dp
,
"get-profile"
,
WP_DEVICE
(
proxy
),
&
name
);
...
...
@@ -182,10 +173,14 @@ static void
on_device_added
(
WpObjectManager
*
om
,
WpPipewireObject
*
proxy
,
gpointer
d
)
{
WpDeviceActivation
*
self
=
WP_DEVICE_ACTIVATION
(
d
);
g_autoptr
(
WpIterator
)
profiles
=
NULL
;
/* 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
;
handle_device_profiles
(
self
,
proxy
,
profiles
);
}
static
void
...
...
@@ -228,7 +223,7 @@ wp_device_activation_enable (WpPlugin * plugin, WpTransition * transition)
self
->
devices_om
=
wp_object_manager_new
();
wp_object_manager_add_interest
(
self
->
devices_om
,
WP_TYPE_DEVICE
,
NULL
);
wp_object_manager_request_object_features
(
self
->
devices_om
,
WP_TYPE_DEVICE
,
WP_PIPEWIRE_OBJECT_FEATURES_
MINIM
AL
);
WP_TYPE_DEVICE
,
WP_PIPEWIRE_OBJECT_FEATURES_A
L
L
);
g_signal_connect_object
(
self
->
devices_om
,
"object-added"
,
G_CALLBACK
(
on_device_added
),
self
,
0
);
wp_core_install_object_manager
(
core
,
self
->
devices_om
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment