mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 15:29:45 +03:00
libcamera: converter: Add interface for feature flags
This patch intends to extend the converter interface to have feature flags, which enables each converter to expose the set of features it supports. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
994588fb75
commit
7fad22efae
3 changed files with 43 additions and 2 deletions
|
@ -17,6 +17,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <libcamera/base/class.h>
|
#include <libcamera/base/class.h>
|
||||||
|
#include <libcamera/base/flags.h>
|
||||||
#include <libcamera/base/signal.h>
|
#include <libcamera/base/signal.h>
|
||||||
|
|
||||||
#include <libcamera/geometry.h>
|
#include <libcamera/geometry.h>
|
||||||
|
@ -32,7 +33,13 @@ struct StreamConfiguration;
|
||||||
class Converter
|
class Converter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Converter(MediaDevice *media);
|
enum class Feature {
|
||||||
|
None = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
using Features = Flags<Feature>;
|
||||||
|
|
||||||
|
Converter(MediaDevice *media, Features features = Feature::None);
|
||||||
virtual ~Converter();
|
virtual ~Converter();
|
||||||
|
|
||||||
virtual int loadConfiguration(const std::string &filename) = 0;
|
virtual int loadConfiguration(const std::string &filename) = 0;
|
||||||
|
@ -61,6 +68,11 @@ public:
|
||||||
|
|
||||||
const std::string &deviceNode() const { return deviceNode_; }
|
const std::string &deviceNode() const { return deviceNode_; }
|
||||||
|
|
||||||
|
Features features() const { return features_; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Features features_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string deviceNode_;
|
std::string deviceNode_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,14 +34,27 @@ LOG_DEFINE_CATEGORY(Converter)
|
||||||
* parameters from the same input stream.
|
* parameters from the same input stream.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \enum Converter::Feature
|
||||||
|
* \brief Specify the features supported by the converter
|
||||||
|
* \var Converter::Feature::None
|
||||||
|
* \brief No extra features supported by the converter
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \typedef Converter::Features
|
||||||
|
* \brief A bitwise combination of features supported by the converter
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Construct a Converter instance
|
* \brief Construct a Converter instance
|
||||||
* \param[in] media The media device implementing the converter
|
* \param[in] media The media device implementing the converter
|
||||||
|
* \param[in] features Features flags representing supported features
|
||||||
*
|
*
|
||||||
* This searches for the entity implementing the data streaming function in the
|
* This searches for the entity implementing the data streaming function in the
|
||||||
* media graph entities and use its device node as the converter device node.
|
* media graph entities and use its device node as the converter device node.
|
||||||
*/
|
*/
|
||||||
Converter::Converter(MediaDevice *media)
|
Converter::Converter(MediaDevice *media, Features features)
|
||||||
{
|
{
|
||||||
const std::vector<MediaEntity *> &entities = media->entities();
|
const std::vector<MediaEntity *> &entities = media->entities();
|
||||||
auto it = std::find_if(entities.begin(), entities.end(),
|
auto it = std::find_if(entities.begin(), entities.end(),
|
||||||
|
@ -56,6 +69,7 @@ Converter::Converter(MediaDevice *media)
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceNode_ = (*it)->deviceNode();
|
deviceNode_ = (*it)->deviceNode();
|
||||||
|
features_ = features;
|
||||||
}
|
}
|
||||||
|
|
||||||
Converter::~Converter()
|
Converter::~Converter()
|
||||||
|
@ -157,12 +171,23 @@ Converter::~Converter()
|
||||||
* \brief A signal emitted on each frame buffer completion of the output queue
|
* \brief A signal emitted on each frame buffer completion of the output queue
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \var Converter::features_
|
||||||
|
* \brief Stores the features supported by the converter
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn Converter::deviceNode()
|
* \fn Converter::deviceNode()
|
||||||
* \brief The converter device node attribute accessor
|
* \brief The converter device node attribute accessor
|
||||||
* \return The converter device node string
|
* \return The converter device node string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \fn Converter::features()
|
||||||
|
* \brief Retrieve the features supported by the converter
|
||||||
|
* \return The converter Features flags
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class ConverterFactoryBase
|
* \class ConverterFactoryBase
|
||||||
* \brief Base class for converter factories
|
* \brief Base class for converter factories
|
||||||
|
|
|
@ -446,6 +446,10 @@ int V4L2M2MConverter::queueBuffers(FrameBuffer *input,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \todo: This should be extended to include Feature::Flag to denote
|
||||||
|
* what each converter supports feature-wise.
|
||||||
|
*/
|
||||||
static std::initializer_list<std::string> compatibles = {
|
static std::initializer_list<std::string> compatibles = {
|
||||||
"mtk-mdp",
|
"mtk-mdp",
|
||||||
"pxp",
|
"pxp",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue