libcamera
v0.5.0+37-12007759
Supporting cameras in Linux since 2019
|
The V4L2 M2M converter implements the converter interface based on V4L2 M2M device. More...
Public Member Functions | |
V4L2M2MConverter (MediaDevice *media) | |
Construct a V4L2M2MConverter instance. More... | |
int | loadConfiguration ([[maybe_unused]] const std::string &filename) override |
bool | isValid () const override |
std::vector< PixelFormat > | formats (PixelFormat input) override |
SizeRange | sizes (const Size &input) override |
Retrieve the range of minimum and maximum output sizes for an input size. More... | |
std::tuple< unsigned int, unsigned int > | strideAndFrameSize (const PixelFormat &pixelFormat, const Size &size) override |
Retrieve the output stride and frame size for an input configutation. More... | |
Size | adjustInputSize (const PixelFormat &pixFmt, const Size &size, Alignment align=Alignment::Down) override |
Adjust the converter input size to a valid value. More... | |
Size | adjustOutputSize (const PixelFormat &pixFmt, const Size &size, Alignment align=Alignment::Down) override |
Adjust the converter output size to a valid value. More... | |
int | configure (const StreamConfiguration &inputCfg, const std::vector< std::reference_wrapper< StreamConfiguration >> &outputCfg) override |
Configure a set of output stream conversion from an input stream. More... | |
bool | isConfigured (const Stream *stream) const override |
Check if a given stream is configured. More... | |
int | exportBuffers (const Stream *stream, unsigned int count, std::vector< std::unique_ptr< FrameBuffer >> *buffers) override |
Export buffers from the converter device. More... | |
int | start () override |
Start the converter streaming operation. More... | |
void | stop () override |
Stop the converter streaming operation. More... | |
int | validateOutput (StreamConfiguration *cfg, bool *adjusted, Alignment align=Alignment::Down) override |
Validate and possibily adjust cfg to a valid converter output. More... | |
int | queueBuffers (FrameBuffer *input, const std::map< const Stream *, FrameBuffer *> &outputs) override |
Queue buffers to converter device. More... | |
int | setInputCrop (const Stream *stream, Rectangle *rect) override |
Set the crop rectangle rect for stream. More... | |
std::pair< Rectangle, Rectangle > | inputCropBounds () override |
Retrieve the crop bounds of the converter. More... | |
std::pair< Rectangle, Rectangle > | inputCropBounds (const Stream *stream) override |
Retrieve the crop bounds for stream. More... | |
![]() | |
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... | |
const std::string & | deviceNode () const |
The converter device node attribute accessor. More... | |
Features | features () const |
Retrieve the features supported by the converter. More... | |
Additional Inherited Members | |
![]() | |
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. | |
![]() | |
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. | |
![]() | |
Features | features_ |
Stores the features supported by the converter. | |
The V4L2 M2M converter implements the converter interface based on V4L2 M2M device.
libcamera::V4L2M2MConverter::V4L2M2MConverter | ( | MediaDevice * | media | ) |
Construct a V4L2M2MConverter instance.
[in] | media | The media device implementing the converter |
|
overridevirtual |
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 |
Implements libcamera::Converter.
|
overridevirtual |
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 |
Implements libcamera::Converter.
|
overridevirtual |
Configure a set of output stream conversion from an input stream.
[in] | inputCfg | Input stream configuration |
[out] | outputCfgs | A list of output stream configurations |
Implements libcamera::Converter.
|
overridevirtual |
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.
Implements libcamera::Converter.
|
overridevirtual |
[in] | input | Input pixel format to retrieve output pixel format list for |
Implements libcamera::Converter.
|
inlineoverridevirtual |
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.
Implements libcamera::Converter.
|
overridevirtual |
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.
Implements libcamera::Converter.
|
overridevirtual |
Check if a given stream is configured.
[in] | stream | The output stream |
Implements libcamera::Converter.
|
inlineoverridevirtual |
Implements libcamera::Converter.
|
inlineoverride |
[in] | filename | The file name path |
Load converter dependent configuration parameters to apply on the hardware.
|
overridevirtual |
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.
Implements libcamera::Converter.
|
overridevirtual |
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.
Implements libcamera::Converter.
Retrieve the range of minimum and maximum output sizes for an input size.
[in] | input | Input stream size to retrieve range for |
Implements libcamera::Converter.
|
overridevirtual |
Start the converter streaming operation.
Implements libcamera::Converter.
|
overridevirtual |
Stop the converter streaming operation.
Implements libcamera::Converter.
|
overridevirtual |
Retrieve the output stride and frame size for an input configutation.
[in] | pixelFormat | Input stream pixel format |
[in] | size | Input stream size |
Implements libcamera::Converter.
|
overridevirtual |
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 |
Implements libcamera::Converter.