Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Video format APIs. More...

Functions

int video_estimate_fmt_size (struct video_format *fmt)
 Estimate the size and pitch in bytes of a video_format.
int video_set_compose_format (const struct device *dev, struct video_format *fmt)
 Set compose rectangle (if applicable) prior to setting format.
int video_set_format (const struct device *dev, struct video_format *fmt)
 Set video format.
int video_get_format (const struct device *dev, struct video_format *fmt)
 Get video format of a driver.
int video_set_selection (const struct device *dev, struct video_selection *sel)
 Set video selection (crop/compose).
int video_get_selection (const struct device *dev, struct video_selection *sel)
 Get video selection (crop/compose).

Detailed Description

Video format APIs.

Function Documentation

◆ video_estimate_fmt_size()

int video_estimate_fmt_size ( struct video_format * fmt)

#include <video.h>

Estimate the size and pitch in bytes of a video_format.

This helper should only be used by drivers that support the whole image frame.

For uncompressed formats, it gives the actual size and pitch of the whole raw image without any padding.

For compressed formats, it gives a rough estimate size of a complete compressed frame.

Parameters
fmtPointer to the video format structure
Returns
0 on success, otherwise a negative errno code

◆ video_get_format()

int video_get_format ( const struct device * dev,
struct video_format * fmt )

#include <video.h>

Get video format of a driver.

Get video device current video format.

Parameters
devPointer to the device structure for the driver instance.
fmtPointer to video format struct.
Return values
pointerto video format

◆ video_get_selection()

int video_get_selection ( const struct device * dev,
struct video_selection * sel )

#include <video.h>

Get video selection (crop/compose).

Retrieve the current settings related to the crop and compose of the video device. This can also be used to read the native size of the input stream of the video device. This function can be used to read crop / compose capabilities of the device prior to performing configuration via the video_set_selection api.

Parameters
devPointer to the device structure for the driver instance.
selPointer to a video selection structure, type and target set by the caller
Return values
0If successful.
-EINVALIf parameters are invalid.
-ENOTSUPIf format is not supported.
-EIOGeneral input / output error.

◆ video_set_compose_format()

int video_set_compose_format ( const struct device * dev,
struct video_format * fmt )

#include <video.h>

Set compose rectangle (if applicable) prior to setting format.

Some devices expose compose capabilities, allowing them to apply a transformation (downscale / upscale) to the frame. For those devices, it is necessary to set the compose rectangle before being able to apply the frame format (which must have the same width / height as the compose rectangle width / height). In order to allow non-compose aware application to be able to control such devices, introduce a helper which, if available, will apply the compose rectangle prior to setting the format.

Parameters
devPointer to the video device struct to set format
fmtPointer to a video format struct.
Return values
0Is successful.
-EINVALIf parameters are invalid.
-ENOTSUPIf format is not supported.
-EIOGeneral input / output error.

◆ video_set_format()

int video_set_format ( const struct device * dev,
struct video_format * fmt )

#include <video.h>

Set video format.

Configure video device with a specific format.

Parameters
devPointer to the device structure for the driver instance.
fmtPointer to a video format struct.
Return values
0If successful.
-EINVALIf parameters are invalid.
-ENOTSUPIf format is not supported.
-EIOGeneral input / output error.

◆ video_set_selection()

int video_set_selection ( const struct device * dev,
struct video_selection * sel )

#include <video.h>

Set video selection (crop/compose).

Configure the optional crop and compose feature of a video device. Crop is first applied on the input frame, and the result of that crop is applied to the compose. The result of the compose (width/height) is equal to the format width/height given to the video_set_format function.

Some targets are inter-dependents. For instance, setting a VIDEO_SEL_TGT_CROP will reset VIDEO_SEL_TGT_COMPOSE to the same size.

Parameters
devPointer to the device structure for the driver instance.
selPointer to a video selection structure
Return values
0If successful.
-EINVALIf parameters are invalid.
-ENOTSUPIf format is not supported.
-EIOGeneral input / output error.