diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-02-21 00:12:27 +0100 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-02-25 23:12:57 +0100 |
commit | 0cd7602e9cfc7db28138d5962563a77366a977f9 (patch) | |
tree | e3558e8ea16d9b618971994e97169ff5a0b51621 /src/libcamera/pipeline/vimc.cpp | |
parent | facb80bc5cd0e4f6e4e71ba915c1befa6e3fd73a (diff) |
libcamera: pipeline: vimc: enforce stream configuration
The format requested by configureStreams() should exactly match what is
programmed on the video device. If they do not match the call should
fail as the application in that case will not know what configuration
was actually programmed.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pipeline/vimc.cpp')
-rw-r--r-- | src/libcamera/pipeline/vimc.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index a93a7589..812777cf 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -83,6 +83,7 @@ int PipelineHandlerVimc::configureStreams(Camera *camera, std::map<Stream *, StreamConfiguration> &config) { StreamConfiguration *cfg = &config[&stream_]; + int ret; LOG(VIMC, Debug) << "Configure the camera for resolution " << cfg->width << "x" << cfg->height; @@ -92,7 +93,16 @@ int PipelineHandlerVimc::configureStreams(Camera *camera, format.height = cfg->height; format.fourcc = cfg->pixelFormat; - return video_->setFormat(&format); + ret = video_->setFormat(&format); + if (ret) + return ret; + + if (format.width != cfg->width || + format.height != cfg->height || + format.fourcc != cfg->pixelFormat) + return -EINVAL; + + return 0; } int PipelineHandlerVimc::allocateBuffers(Camera *camera, Stream *stream) |