From 417c1cd7560ffbf3ac3f07af59f64aa062e9f1a7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 28 Nov 2018 11:12:36 +0100 Subject: [PATCH] device: add media.class to global properties --- src/modules/spa/spa-device.c | 3 +-- src/pipewire/device.c | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/spa/spa-device.c b/src/modules/spa/spa-device.c index 6f2686c5c..66bbea7ba 100644 --- a/src/modules/spa/spa-device.c +++ b/src/modules/spa/spa-device.c @@ -111,12 +111,11 @@ pw_spa_device_new(struct pw_core *core, impl->user_data = SPA_MEMBER(impl, sizeof(struct impl), void); pw_device_add_listener(this, &impl->device_listener, &device_events, impl); + pw_device_set_implementation(this, impl->device); if (!SPA_FLAG_CHECK(impl->flags, PW_SPA_DEVICE_FLAG_NO_REGISTER)) pw_device_register(this, impl->owner, impl->parent, NULL); - pw_device_set_implementation(this, impl->device); - return this; } diff --git a/src/pipewire/device.c b/src/pipewire/device.c index 690dc9712..35facd58f 100644 --- a/src/pipewire/device.c +++ b/src/pipewire/device.c @@ -155,6 +155,7 @@ int pw_device_register(struct pw_device *device, struct pw_properties *properties) { struct pw_core *core = device->core; + const char *str; if (properties == NULL) properties = pw_properties_new(NULL, NULL); @@ -162,6 +163,8 @@ int pw_device_register(struct pw_device *device, return -ENOMEM; pw_properties_set(properties, "device.name", device->info.name); + if ((str = pw_properties_get(device->properties, "media.class")) != NULL) + pw_properties_set(properties, "media.class", str); spa_list_append(&core->device_list, &device->link); device->registered = true; @@ -294,7 +297,6 @@ static const struct spa_device_callbacks device_callbacks = { void pw_device_set_implementation(struct pw_device *device, struct spa_device *spa_device) { device->implementation = spa_device; - spa_device_set_callbacks(device->implementation, &device_callbacks, device); }