mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
media-session: apply updated properties to bluez/v4l2 device handle
This commit is contained in:
parent
41d4039ee4
commit
e7cecaaea6
2 changed files with 48 additions and 45 deletions
|
|
@ -427,13 +427,30 @@ static struct device *bluez5_create_device(struct impl *impl, uint32_t id,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
device = calloc(1, sizeof(*device));
|
||||||
|
if (device == NULL) {
|
||||||
|
res = -errno;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
device->impl = impl;
|
||||||
|
device->id = id;
|
||||||
|
device->priority = 1000;
|
||||||
|
device->props = pw_properties_new_dict(info->props);
|
||||||
|
update_device_props(device);
|
||||||
|
|
||||||
|
spa_list_init(&device->node_list);
|
||||||
|
|
||||||
|
if ((rules = pw_properties_get(impl->conf, "rules")) != NULL)
|
||||||
|
sm_media_session_match_rules(rules, strlen(rules), device->props);
|
||||||
|
|
||||||
handle = pw_context_load_spa_handle(context,
|
handle = pw_context_load_spa_handle(context,
|
||||||
info->factory_name,
|
info->factory_name,
|
||||||
info->props);
|
&device->props->dict);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
pw_log_error("can't make factory instance: %m");
|
pw_log_error("can't make factory instance: %m");
|
||||||
goto exit;
|
goto clean_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) {
|
if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) {
|
||||||
|
|
@ -441,31 +458,15 @@ static struct device *bluez5_create_device(struct impl *impl, uint32_t id,
|
||||||
goto unload_handle;
|
goto unload_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
device = calloc(1, sizeof(*device));
|
device->handle = handle;
|
||||||
if (device == NULL) {
|
device->device = iface;
|
||||||
|
device->sdevice = sm_media_session_export_device(impl->session,
|
||||||
|
&device->props->dict, device->device);
|
||||||
|
if (device->sdevice == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto unload_handle;
|
goto unload_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
device->impl = impl;
|
|
||||||
device->id = id;
|
|
||||||
device->priority = 1000;
|
|
||||||
device->handle = handle;
|
|
||||||
device->device = iface;
|
|
||||||
device->props = pw_properties_new_dict(info->props);
|
|
||||||
update_device_props(device);
|
|
||||||
device->sdevice = sm_media_session_export_device(impl->session,
|
|
||||||
&device->props->dict, device->device);
|
|
||||||
if (device->sdevice == NULL) {
|
|
||||||
res = -errno;
|
|
||||||
goto clean_device;
|
|
||||||
}
|
|
||||||
|
|
||||||
spa_list_init(&device->node_list);
|
|
||||||
|
|
||||||
if ((rules = pw_properties_get(impl->conf, "rules")) != NULL)
|
|
||||||
sm_media_session_match_rules(rules, strlen(rules), device->props);
|
|
||||||
|
|
||||||
sm_object_add_listener(&device->sdevice->obj,
|
sm_object_add_listener(&device->sdevice->obj,
|
||||||
&device->listener,
|
&device->listener,
|
||||||
&device_events, device);
|
&device_events, device);
|
||||||
|
|
@ -474,11 +475,11 @@ static struct device *bluez5_create_device(struct impl *impl, uint32_t id,
|
||||||
|
|
||||||
return device;
|
return device;
|
||||||
|
|
||||||
|
unload_handle:
|
||||||
|
pw_unload_spa_handle(handle);
|
||||||
clean_device:
|
clean_device:
|
||||||
pw_properties_free(device->props);
|
pw_properties_free(device->props);
|
||||||
free(device);
|
free(device);
|
||||||
unload_handle:
|
|
||||||
pw_unload_spa_handle(handle);
|
|
||||||
exit:
|
exit:
|
||||||
errno = -res;
|
errno = -res;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -421,13 +421,27 @@ static struct device *v4l2_create_device(struct impl *impl, uint32_t id,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dev = calloc(1, sizeof(*dev));
|
||||||
|
if (dev == NULL) {
|
||||||
|
res = -errno;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
dev->impl = impl;
|
||||||
|
dev->id = id;
|
||||||
|
dev->props = pw_properties_new_dict(info->props);
|
||||||
|
v4l2_update_device_props(dev);
|
||||||
|
|
||||||
|
if ((rules = pw_properties_get(impl->conf, "rules")) != NULL)
|
||||||
|
sm_media_session_match_rules(rules, strlen(rules), dev->props);
|
||||||
|
|
||||||
handle = pw_context_load_spa_handle(context,
|
handle = pw_context_load_spa_handle(context,
|
||||||
info->factory_name,
|
info->factory_name,
|
||||||
info->props);
|
&dev->props->dict);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
pw_log_error("can't make factory instance: %m");
|
pw_log_error("can't make factory instance: %m");
|
||||||
goto exit;
|
goto clean_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) {
|
if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) {
|
||||||
|
|
@ -435,24 +449,11 @@ static struct device *v4l2_create_device(struct impl *impl, uint32_t id,
|
||||||
goto unload_handle;
|
goto unload_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev = calloc(1, sizeof(*dev));
|
|
||||||
if (dev == NULL) {
|
|
||||||
res = -errno;
|
|
||||||
goto unload_handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev->impl = impl;
|
|
||||||
dev->id = id;
|
|
||||||
dev->handle = handle;
|
dev->handle = handle;
|
||||||
dev->device = iface;
|
dev->device = iface;
|
||||||
dev->props = pw_properties_new_dict(info->props);
|
|
||||||
v4l2_update_device_props(dev);
|
|
||||||
|
|
||||||
if ((rules = pw_properties_get(impl->conf, "rules")) != NULL)
|
|
||||||
sm_media_session_match_rules(rules, strlen(rules), dev->props);
|
|
||||||
|
|
||||||
dev->sdevice = sm_media_session_export_device(impl->session,
|
dev->sdevice = sm_media_session_export_device(impl->session,
|
||||||
&dev->props->dict, dev->device);
|
&dev->props->dict, dev->device);
|
||||||
|
|
||||||
if (dev->sdevice == NULL) {
|
if (dev->sdevice == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
|
|
@ -470,10 +471,11 @@ static struct device *v4l2_create_device(struct impl *impl, uint32_t id,
|
||||||
|
|
||||||
return dev;
|
return dev;
|
||||||
|
|
||||||
clean_device:
|
|
||||||
free(dev);
|
|
||||||
unload_handle:
|
unload_handle:
|
||||||
pw_unload_spa_handle(handle);
|
pw_unload_spa_handle(handle);
|
||||||
|
clean_device:
|
||||||
|
pw_properties_free(dev->props);
|
||||||
|
free(dev);
|
||||||
exit:
|
exit:
|
||||||
errno = -res;
|
errno = -res;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue