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>
This commit is contained in:
Stefan Klug 2024-12-16 16:40:49 +01:00
parent 9abc05fae9
commit 06346821be
4 changed files with 17 additions and 0 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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
*/