mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
dbus: Add signal org.PulseAudio.Core1.Card.NewProfile
Add a new D-Bus signal to report profiles that have been dynamically created for already existing cards.
This commit is contained in:
parent
9c703f4e2d
commit
ebfd656fc9
1 changed files with 16 additions and 0 deletions
|
|
@ -108,15 +108,18 @@ static pa_dbus_method_handler method_handlers[METHOD_HANDLER_MAX] = {
|
|||
|
||||
enum signal_index {
|
||||
SIGNAL_ACTIVE_PROFILE_UPDATED,
|
||||
SIGNAL_NEW_PROFILE,
|
||||
SIGNAL_PROPERTY_LIST_UPDATED,
|
||||
SIGNAL_MAX
|
||||
};
|
||||
|
||||
static pa_dbus_arg_info active_profile_updated_args[] = { { "profile", "o", NULL } };
|
||||
static pa_dbus_arg_info new_profile_args[] = { { "profile", "o", NULL } };
|
||||
static pa_dbus_arg_info property_list_updated_args[] = { { "property_list", "a{say}", NULL } };
|
||||
|
||||
static pa_dbus_signal_info signals[SIGNAL_MAX] = {
|
||||
[SIGNAL_ACTIVE_PROFILE_UPDATED] = { .name = "ActiveProfileUpdated", .arguments = active_profile_updated_args, .n_arguments = 1 },
|
||||
[SIGNAL_NEW_PROFILE] = { .name = "NewProfile", .arguments = new_profile_args, .n_arguments = 1 },
|
||||
[SIGNAL_PROPERTY_LIST_UPDATED] = { .name = "PropertyListUpdated", .arguments = property_list_updated_args, .n_arguments = 1 }
|
||||
};
|
||||
|
||||
|
|
@ -485,6 +488,8 @@ static pa_hook_result_t card_profile_added_cb(void *hook_data, void *call_data,
|
|||
pa_dbusiface_card *c = slot_data;
|
||||
pa_card_profile *profile = call_data;
|
||||
pa_dbusiface_card_profile *p;
|
||||
const char *object_path;
|
||||
DBusMessage *signal_msg;
|
||||
|
||||
if (profile->card != c->card)
|
||||
return PA_HOOK_OK;
|
||||
|
|
@ -492,6 +497,17 @@ static pa_hook_result_t card_profile_added_cb(void *hook_data, void *call_data,
|
|||
p = pa_dbusiface_card_profile_new(c, core, profile, c->next_profile_index++);
|
||||
pa_assert_se(pa_hashmap_put(c->profiles, pa_dbusiface_card_profile_get_name(p), p) >= 0);
|
||||
|
||||
/* Send D-Bus signal */
|
||||
object_path = pa_dbusiface_card_profile_get_path(p);
|
||||
|
||||
pa_assert_se(signal_msg = dbus_message_new_signal(c->path,
|
||||
PA_DBUSIFACE_CARD_INTERFACE,
|
||||
signals[SIGNAL_NEW_PROFILE].name));
|
||||
pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
|
||||
|
||||
pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
|
||||
dbus_message_unref(signal_msg);
|
||||
|
||||
return PA_HOOK_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue