libcamera: libcamera::Converter Class Reference

libcamera v0.0.5 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
libcamera::Converter Class Referenceabstract

Abstract Base Class for converter. More...

Inheritance diagram for libcamera::Converter:
[legend]
Collaboration diagram for libcamera::Converter:
[legend]

## Public Member Functions
| Converter (MediaDevice *media)
| Construct a Converter instance.
virtual int | loadConfiguration (const std::string &filename)=0
| Load converter configuration from file.
virtual bool | isValid () const =0
| Check if the converter configuration is valid.
virtual std::vector< PixelFormat > | formats (PixelFormat input)=0
| Retrieve the list of supported pixel formats for an input pixel format.
virtual SizeRange | sizes (const Size &input)=0
| Retrieve the range of minimum and maximum output sizes for an input size.
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.
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.
virtual int | exportBuffers (unsigned int output, unsigned int count, std::vector< std::unique_ptr< FrameBuffer > > *buffers)=0
| Export buffers from the converter device.
virtual int | start ()=0
| Start the converter streaming operation.
virtual void | stop ()=0
| Stop the converter streaming operation.
virtual int | queueBuffers (FrameBuffer *input, const std::map< unsigned int, FrameBuffer * > &outputs)=0
| Queue buffers to converter device.
const std::string & | deviceNode () const
| The converter device node attribute accessor.

## 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.

## Detailed Description

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.

## Constructor & Destructor Documentation

## ◆ Converter()

libcamera::Converter::Converter | ( | MediaDevice * | media | ) |

Construct a Converter instance.

Parameters

  [in] | media | The media device implementing the converter

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.

## Member Function Documentation

## ◆ configure()

libcamera::Converter::configure | ( | const StreamConfiguration & | inputCfg,
|  | const std::vector< std::reference_wrapper< StreamConfiguration > > & | outputCfgs
| ) |  |
| pure virtual

Configure a set of output stream conversion from an input stream.

Parameters

  [in] | inputCfg | Input stream configuration
  [out] | outputCfgs | A list of output stream configurations

Returns
  0 on success or a negative error code otherwise

Implemented in libcamera::V4L2M2MConverter.

## ◆ deviceNode()

libcamera::Converter::deviceNode | ( |  | ) | const
| inline

The converter device node attribute accessor.

Returns
  The converter device node string

## ◆ exportBuffers()

libcamera::Converter::exportBuffers | ( | unsigned int | output,
|  | unsigned int | count,
|  | std::vector< std::unique_ptr< FrameBuffer > > * | buffers
| ) |  |
| pure virtual

Export buffers from the converter device.

Parameters

  [in] | output | Output stream index 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 index.

Returns
  The number of allocated buffers on success or a negative error code otherwise

Implemented in libcamera::V4L2M2MConverter.

## ◆ formats()

libcamera::Converter::formats | ( | PixelFormat | input | ) |
| pure virtual

Retrieve the list of supported pixel formats for an input pixel format.

Parameters

  [in] | input | Input pixel format to retrieve output pixel format list for

Returns
  The list of supported output pixel formats

Implemented in libcamera::V4L2M2MConverter.

## ◆ isValid()

libcamera::Converter::isValid | ( |  | ) | const
| pure virtual

Check if the converter configuration is valid.

Returns
  True is the converter is valid, false otherwise

Implemented in libcamera::V4L2M2MConverter.

## ◆ loadConfiguration()

libcamera::Converter::loadConfiguration | ( | const std::string & | filename | ) |
| pure virtual

Load converter configuration from file.

Parameters

  [in] | filename | The file name path

Load converter dependent configuration parameters to apply on the hardware.

Returns
  0 on success or a negative error code otherwise

Implemented in libcamera::V4L2M2MConverter.

## ◆ queueBuffers()

libcamera::Converter::queueBuffers | ( | FrameBuffer * | input,
|  | const std::map< unsigned int, FrameBuffer * > & | outputs
| ) |  |
| pure virtual

Queue buffers to converter device.

Parameters

  [in] | input | The frame buffer to apply the conversion
  [out] | outputs | The container holding the output stream indexes 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.

Returns
  0 on success or a negative error code otherwise

Implemented in libcamera::V4L2M2MConverter.

## ◆ sizes()

libcamera::Converter::sizes | ( | const Size & | input | ) |
| pure virtual

Retrieve the range of minimum and maximum output sizes for an input size.

Parameters

  [in] | input | Input stream size to retrieve range for

Returns
  A range of output image sizes

Implemented in libcamera::V4L2M2MConverter.

## ◆ start()

libcamera::Converter::start | ( |  | ) |
| pure virtual

Start the converter streaming operation.

Returns
  0 on success or a negative error code otherwise

Implemented in libcamera::V4L2M2MConverter.

## ◆ stop()

libcamera::Converter::stop | ( |  | ) |
| pure virtual

Stop the converter streaming operation.

Implemented in libcamera::V4L2M2MConverter.

## ◆ strideAndFrameSize()

libcamera::Converter::strideAndFrameSize | ( | const PixelFormat & | pixelFormat,
|  | const Size & | size
| ) |  |
| pure virtual

Retrieve the output stride and frame size for an input configutation.

Parameters

  [in] | pixelFormat | Input stream pixel format
  [in] | size | Input stream size

Returns
  A tuple indicating the stride and frame size or an empty tuple on error

Implemented in libcamera::V4L2M2MConverter.

The documentation for this class was generated from the following files:

- include/libcamera/internal/converter.h
- src/libcamera/converter.cpp