mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
libcamera: emit device removal event
We need to emit the device id with NULL info to emit a device remove event. Also indent some code properly.
This commit is contained in:
parent
4da154c3a9
commit
a57590e334
2 changed files with 6 additions and 5 deletions
|
|
@ -77,8 +77,8 @@ static int emit_object_info(struct impl *this, uint32_t id)
|
|||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_API, "libcamera");
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_MEDIA_CLASS, "Video/Device");
|
||||
|
||||
info.props = &SPA_DICT_INIT(items, n_items);
|
||||
spa_device_emit_object_info(&this->hooks, id, &info);
|
||||
info.props = &SPA_DICT_INIT(items, n_items);
|
||||
spa_device_emit_object_info(&this->hooks, id, &info);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -112,18 +112,18 @@ impl_device_add_listener(void *object, struct spa_hook *listener,
|
|||
const struct spa_device_events *events, void *data)
|
||||
{
|
||||
struct impl *this = object;
|
||||
struct spa_hook_list save;
|
||||
struct spa_hook_list save;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(events != NULL, -EINVAL);
|
||||
|
||||
spa_hook_list_isolate(&this->hooks, &save, listener, events, data);
|
||||
spa_hook_list_isolate(&this->hooks, &save, listener, events, data);
|
||||
|
||||
emit_device_info(this, true);
|
||||
|
||||
emit_object_info(this, 0);
|
||||
|
||||
spa_hook_list_join(&this->hooks, &save);
|
||||
spa_hook_list_join(&this->hooks, &save);
|
||||
|
||||
listener->removed = impl_hook_removed;
|
||||
listener->priv = this;
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ static void try_remove_camera(struct impl *impl, const Camera *camera)
|
|||
return;
|
||||
|
||||
spa_log_info(impl->log, "camera removed: %s", device->camera->id().c_str());
|
||||
spa_device_emit_object_info(&impl->hooks, device->id, NULL);
|
||||
remove_device(impl, device);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue