mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
spa: libcamera: rework construction/destruction of libcamera source impl
Move some things into constructors and try not to depend on the fact that the storage is zero initialized, try to initialize everything properly.
This commit is contained in:
parent
98193f7d67
commit
330686d3aa
2 changed files with 130 additions and 118 deletions
|
|
@ -40,7 +40,7 @@ int spa_libcamera_open(struct impl *impl)
|
|||
if (impl->acquired)
|
||||
return 0;
|
||||
|
||||
spa_log_info(impl->log, "open camera %s", impl->props.device);
|
||||
spa_log_info(impl->log, "open camera %s", impl->device_id.c_str());
|
||||
impl->camera->acquire();
|
||||
|
||||
impl->allocator = new FrameBufferAllocator(impl->camera);
|
||||
|
|
@ -57,7 +57,7 @@ int spa_libcamera_close(struct impl *impl)
|
|||
if (impl->active || port->have_format)
|
||||
return 0;
|
||||
|
||||
spa_log_info(impl->log, "close camera %s", impl->props.device);
|
||||
spa_log_info(impl->log, "close camera %s", impl->device_id.c_str());
|
||||
delete impl->allocator;
|
||||
impl->allocator = nullptr;
|
||||
|
||||
|
|
@ -674,7 +674,7 @@ static int spa_libcamera_stream_on(struct impl *impl)
|
|||
|
||||
impl->camera->requestCompleted.connect(impl, &impl::requestComplete);
|
||||
|
||||
spa_log_info(impl->log, "starting camera %s", impl->props.device);
|
||||
spa_log_info(impl->log, "starting camera %s", impl->device_id.c_str());
|
||||
if ((res = impl->camera->start()) < 0)
|
||||
return res == -EACCES ? -EBUSY : res;
|
||||
|
||||
|
|
@ -724,7 +724,7 @@ static int spa_libcamera_stream_off(struct impl *impl)
|
|||
return 0;
|
||||
}
|
||||
|
||||
spa_log_info(impl->log, "stopping camera %s", impl->props.device);
|
||||
spa_log_info(impl->log, "stopping camera %s", impl->device_id.c_str());
|
||||
impl->pendingRequests.clear();
|
||||
|
||||
if ((res = impl->camera->stop()) < 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue