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:
committed by
Laurent Pinchart
parent
796109c8dc
commit
0b661d70ec
@@ -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";
|
||||
|
||||
@@ -85,6 +85,8 @@ private:
|
||||
int androidFormat;
|
||||
};
|
||||
|
||||
void stop();
|
||||
|
||||
int initializeStreamConfigurations();
|
||||
std::vector<libcamera::Size>
|
||||
getYUVResolutions(libcamera::CameraConfiguration *cameraConfig,
|
||||
|
||||
Reference in New Issue
Block a user