diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-04-30 21:16:28 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-04-30 22:18:42 +0300 |
commit | a2dddf7c26df3307b9d4554c25387a00687a6234 (patch) | |
tree | be4004bb072d39d471ee790069e3f74d1cd5bbe0 /src/libcamera/pipeline/rkisp1/rkisp1.cpp | |
parent | baad55d00975f8931d51c333def20472457dc943 (diff) |
libcamera: Use the Size class through libcamera
Several of our structures include width and height fields that model a
size while we have a Size class for that purpose. Use the Size class
through libcamera, and give it a toString() method like other geometry
and format classes.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera/pipeline/rkisp1/rkisp1.cpp')
-rw-r--r-- | src/libcamera/pipeline/rkisp1/rkisp1.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 9a63a68b..7acf8515 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -116,10 +116,8 @@ CameraConfiguration PipelineHandlerRkISP1::streamConfiguration(Camera *camera, CameraConfiguration configs; StreamConfiguration config{}; - const Size &resolution = data->sensor_->resolution(); - config.width = resolution.width; - config.height = resolution.height; config.pixelFormat = V4L2_PIX_FMT_NV12; + config.size = data->sensor_->resolution(); config.bufferCount = RKISP1_BUFFER_COUNT; configs[&data->stream_] = config; @@ -137,8 +135,8 @@ int PipelineHandlerRkISP1::configureStreams(Camera *camera, /* Verify the configuration. */ const Size &resolution = sensor->resolution(); - if (cfg.width > resolution.width || - cfg.height > resolution.height) { + if (cfg.size.width > resolution.width || + cfg.size.height > resolution.height) { LOG(RkISP1, Error) << "Invalid stream size: larger than sensor resolution"; return -EINVAL; @@ -193,7 +191,7 @@ int PipelineHandlerRkISP1::configureStreams(Camera *camera, MEDIA_BUS_FMT_SGBRG8_1X8, MEDIA_BUS_FMT_SGRBG8_1X8, MEDIA_BUS_FMT_SRGGB8_1X8 }, - Size(cfg.width, cfg.height)); + cfg.size); LOG(RkISP1, Debug) << "Configuring sensor with " << format.toString(); @@ -216,17 +214,15 @@ int PipelineHandlerRkISP1::configureStreams(Camera *camera, return ret; V4L2DeviceFormat outputFormat = {}; - outputFormat.width = cfg.width; - outputFormat.height = cfg.height; outputFormat.fourcc = cfg.pixelFormat; + outputFormat.size = cfg.size; outputFormat.planesCount = 2; ret = video_->setFormat(&outputFormat); if (ret) return ret; - if (outputFormat.width != cfg.width || - outputFormat.height != cfg.height || + if (outputFormat.size != cfg.size || outputFormat.fourcc != cfg.pixelFormat) { LOG(RkISP1, Error) << "Unable to configure capture in " << cfg.toString(); |