summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-12-26 23:45:04 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-03-03 00:59:00 +0200
commitcc8da6b8c215d125d4a5c51a36697609f40b9362 (patch)
tree046e0251eadb5a4a2d868dab706522913e0b7db4
parent29bd5583c4ebbd62583c12d76d5d0aceb300b649 (diff)
libcamera: pipeline: simple: converter: Group query functions together
The SimpleConverter class has different sets of functions, related to static queries, device configuration and runtime operation. Group the query functions together. While at it, swap the arguments to the strideAndFrameSize() function to match the order in which pixel format and size are usually specified. No functional change is included. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Phi-Bang Nguyen <pnguyen@baylibre.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--src/libcamera/pipeline/simple/converter.cpp30
-rw-r--r--src/libcamera/pipeline/simple/converter.h6
-rw-r--r--src/libcamera/pipeline/simple/simple.cpp2
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;