[v1,18/33] libcamera: converter: converter_v4l2_m2m: Add makeStream() function
diff mbox series

Message ID 20250930122726.1837524-19-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • Full dewarper support on imx8mp
Related show

Commit Message

Stefan Klug Sept. 30, 2025, 12:26 p.m. UTC
Add a makeStream() function that is called by the converter to create a
corresponding stream. This can be overwritten by subclasses to be able
to implement a custom stream type.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 include/libcamera/internal/converter/converter_v4l2_m2m.h | 2 ++
 src/libcamera/converter/converter_v4l2_m2m.cpp            | 8 ++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h
index 615369c1a167..033c4ba42292 100644
--- a/include/libcamera/internal/converter/converter_v4l2_m2m.h
+++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h
@@ -127,6 +127,8 @@  protected:
 	Size adjustSizes(const Size &size, const std::vector<SizeRange> &ranges,
 			 Alignment align);
 
+	virtual std::unique_ptr<V4L2M2MStream> makeStream(const Stream *stream);
+
 	std::unique_ptr<V4L2M2MDevice> m2m_;
 
 	std::map<const Stream *, std::unique_ptr<V4L2M2MStream>> streams_;
diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp
index 43379b31881d..d6b95fbe9105 100644
--- a/src/libcamera/converter/converter_v4l2_m2m.cpp
+++ b/src/libcamera/converter/converter_v4l2_m2m.cpp
@@ -548,8 +548,7 @@  int V4L2M2MConverter::configure(const StreamConfiguration &inputCfg,
 
 	for (unsigned int i = 0; i < outputCfgs.size(); ++i) {
 		const StreamConfiguration &cfg = outputCfgs[i];
-		std::unique_ptr<V4L2M2MStream> stream =
-			std::make_unique<V4L2M2MStream>(this, cfg.stream());
+		std::unique_ptr<V4L2M2MStream> stream = makeStream(cfg.stream());
 
 		if (!stream->isValid()) {
 			LOG(Converter, Error)
@@ -796,6 +795,11 @@  bool V4L2M2MConverter::supportsRequests()
 	return ret;
 }
 
+std::unique_ptr<V4L2M2MConverter::V4L2M2MStream> V4L2M2MConverter::makeStream(const Stream *stream)
+{
+	return std::make_unique<V4L2M2MConverter::V4L2M2MStream>(this, stream);
+}
+
 /*
  * \todo This should be extended to include Feature::Flag to denote
  * what each converter supports feature-wise.