diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/pipeline/simple/converter.cpp | 30 | ||||
-rw-r--r-- | src/libcamera/pipeline/simple/converter.h | 6 | ||||
-rw-r--r-- | src/libcamera/pipeline/simple/simple.cpp | 2 |
3 files changed, 19 insertions, 19 deletions
diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp index 87d15c78..8f54caac 100644 --- a/src/libcamera/pipeline/simple/converter.cpp +++ b/src/libcamera/pipeline/simple/converter.cpp @@ -133,6 +133,21 @@ SizeRange SimpleConverter::sizes(const Size &input) return sizes; } +std::tuple<unsigned int, unsigned int> +SimpleConverter::strideAndFrameSize(const PixelFormat &pixelFormat, + const Size &size) +{ + V4L2DeviceFormat format; + format.fourcc = m2m_->capture()->toV4L2PixelFormat(pixelFormat); + format.size = size; + + int ret = m2m_->capture()->tryFormat(&format); + if (ret < 0) + return std::make_tuple(0, 0); + + return std::make_tuple(format.planes[0].bpl, format.planes[0].size); +} + int SimpleConverter::configure(PixelFormat inputFormat, const Size &inputSize, const StreamConfiguration &outputCfg) { @@ -254,19 +269,4 @@ 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 std::make_tuple(0, 0); - - return std::make_tuple(format.planes[0].bpl, format.planes[0].size); -} - } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/simple/converter.h b/src/libcamera/pipeline/simple/converter.h index 06d66f8c..dce3143c 100644 --- a/src/libcamera/pipeline/simple/converter.h +++ b/src/libcamera/pipeline/simple/converter.h @@ -36,6 +36,9 @@ public: std::vector<PixelFormat> formats(PixelFormat input); SizeRange sizes(const Size &input); + std::tuple<unsigned int, unsigned int> + strideAndFrameSize(const PixelFormat &pixelFormat, const Size &size); + int configure(PixelFormat inputFormat, const Size &inputSize, const StreamConfiguration &outputCfg); int exportBuffers(unsigned int count, @@ -46,9 +49,6 @@ public: int queueBuffers(FrameBuffer *input, FrameBuffer *output); - std::tuple<unsigned int, unsigned int> - strideAndFrameSize(const Size &size, const PixelFormat &pixelFormat); - Signal<FrameBuffer *, FrameBuffer *> bufferReady; private: diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 1f396612..4afc5aa7 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -494,7 +494,7 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate() SimpleConverter *converter = pipe->converter(); std::tie(cfg.stride, cfg.frameSize) = - converter->strideAndFrameSize(cfg.size, cfg.pixelFormat); + converter->strideAndFrameSize(cfg.pixelFormat, cfg.size); if (cfg.stride == 0) return Invalid; |