diff --git a/src/examples/media-session/bluez-monitor.c b/src/examples/media-session/bluez-monitor.c index 1abf367d1..b9029de34 100644 --- a/src/examples/media-session/bluez-monitor.c +++ b/src/examples/media-session/bluez-monitor.c @@ -31,12 +31,14 @@ #include "config.h" #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -229,9 +231,37 @@ static void bluez5_device_object_info(void *data, uint32_t id, } +static void bluez_device_event(void *data, const struct spa_event *event) +{ + struct device *device = data; + struct node *node; + uint32_t id, type; + struct spa_pod *props = NULL; + + if (spa_pod_parse_object(&event->pod, + SPA_TYPE_EVENT_Device, &type, + SPA_EVENT_DEVICE_Object, SPA_POD_Int(&id), + SPA_EVENT_DEVICE_Props, SPA_POD_OPT_Pod(&props)) < 0) + return; + + if ((node = bluez5_find_node(device, id)) == NULL) + return; + + switch (type) { + case SPA_DEVICE_EVENT_ObjectConfig: + if (props) + pw_node_set_param((struct pw_node*)node->snode->obj.proxy, + SPA_PARAM_Props, 0, props); + break; + default: + break; + } +} + static const struct spa_device_events bluez5_device_events = { SPA_VERSION_DEVICE_EVENTS, - .object_info = bluez5_device_object_info + .object_info = bluez5_device_object_info, + .event = bluez_device_event, }; static struct device *bluez5_find_device(struct impl *impl, uint32_t id)