libcamera
v0.4.0+139-39419ce4
Supporting cameras in Linux since 2019
|
Abstract Base Class for converter. More...
Public Types | |
enum | Feature { None = 0, InputCrop = (1 << 0) } |
Specify the features supported by the converter. | |
enum | Alignment { Down = 0, Up } |
The alignment mode specified when adjusting the converter input or output sizes. | |
using | Features = Flags< Feature > |
A bitwise combination of features supported by the converter. | |
Public Member Functions | |
Converter (MediaDevice *media, Features features=Feature::None) | |
Construct a Converter instance. More... | |
virtual int | loadConfiguration (const std::string &filename)=0 |
Load converter configuration from file. More... | |
virtual bool | isValid () const =0 |
Check if the converter configuration is valid. More... | |
virtual std::vector< PixelFormat > | formats (PixelFormat input)=0 |
Retrieve the list of supported pixel formats for an input pixel format. More... | |
virtual SizeRange | sizes (const Size &input)=0 |
Retrieve the range of minimum and maximum output sizes for an input size. More... | |
virtual Size | adjustInputSize (const PixelFormat &pixFmt, const Size &size, Alignment align=Alignment::Down)=0 |
Adjust the converter input size to a valid value. More... | |
virtual Size | adjustOutputSize (const PixelFormat &pixFmt, const Size &size, Alignment align=Alignment::Down)=0 |
Adjust the converter output size to a valid value. More... | |
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. More... | |
virtual int | validateOutput (StreamConfiguration *cfg, bool *adjusted, Alignment align=Alignment::Down)=0 |
Validate and possibily adjust cfg to a valid converter output. More... | |
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. More... | |
virtual bool | isConfigured (const Stream *stream) const =0 |
Check if a given stream is configured. More... | |
virtual int | exportBuffers (const Stream *stream, unsigned int count, std::vector< std::unique_ptr< FrameBuffer >> *buffers)=0 |
Export buffers from the converter device. More... | |
virtual int | start ()=0 |
Start the converter streaming operation. More... | |
virtual void | stop ()=0 |
Stop the converter streaming operation. | |
virtual int | queueBuffers (FrameBuffer *input, const std::map< const Stream *, FrameBuffer *> &outputs)=0 |
Queue buffers to converter device. More... | |
virtual int | setInputCrop (const Stream *stream, Rectangle *rect)=0 |
Set the crop rectangle rect for stream. More... | |
virtual std::pair< Rectangle, Rectangle > | inputCropBounds ()=0 |
Retrieve the crop bounds of the converter. More... | |
virtual std::pair< Rectangle, Rectangle > | inputCropBounds (const Stream *stream)=0 |
Retrieve the crop bounds for stream. More... | |
const std::string & | deviceNode () const |
The converter device node attribute accessor. More... | |
Features | features () const |
Retrieve the features supported by the converter. More... | |
Public Attributes | |
Signal< FrameBuffer * > | inputBufferReady |
A signal emitted when the input frame buffer completes. | |
Signal< FrameBuffer * > | outputBufferReady |
A signal emitted on each frame buffer completion of the output queue. | |
Protected Attributes | |
Features | features_ |
Stores the features supported by the converter. | |
Abstract Base Class for converter.
The Converter class is an Abstract Base Class defining the interfaces of converter implementations.
Converters offer scaling and pixel format conversion services on an input stream. The converter can output multiple streams with individual conversion parameters from the same input stream.
libcamera::Converter::Converter | ( | MediaDevice * | media, |
Features | features = Feature::None |
||
) |
Construct a Converter instance.
[in] | media | The media device implementing the converter |
[in] | features | Features flags representing supported features |
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.
|
pure virtual |
Adjust the converter input size to a valid value.
[in] | pixFmt | The pixel format of the converter input stream |
[in] | size | The converter input size to adjust to a valid value |
[in] | align | The desired alignment |
Implemented in libcamera::V4L2M2MConverter.
|
pure virtual |
Adjust the converter output size to a valid value.
[in] | pixFmt | The pixel format of the converter output stream |
[in] | size | The converter output size to adjust to a valid value |
[in] | align | The desired alignment |
Implemented in libcamera::V4L2M2MConverter.
|
pure virtual |
Configure a set of output stream conversion from an input stream.
[in] | inputCfg | Input stream configuration |
[out] | outputCfgs | A list of output stream configurations |
Implemented in libcamera::V4L2M2MConverter.
|
inline |
The converter device node attribute accessor.
|
pure virtual |
Export buffers from the converter device.
[in] | stream | Output stream pointer exporting the buffers |
[in] | count | Number of buffers to allocate |
[out] | buffers | Vector to store allocated buffers |
This function operates similarly to V4L2VideoDevice::exportBuffers() on the output stream indicated by the output.
Implemented in libcamera::V4L2M2MConverter.
|
inline |
Retrieve the features supported by the converter.
|
pure virtual |
Retrieve the list of supported pixel formats for an input pixel format.
[in] | input | Input pixel format to retrieve output pixel format list for |
Implemented in libcamera::V4L2M2MConverter.
|
pure virtual |
Retrieve the crop bounds of the converter.
Retrieve the minimum and maximum crop bounds of the converter. This can be used to query the crop bounds before configuring a stream.
Implemented in libcamera::V4L2M2MConverter.
|
pure virtual |
Retrieve the crop bounds for stream.
[in] | stream | The output stream |
Retrieve the minimum and maximum crop bounds for stream. The converter should support cropping (Feature::InputCrop).
The crop bounds depend on the configuration of the output stream and hence this function should be called after the stream has been configured using configure().
When called with an unconfigured stream, this function returns a pair of null rectangles.
Implemented in libcamera::V4L2M2MConverter.
|
pure virtual |
Check if a given stream is configured.
[in] | stream | The output stream |
Implemented in libcamera::V4L2M2MConverter.
|
pure virtual |
Check if the converter configuration is valid.
Implemented in libcamera::V4L2M2MConverter.
|
pure virtual |
Load converter configuration from file.
[in] | filename | The file name path |
Load converter dependent configuration parameters to apply on the hardware.
|
pure virtual |
Queue buffers to converter device.
[in] | input | The frame buffer to apply the conversion |
[out] | outputs | The container holding the output stream pointers and their respective frame buffer outputs. |
This function queues the input frame buffer on the output streams of the outputs map key and retrieve the output frame buffer indicated by the buffer map value.
Implemented in libcamera::V4L2M2MConverter.
Set the crop rectangle rect for stream.
[in] | stream | The output stream |
[in,out] | rect | The crop rectangle to apply and return the rectangle that is actually applied |
Set the crop rectangle rect for stream provided the converter supports cropping. The converter has the Feature::InputCrop flag in this case.
The underlying hardware can adjust the rectangle supplied by the user due to hardware constraints. The caller can inspect rect to determine the actual rectangle that has been applied by the converter, after this function returns.
Implemented in libcamera::V4L2M2MConverter.
|
pure virtual |
Retrieve the range of minimum and maximum output sizes for an input size.
[in] | input | Input stream size to retrieve range for |
Implemented in libcamera::V4L2M2MConverter.
|
pure virtual |
Start the converter streaming operation.
Implemented in libcamera::V4L2M2MConverter.
|
pure virtual |
Retrieve the output stride and frame size for an input configutation.
[in] | pixelFormat | Input stream pixel format |
[in] | size | Input stream size |
Implemented in libcamera::V4L2M2MConverter.
|
pure virtual |
Validate and possibily adjust cfg to a valid converter output.
[in,out] | cfg | The StreamConfiguration to validate and adjust |
[out] | adjusted | Set to true if cfg has been adjusted |
[in] | align | The desired alignment |
Implemented in libcamera::V4L2M2MConverter.