mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 15:29:45 +03:00
android: CameraDevice: Add stop()
This adds CameraDevice::stop(), which cleans up the member variables of CameraDevice. It is called in CameraDevice::close() and CameraDevice::configureStreams(). Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
796109c8dc
commit
0b661d70ec
2 changed files with 14 additions and 7 deletions
|
@ -754,9 +754,18 @@ void CameraDevice::close()
|
|||
{
|
||||
streams_.clear();
|
||||
|
||||
stop();
|
||||
|
||||
camera_->release();
|
||||
}
|
||||
|
||||
void CameraDevice::stop()
|
||||
{
|
||||
if (!running_)
|
||||
return;
|
||||
|
||||
worker_.stop();
|
||||
camera_->stop();
|
||||
camera_->release();
|
||||
|
||||
running_ = false;
|
||||
}
|
||||
|
@ -1642,12 +1651,8 @@ PixelFormat CameraDevice::toPixelFormat(int format) const
|
|||
*/
|
||||
int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
|
||||
{
|
||||
/* Before any configuration attempt, stop the camera if it's running. */
|
||||
if (running_) {
|
||||
worker_.stop();
|
||||
camera_->stop();
|
||||
running_ = false;
|
||||
}
|
||||
/* Before any configuration attempt, stop the camera. */
|
||||
stop();
|
||||
|
||||
if (stream_list->num_streams == 0) {
|
||||
LOG(HAL, Error) << "No streams in configuration";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue