From e31b59eda735dcda8eecc11fd83f5ae9fe42892d Mon Sep 17 00:00:00 2001 From: Naushir Patuck Date: Fri, 1 Mar 2024 11:22:51 +0000 Subject: [PATCH] core: Deprecate properties::ScalerCropMaximum This property will be removed from libcamera soon. Replace it with the maximum value of controls::ScalerCrop, which the pipeline handler sets to the same rectangle. Signed-off-by: Naushir Patuck --- core/options.cpp | 4 ++-- core/rpicam_app.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/options.cpp b/core/options.cpp index abf11a69..45fc0444 100644 --- a/core/options.cpp +++ b/core/options.cpp @@ -302,10 +302,10 @@ bool Options::Parse(int argc, char *argv[]) } auto fd_ctrl = cam->controls().find(&controls::FrameDurationLimits); - auto crop_ctrl = cam->properties().get(properties::ScalerCropMaximum); + auto crop_ctrl = cam->controls().at(&controls::ScalerCrop).max().get(); double fps = fd_ctrl == cam->controls().end() ? NAN : (1e6 / fd_ctrl->second.min().get()); std::cout << std::fixed << std::setprecision(2) << "[" - << fps << " fps - " << crop_ctrl->toString() << " crop" << "]"; + << fps << " fps - " << crop_ctrl.toString() << " crop" << "]"; if (--num) { std::cout << std::endl; diff --git a/core/rpicam_app.cpp b/core/rpicam_app.cpp index 7956da7b..84b25af3 100644 --- a/core/rpicam_app.cpp +++ b/core/rpicam_app.cpp @@ -680,7 +680,7 @@ void RPiCamApp::StartCamera() // We don't overwrite anything the application may have set before calling us. if (!controls_.get(controls::ScalerCrop) && options_->roi_width != 0 && options_->roi_height != 0) { - Rectangle sensor_area = *camera_->properties().get(properties::ScalerCropMaximum); + Rectangle sensor_area = camera_->controls().at(&controls::ScalerCrop).max().get(); int x = options_->roi_x * sensor_area.width; int y = options_->roi_y * sensor_area.height; int w = options_->roi_width * sensor_area.width; @@ -694,7 +694,7 @@ void RPiCamApp::StartCamera() if (!controls_.get(controls::AfWindows) && !controls_.get(controls::AfMetering) && options_->afWindow_width != 0 && options_->afWindow_height != 0) { - Rectangle sensor_area = *camera_->properties().get(properties::ScalerCropMaximum); + Rectangle sensor_area = camera_->controls().at(&controls::ScalerCrop).max().get(); int x = options_->afWindow_x * sensor_area.width; int y = options_->afWindow_y * sensor_area.height; int w = options_->afWindow_width * sensor_area.width;