diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2020-07-04 17:56:25 +0900 |
---|---|---|
committer | Paul Elder <paul.elder@ideasonboard.com> | 2020-07-10 16:11:32 +0900 |
commit | 89fb1efac240451a2e463a405f4676910fc062b1 (patch) | |
tree | 6d1cc8254ab2b2ef21df64c2bdc75d12b369b80c /src/libcamera/pipeline/simple/converter.cpp | |
parent | 99b926bd124565aa98d7d47a40d8830813b7209e (diff) |
libcamera: simple: Fill stride and frameSize at config validation
Fill the stride and frameSize fields of the StreamConfiguration at
configuration validation time instead of at camera configuration time.
This allows applications to get the stride when trying a configuration
without modifying the active configuration of the camera.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/pipeline/simple/converter.cpp')
-rw-r--r-- | src/libcamera/pipeline/simple/converter.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp index e5e2f0fd..dc7c0463 100644 --- a/src/libcamera/pipeline/simple/converter.cpp +++ b/src/libcamera/pipeline/simple/converter.cpp @@ -261,4 +261,19 @@ void SimpleConverter::outputBufferReady(FrameBuffer *buffer) } } +std::tuple<unsigned int, unsigned int> +SimpleConverter::strideAndFrameSize(const Size &size, + const PixelFormat &pixelFormat) +{ + V4L2DeviceFormat format = {}; + format.fourcc = m2m_->capture()->toV4L2PixelFormat(pixelFormat); + format.size = size; + + int ret = m2m_->capture()->tryFormat(&format); + if (ret < 0) + return { 0, 0 }; + + return { format.planes[0].bpl, format.planes[0].size }; +} + } /* namespace libcamera */ |