summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Klug <stefan.klug@ideasonboard.com>2024-12-16 16:40:49 +0100
committerStefan Klug <stefan.klug@ideasonboard.com>2024-12-17 10:33:14 +0100
commit06346821bec52d5dd0f337cef13c73f9ee24e79c (patch)
tree4b30ca89a71e12186e3e4002422a3862381b71e7
parent9abc05fae9364aae88eb0dc14b3f994905f276b3 (diff)
libcamera: converter: Add function to check if a stream was configured
Add a isConfigured() function to be able to check if a given stream was configured in the converter. This is useful in pipelines to either query device or stream specific crop bounds depending on whether the stream is configured or not. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
-rw-r--r--include/libcamera/internal/converter.h1
-rw-r--r--include/libcamera/internal/converter/converter_v4l2_m2m.h1
-rw-r--r--src/libcamera/converter.cpp7
-rw-r--r--src/libcamera/converter/converter_v4l2_m2m.cpp8
4 files changed, 17 insertions, 0 deletions
diff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h
index 04187a2a..afea4624 100644
--- a/include/libcamera/internal/converter.h
+++ b/include/libcamera/internal/converter.h
@@ -56,6 +56,7 @@ public:
virtual int configure(const StreamConfiguration &inputCfg,
const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs) = 0;
+ virtual bool isConfigured(const Stream *stream) const = 0;
virtual int exportBuffers(const Stream *stream, unsigned int count,
std::vector<std::unique_ptr<FrameBuffer>> *buffers) = 0;
diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h
index 402a8039..1ccbfc7c 100644
--- a/include/libcamera/internal/converter/converter_v4l2_m2m.h
+++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h
@@ -50,6 +50,7 @@ public:
int configure(const StreamConfiguration &inputCfg,
const std::vector<std::reference_wrapper<StreamConfiguration>>
&outputCfg) override;
+ bool isConfigured(const Stream *stream) const override;
int exportBuffers(const Stream *stream, unsigned int count,
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
diff --git a/src/libcamera/converter.cpp b/src/libcamera/converter.cpp
index 73c02fdc..09ebf4f5 100644
--- a/src/libcamera/converter.cpp
+++ b/src/libcamera/converter.cpp
@@ -127,6 +127,13 @@ Converter::~Converter()
*/
/**
+ * \fn Converter::isConfigured()
+ * \brief Check if a given stream is configured
+ * \param[in] stream The output stream
+ * \return True if the \a stream is configured or false otherwise
+ */
+
+/**
* \fn Converter::exportBuffers()
* \brief Export buffers from the converter device
* \param[in] stream Output stream pointer exporting the buffers
diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp
index 342aa32d..83daca15 100644
--- a/src/libcamera/converter/converter_v4l2_m2m.cpp
+++ b/src/libcamera/converter/converter_v4l2_m2m.cpp
@@ -438,6 +438,14 @@ int V4L2M2MConverter::configure(const StreamConfiguration &inputCfg,
}
/**
+ * \copydoc libcamera::Converter::isConfigured
+ */
+bool V4L2M2MConverter::isConfigured(const Stream *stream) const
+{
+ return streams_.find(stream) != streams_.end();
+}
+
+/**
* \copydoc libcamera::Converter::exportBuffers
*/
int V4L2M2MConverter::exportBuffers(const Stream *stream, unsigned int count,