From 06346821bec52d5dd0f337cef13c73f9ee24e79c Mon Sep 17 00:00:00 2001 From: Stefan Klug Date: Mon, 16 Dec 2024 16:40:49 +0100 Subject: 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 Reviewed-by: Jacopo Mondi Reviewed-by: Paul Elder --- src/libcamera/converter.cpp | 7 +++++++ src/libcamera/converter/converter_v4l2_m2m.cpp | 8 ++++++++ 2 files changed, 15 insertions(+) (limited to 'src') 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 @@ -126,6 +126,13 @@ Converter::~Converter() * \return 0 on success or a negative error code otherwise */ +/** + * \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 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 @@ -437,6 +437,14 @@ int V4L2M2MConverter::configure(const StreamConfiguration &inputCfg, return 0; } +/** + * \copydoc libcamera::Converter::isConfigured + */ +bool V4L2M2MConverter::isConfigured(const Stream *stream) const +{ + return streams_.find(stream) != streams_.end(); +} + /** * \copydoc libcamera::Converter::exportBuffers */ -- cgit v1.2.1