From 9abc05fae9364aae88eb0dc14b3f994905f276b3 Mon Sep 17 00:00:00 2001 From: Stefan Klug Date: Mon, 16 Dec 2024 16:40:48 +0100 Subject: libcamera: converter: Add function to query crop bounds The inputCropBounds_ member of the V4L2M2MConverter::Stream class is only initialized after a V4L2M2MConverter::configure() call, when the streams are initialized. However, the converter has crop limits that do not depend on the configured Streams, and which are currently not accessible from the class interface. Add a new inputCropBounds() function to the V4L2M2MConverter class that allows to retrieve the converter crop limits before any stream is configured. This is particularly useful for pipelines to initialize controls and properties and to implement validation before the Camera gets configured. Signed-off-by: Stefan Klug Reviewed-by: Paul Elder Reviewed-by: Jacopo Mondi --- include/libcamera/internal/converter.h | 1 + include/libcamera/internal/converter/converter_v4l2_m2m.h | 2 ++ 2 files changed, 3 insertions(+) (limited to 'include') diff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h index ffbb6f34..04187a2a 100644 --- a/include/libcamera/internal/converter.h +++ b/include/libcamera/internal/converter.h @@ -66,6 +66,7 @@ public: const std::map &outputs) = 0; virtual int setInputCrop(const Stream *stream, Rectangle *rect) = 0; + virtual std::pair inputCropBounds() = 0; virtual std::pair inputCropBounds(const Stream *stream) = 0; Signal inputBufferReady; diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h index 9b8e43ff..402a8039 100644 --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h @@ -60,6 +60,7 @@ public: const std::map &outputs) override; int setInputCrop(const Stream *stream, Rectangle *rect) override; + std::pair inputCropBounds() override { return inputCropBounds_; } std::pair inputCropBounds(const Stream *stream) override; private: @@ -106,6 +107,7 @@ private: std::map> streams_; std::map queue_; + std::pair inputCropBounds_; }; } /* namespace libcamera */ -- cgit v1.2.1