summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/simple/converter.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-05-19 19:46:15 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-05-22 04:54:03 +0300
commit5331051c35fe5412901435d81b4153d307c04a49 (patch)
treec157815eeb1f1ef731fac27ab954a619bc07b1d8 /src/libcamera/pipeline/simple/converter.cpp
parent09eeec152086158e55870d8523b862b0731abdb5 (diff)
libcamera: pipeline: simple: Add stride support
Report the stride when configuring the camera. The stride is retrieved from the capture device first, and overridden by the converter if used. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera/pipeline/simple/converter.cpp')
-rw-r--r--src/libcamera/pipeline/simple/converter.cpp13
1 files changed, 8 insertions, 5 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;
}