12 #include <initializer_list> 30 struct StreamConfiguration;
40 virtual bool isValid()
const = 0;
45 virtual std::tuple<unsigned int, unsigned int>
49 const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs) = 0;
51 std::vector<std::unique_ptr<FrameBuffer>> *buffers) = 0;
53 virtual int start() = 0;
54 virtual void stop() = 0;
57 const std::map<const Stream *, FrameBuffer *> &outputs) = 0;
62 const std::string &
deviceNode()
const {
return deviceNode_; }
65 std::string deviceNode_;
74 const std::vector<std::string> &
compatibles()
const {
return compatibles_; }
76 static std::unique_ptr<Converter> create(
MediaDevice *media);
77 static std::vector<ConverterFactoryBase *> &factories();
78 static std::vector<std::string> names();
85 virtual std::unique_ptr<Converter> createInstance(
MediaDevice *media)
const = 0;
88 std::vector<std::string> compatibles_;
91 template<
typename _Converter>
102 return std::make_unique<_Converter>(media);
106 #define REGISTER_CONVERTER(name, converter, compatibles) \ 107 static ConverterFactory<converter> global_##converter##Factory(name, compatibles); Utilities to help constructing class interfaces.
virtual std::vector< PixelFormat > formats(PixelFormat input)=0
Retrieve the list of supported pixel formats for an input pixel format.
virtual int configure(const StreamConfiguration &inputCfg, const std::vector< std::reference_wrapper< StreamConfiguration >> &outputCfgs)=0
Configure a set of output stream conversion from an input stream.
Video stream for a camera.
Definition: stream.h:74
virtual int start()=0
Start the converter streaming operation.
Signal< FrameBuffer * > inputBufferReady
A signal emitted when the input frame buffer completes.
Definition: converter.h:59
Top-level libcamera namespace.
Definition: backtrace.h:17
Base class for converter factories.
Definition: converter.h:68
std::unique_ptr< Converter > createInstance(MediaDevice *media) const override
Create an instance of the Converter corresponding to the factory.
Definition: converter.h:100
virtual int loadConfiguration(const std::string &filename)=0
Load converter configuration from file.
Frame buffer data and its associated dynamic metadata.
Definition: framebuffer.h:49
const std::vector< std::string > & compatibles() const
Definition: converter.h:74
Describe a two-dimensional size.
Definition: geometry.h:52
Signal & slot implementation.
virtual void stop()=0
Stop the converter streaming operation.
ConverterFactory(const char *name, std::initializer_list< std::string > compatibles)
Construct a converter factory.
Definition: converter.h:95
Converter(MediaDevice *media)
Construct a Converter instance.
Definition: converter.cpp:44
virtual SizeRange sizes(const Size &input)=0
Retrieve the range of minimum and maximum output sizes for an input size.
#define LIBCAMERA_DISABLE_COPY_AND_MOVE(klass)
Disable copy and move construction and assignment of the klass.
virtual std::tuple< unsigned int, unsigned int > strideAndFrameSize(const PixelFormat &pixelFormat, const Size &size)=0
Retrieve the output stride and frame size for an input configutation.
Signal< FrameBuffer * > outputBufferReady
A signal emitted on each frame buffer completion of the output queue.
Definition: converter.h:60
const std::string & deviceNode() const
The converter device node attribute accessor.
Definition: converter.h:62
Registration of ConverterFactory classes and creation of instances.
Definition: converter.h:92
virtual int exportBuffers(const Stream *stream, unsigned int count, std::vector< std::unique_ptr< FrameBuffer >> *buffers)=0
Export buffers from the converter device.
Generic signal and slot communication mechanism.
Definition: object.h:20
Describe a range of sizes.
Definition: geometry.h:200
virtual bool isValid() const =0
Check if the converter configuration is valid.
Data structures related to geometric objects.
virtual int queueBuffers(FrameBuffer *input, const std::map< const Stream *, FrameBuffer *> &outputs)=0
Queue buffers to converter device.
Configuration parameters for a stream.
Definition: stream.h:41
Abstract Base Class for converter.
Definition: converter.h:32