mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-09 03:58:05 +02:00
m-standard-event-source: Emit '*-collected' and '*-dropped' events
These events are emitted when a global was collected into a collection or dropped from a collection respectively.
This commit is contained in:
parent
5a2b15c1a0
commit
a713270769
1 changed files with 32 additions and 0 deletions
|
|
@ -69,6 +69,7 @@ struct _WpStandardEventSource
|
|||
WpEventHook *rescan_done_hook;
|
||||
gboolean rescan_scheduled[N_RESCAN_CONTEXTS];
|
||||
gint n_oms_installed;
|
||||
WpCollectionManager *cm;
|
||||
};
|
||||
|
||||
static guint signals[N_SIGNALS] = {0};
|
||||
|
|
@ -310,6 +311,26 @@ wp_standard_event_source_schedule_rescan (WpStandardEventSource *self,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_global_collected (WpObjectManager *om, WpGlobalProxy *global,
|
||||
const gchar *collection_name, WpStandardEventSource *self)
|
||||
{
|
||||
g_autoptr (WpProperties) properties = wp_properties_new_empty ();
|
||||
wp_properties_set (properties, "event.subject.collection", collection_name);
|
||||
|
||||
wp_standard_event_source_push_event (self, "collected", global, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
on_global_dropped (WpObjectManager *om, WpGlobalProxy *global,
|
||||
const gchar *collection_name, WpStandardEventSource *self)
|
||||
{
|
||||
g_autoptr (WpProperties) properties = wp_properties_new_empty ();
|
||||
wp_properties_set (properties, "event.subject.collection", collection_name);
|
||||
|
||||
wp_standard_event_source_push_event (self, "dropped", global, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
on_metadata_changed (WpMetadata *obj, guint32 subject,
|
||||
const gchar *key, const gchar *spa_type, const gchar *value,
|
||||
|
|
@ -409,6 +430,15 @@ wp_standard_event_source_enable (WpPlugin * plugin, WpTransition * transition)
|
|||
wp_event_dispatcher_get_instance (core);
|
||||
g_return_if_fail (dispatcher);
|
||||
|
||||
/* Get the collection manager if any */
|
||||
self->cm = wp_collection_manager_find (core, NULL);
|
||||
if (self->cm) {
|
||||
g_signal_connect_object (self->cm, "global-collected",
|
||||
G_CALLBACK (on_global_collected), self, 0);
|
||||
g_signal_connect_object (self->cm, "global-dropped",
|
||||
G_CALLBACK (on_global_dropped), self, 0);
|
||||
}
|
||||
|
||||
/* install object managers */
|
||||
self->n_oms_installed = 0;
|
||||
for (gint i = 0; i < N_OBJECT_TYPES; i++) {
|
||||
|
|
@ -451,6 +481,8 @@ wp_standard_event_source_disable (WpPlugin * plugin)
|
|||
if (dispatcher)
|
||||
wp_event_dispatcher_unregister_hook (dispatcher, self->rescan_done_hook);
|
||||
g_clear_object (&self->rescan_done_hook);
|
||||
|
||||
g_clear_object (&self->cm);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue