diff options
Diffstat (limited to 'src/libcamera')
-rw-r--r-- | src/libcamera/pipeline/simple/converter.cpp | 13 | ||||
-rw-r--r-- | src/libcamera/pipeline/simple/converter.h | 4 | ||||
-rw-r--r-- | src/libcamera/pipeline/simple/simple.cpp | 5 |
3 files changed, 13 insertions, 9 deletions
diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp index 02443e7f..7a9d67b3 100644 --- a/src/libcamera/pipeline/simple/converter.cpp +++ b/src/libcamera/pipeline/simple/converter.cpp @@ -12,6 +12,7 @@ #include <libcamera/buffer.h> #include <libcamera/geometry.h> #include <libcamera/signal.h> +#include <libcamera/stream.h> #include "libcamera/internal/log.h" #include "libcamera/internal/media_device.h" @@ -93,14 +94,14 @@ std::vector<PixelFormat> SimpleConverter::formats(PixelFormat input) } int SimpleConverter::configure(PixelFormat inputFormat, - PixelFormat outputFormat, const Size &size) + StreamConfiguration *cfg) { V4L2DeviceFormat format; int ret; V4L2PixelFormat videoFormat = m2m_->output()->toV4L2PixelFormat(inputFormat); format.fourcc = videoFormat; - format.size = size; + format.size = cfg->size; ret = m2m_->output()->setFormat(&format); if (ret < 0) { @@ -109,7 +110,7 @@ int SimpleConverter::configure(PixelFormat inputFormat, return ret; } - if (format.fourcc != videoFormat || format.size != size) { + if (format.fourcc != videoFormat || format.size != cfg->size) { LOG(SimplePipeline, Error) << "Input format not supported"; return -EINVAL; @@ -119,7 +120,7 @@ int SimpleConverter::configure(PixelFormat inputFormat, * Set the pixel format on the output, the size is identical to the * input as we don't support scaling. */ - videoFormat = m2m_->capture()->toV4L2PixelFormat(outputFormat); + videoFormat = m2m_->capture()->toV4L2PixelFormat(cfg->pixelFormat); format.fourcc = videoFormat; ret = m2m_->capture()->setFormat(&format); @@ -129,12 +130,14 @@ int SimpleConverter::configure(PixelFormat inputFormat, return ret; } - if (format.fourcc != videoFormat || format.size != size) { + if (format.fourcc != videoFormat || format.size != cfg->size) { LOG(SimplePipeline, Error) << "Output format not supported"; return -EINVAL; } + cfg->stride = format.planes[0].bpl; + return 0; } diff --git a/src/libcamera/pipeline/simple/converter.h b/src/libcamera/pipeline/simple/converter.h index a33071fa..0beb96a5 100644 --- a/src/libcamera/pipeline/simple/converter.h +++ b/src/libcamera/pipeline/simple/converter.h @@ -20,6 +20,7 @@ namespace libcamera { class FrameBuffer; class MediaDevice; struct Size; +struct StreamConfiguration; class V4L2M2MDevice; class SimpleConverter @@ -33,8 +34,7 @@ public: std::vector<PixelFormat> formats(PixelFormat input); - int configure(PixelFormat inputFormat, PixelFormat outputFormat, - const Size &size); + int configure(PixelFormat inputFormat, StreamConfiguration *cfg); int exportBuffers(unsigned int count, std::vector<std::unique_ptr<FrameBuffer>> *buffers); diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 25651900..68595bc2 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -549,12 +549,13 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) return -EINVAL; } + cfg.stride = captureFormat.planes[0].bpl; + /* Configure the converter if required. */ useConverter_ = config->needConversion(); if (useConverter_) { - int ret = converter_->configure(pipeConfig.pixelFormat, - cfg.pixelFormat, cfg.size); + int ret = converter_->configure(pipeConfig.pixelFormat, &cfg); if (ret < 0) { LOG(SimplePipeline, Error) << "Unable to configure converter"; |