Axoverlay 2 API
axoverlay2.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/time.h>
Include dependency graph for axoverlay2.h:

Go to the source code of this file.

Data Structures

struct  _axo_argb_entry
 

Typedefs

typedef struct _axo_settings axo_settings
 
typedef struct _axo_props axo_props
 
typedef struct _axo_match axo_match
 
typedef struct _axo_buffer axo_buffer
 
typedef struct _axo_request axo_request
 
typedef struct _axo_submit axo_submit
 
typedef struct _axo_err axo_err
 
typedef enum _axo_err_code axo_err_code
 
typedef enum _axo_format axo_format
 
typedef enum _axo_format_flags axo_format_flags
 
typedef struct _axo_detailed_format axo_detailed_format
 
typedef struct _axo_argb_entry axo_argb_entry
 

Enumerations

enum  _axo_err_code {
  AXO_ERR_INTERNAL = 0 , AXO_ERR_INVALID = 1 , AXO_ERR_UNSUPPORTED = 2 , AXO_ERR_WAIT = 3 ,
  AXO_ERR_NO_STREAM = 4 , AXO_ERR_NOT_AVAILABLE = 5
}
 
enum  _axo_format {
  AXO_FORMAT_INVALID = 0 , AXO_FORMAT_ARGB32 = 1 , AXO_FORMAT_4BIT_PALETTE = 2 , AXO_FORMAT_1BIT_PALETTE = 3 ,
  AXO_FORMAT_ARGB16 = 4 , AXO_FORMAT_COUNT
}
 
enum  _axo_format_flags { AXO_FORMAT_FLAGS_NONE = 0 , AXO_FORMAT_FLAGS_COMPRESSED = 1 << 1 , AXO_FORMAT_FLAGS_GPU = 1 << 2 }
 

Functions

bool axo_start (axo_settings *settings, axo_err **err)
 
bool axo_stop (axo_err **err)
 
int axo_create_overlay (axo_props *props, axo_match *match, axo_err **err)
 
bool axo_remove_overlay (int id, axo_err **err)
 
bool axo_adjust_overlay (int id, axo_props *props, axo_err **err)
 
axo_detailed_format * axo_suggest_detailed_format (axo_format format, axo_format_flags flags, axo_err **err)
 
void axo_detailed_format_free (axo_detailed_format *detailed_format)
 
void axo_detailed_format_get_aligned_size (axo_detailed_format *detailed_format, unsigned width, unsigned height, unsigned *aligned_width_out, unsigned *aligned_height_out)
 
bool axo_get_aligned_size (axo_format format, unsigned width, unsigned height, unsigned *aligned_width_out, unsigned *aligned_height_out, axo_err **err)
 
uint32_t axo_detailed_format_get_drm_fourcc (axo_detailed_format *detailed_format)
 
uint64_t axo_detailed_format_get_drm_modifier (axo_detailed_format *detailed_format, unsigned plane)
 
axo_props * axo_props_new (void)
 
void axo_props_free (axo_props *props)
 
void axo_props_set_detailed_format (axo_props *props, axo_detailed_format *detailed_format)
 
void axo_props_set_format (axo_props *props, axo_format format)
 
void axo_props_set_size (axo_props *props, unsigned desired_width, unsigned desired_height)
 
void axo_props_set_position (axo_props *props, double x, double y)
 
void axo_props_set_position_reference (axo_props *props, const char *ref)
 
void axo_props_set_anchor_point (axo_props *props, double x, double y)
 
void axo_props_set_nbr_of_buffers (axo_props *props, unsigned nbr)
 
void axo_props_set_palette (axo_props *props, int id)
 
void axo_props_set_upscale_x2 (axo_props *props, bool upscale)
 
void axo_props_set_manual_dma_sync (axo_props *props, bool manual_dma_sync)
 
void axo_props_set_z_priority (axo_props *props, int z_priority)
 
axo_match * axo_match_new (void)
 
void axo_match_free (axo_match *match)
 
void axo_match_stream_id (axo_match *match, int id)
 
axo_buffer * axo_get_buffer (int id, axo_request *request, axo_err **err)
 
bool axo_submit_buffer (axo_buffer *buffer, axo_submit *submit, axo_err **err)
 
unsigned long axo_buffer_get_id (axo_buffer *buffer)
 
char * axo_buffer_get_data (axo_buffer *buffer, axo_err **err)
 
int axo_buffer_get_dma_buf_fd (axo_buffer *buffer)
 
size_t axo_buffer_get_byte_size (axo_buffer *buffer)
 
unsigned axo_buffer_get_width (axo_buffer *buffer)
 
unsigned axo_buffer_get_height (axo_buffer *buffer)
 
void axo_buffer_set_timestamp_to_submit (axo_buffer *buffer, struct timeval timestamp)
 
bool axo_buffer_dma_buf_supported (void)
 
int axo_palette_new (axo_err **err)
 
bool axo_palette_full_load_argb (int palette_id, const axo_argb_entry *entries, int count, axo_err **err)
 
bool axo_palette_update_color (int palette_id, const axo_argb_entry entry, int index, axo_err **err)
 
const char * axo_err_get_message (axo_err *err)
 
axo_err_code axo_err_get_code (axo_err *err)
 
void axo_err_clear (axo_err **err)
 

Detailed Description

Axoverlay 2 API

Copyright (C) 2023, Axis Communications AB

Axoverlay is a library which lets a client application draw custom overlays on video streams. Axoverlay is supported on the Artpec-7 platform and onwards. It's not supported on Ambarella platforms.

Typedef Documentation

◆ axo_argb_entry

A single entry in a color palette.

The possible values range from 0.0f to 1.0f. For alpha, a value of 1.0f means "fully visible" and 0.0f means "fully transparent".

◆ axo_buffer

typedef struct _axo_buffer axo_buffer

Overlay buffer object.

A buffer represents a memory area into which image data can be drawn, to form a single frame of the overlay animation. The buffer is associated with a particular overlay.

◆ axo_detailed_format

typedef struct _axo_detailed_format axo_detailed_format

A specific storage format for pixels. Each axo_format, in combination with a compression mode and possibly other settings, determines a specific detailed format.

◆ axo_err

typedef struct _axo_err axo_err

Runtime error.

Many Axoverlay functions have a final parameter axo_err **err which represents the possibility of runtime error. The rules for axo_err are similar to glib's GError, including the possibility to pass err = NULL if client is not interested in handling (or knowing about) an error.

Client cannot create an axo_err object, only receive a pointer to it from Axoverlay. If client does receive an error back, client is responsible for freeing it using axo_err_clear.

Handling errors

axo_err *err = NULL;
if (!axo_function_which_may_fail(param1, param2, &err)) {
fprintf(stderr, "Error: %s\n", axo_err_get_message(err));
}
void axo_err_clear(axo_err **err)
const char * axo_err_get_message(axo_err *err)
struct _axo_err axo_err
Definition: axoverlay2.h:102

Ignoring errors

axo_function_which_may_fail(param1, param2, NULL);

◆ axo_err_code

Error codes describing various classes of error.

◆ axo_format

typedef enum _axo_format axo_format

Colour format, specifying how colours are represented.

Client is able to choose from a set of supported formats. Not all formats may be supported on each hardware platform.

Formats with fewer bits per pixel are always more efficient from a performance point of view, but may be more difficult to work with from a client point of view.

Each axo_format also has a native storage format in memory which is described here. Note that when compression is used, the storage format will be different.

◆ axo_format_flags

Flags used to select a suitable axo_detailed_format. Currently, flags are only used to select a compressed pixel format for GPU rendering.

Flags are combined using bitwise OR to describe requirements.

When the GPU is used to render graphics, the recommended flags are (AXO_FORMAT_FLAGS_COMPRESSED | AXO_FORMAT_FLAGS_GPU).

When the CPU is used for rendering, AXO_FORMAT_FLAGS_NONE shall be selected.

Note that when a compressed format is selected, the rendering backend (e.g. GPU) must be set up to store pixels in that format. It is shown in the example programs how to do this correctly.

◆ axo_match

typedef struct _axo_match axo_match

Description of how to match an overlay against video streams.

◆ axo_props

typedef struct _axo_props axo_props

Overlay properties.

This object type is suitable for passing to axo_create_overlay or axo_adjust_overlay. After a successful call to either of these functions, the props object is reset. Re-using the object will have no effect, until it's modified again by the axo_props-family functions.

The axo_props object tracks modifications to existing properties. That is, the default policy is always to keep any property at its current or default value. If the axo_props object should be passed to axo_adjust_overlay, only those properties that you wish to adjust need to be set on the axo_props object.

◆ axo_request

typedef struct _axo_request axo_request

Overlay buffer request metadata.

Currently, no such metadata is defined and this type is reserved for future use.

◆ axo_settings

typedef struct _axo_settings axo_settings

Object representing global settings which need to be set at library startup.

Currently, no such settings are defined and this type is reserved for future use.

◆ axo_submit

typedef struct _axo_submit axo_submit

Overlay buffer submit metadata.

Currently, no such metadata is defined and this type is reserved for future use.

Enumeration Type Documentation

◆ _axo_err_code

Error codes describing various classes of error.

Enumerator
AXO_ERR_INTERNAL 

Internal error in the overlay system, usually not recoverable

AXO_ERR_INVALID 

Invalid operation requested by client

AXO_ERR_UNSUPPORTED 

Unsupported operation requested by client

AXO_ERR_WAIT 

Try again later

AXO_ERR_NO_STREAM 

No stream available

AXO_ERR_NOT_AVAILABLE 

The overlay system is not available

◆ _axo_format

Colour format, specifying how colours are represented.

Client is able to choose from a set of supported formats. Not all formats may be supported on each hardware platform.

Formats with fewer bits per pixel are always more efficient from a performance point of view, but may be more difficult to work with from a client point of view.

Each axo_format also has a native storage format in memory which is described here. Note that when compression is used, the storage format will be different.

Enumerator
AXO_FORMAT_ARGB32 

8 bits unsigned each for alpha, red, green, blue

Uncompressed ARGB32 is packed into one uint32 word per pixel. The alpha channel occupies the most significant bits of the word and so on.

Example: uint32_t sample = a << 24 | r << 16 | g << 8 | b;

AXO_FORMAT_4BIT_PALETTE 

4 bits per pixel palette format. Two pixels are packed into each byte of the framebuffer. The lower-order nibble encodes the first pixel.

The colour values for each pixel are looked up from a 16-entry palette. The palette to use should be specified using axo_props_set_palette. The nibble 0x0 refers to the first palette entry (index 0) and the nibble 0xf refers to the last palette entry (index 15).

AXO_FORMAT_1BIT_PALETTE 

1 bit per pixel palette format. Eight pixels are packed into each byte of the framebuffer. The least significant bit encodes the first pixel.

The colour values for each pixel are looked up from a 2-entry palette. The palette to use should be specified using axo_props_set_palette. An unset bit refers to the first palette entry (index 0) and a set bit refers to the second palette entry (index 1).

AXO_FORMAT_ARGB16 

4 bits unsigned each for alpha, red, green, blue; packed into one uint16 word per pixel. The alpha channel occupies the most significant bits of the word and so on.

Example: uint16_t sample = (a & 0xF) << 12 | (r & 0xF) << 8 | (g & 0xF) << 4 | (b & 0xF);

AXO_FORMAT_COUNT 

The number of possible axo_format values

◆ _axo_format_flags

Flags used to select a suitable axo_detailed_format. Currently, flags are only used to select a compressed pixel format for GPU rendering.

Flags are combined using bitwise OR to describe requirements.

When the GPU is used to render graphics, the recommended flags are (AXO_FORMAT_FLAGS_COMPRESSED | AXO_FORMAT_FLAGS_GPU).

When the CPU is used for rendering, AXO_FORMAT_FLAGS_NONE shall be selected.

Note that when a compressed format is selected, the rendering backend (e.g. GPU) must be set up to store pixels in that format. It is shown in the example programs how to do this correctly.

Enumerator
AXO_FORMAT_FLAGS_NONE 

A blank set of flags selects the plain uncompressed format. The pixels will be stored in memory as documented under axo_format.

AXO_FORMAT_FLAGS_COMPRESSED 

Select a compressed format if available. The compression may be lossless or lossy. If no such format is available, the uncompressed format is returned.

AXO_FORMAT_FLAGS_GPU 

Select a format which is compatible with using the GPU for rendering

Function Documentation

◆ axo_adjust_overlay()

bool axo_adjust_overlay ( int  id,
axo_props *  props,
axo_err **  err 
)

Ask Axoverlay to adjust the specified overlay's properties.

To "adjust" means to modify overlay properties without re-creating the overlay. After a successful adjustment, the overlay does not need to be re-drawn.

Adjustment is not always possible. In those cases where it's not possible, it is instead necessary to remove the old overlay and create a new one with the desired properties.

Parameters
idThe ID number of the overlay that should be adjusted
propsThe desired new properties for the overlay. After a successful call to this function, the object is reset.
errError return
Returns
true if adjustment was successful, false otherwise

◆ axo_buffer_dma_buf_supported()

bool axo_buffer_dma_buf_supported ( void  )

Check if exporting buffers as DMA buf is supported or not

Returns
true if DMA buf is supported, otherwise false

◆ axo_buffer_get_byte_size()

size_t axo_buffer_get_byte_size ( axo_buffer *  buffer)

Get the size of a buffer, in bytes.

Parameters
bufferThe buffer in question
Returns
A pointer to the start of buffer data

◆ axo_buffer_get_data()

char* axo_buffer_get_data ( axo_buffer *  buffer,
axo_err **  err 
)

Get pointer to buffer data.

The pointer points to the start of the overlay buffer data, where application should draw.

Parameters
bufferThe buffer in question
errError return
Returns
A pointer to the start of buffer data

◆ axo_buffer_get_dma_buf_fd()

int axo_buffer_get_dma_buf_fd ( axo_buffer *  buffer)

Get DMA buf file descriptor for the buffer

DMA buf file descriptor representing the buffer memory

Parameters
bufferThe buffer in question
Returns
The DMA buf file descriptor

◆ axo_buffer_get_height()

unsigned axo_buffer_get_height ( axo_buffer *  buffer)

Get the height of a buffer, in pixels.

Parameters
bufferThe buffer in question
Returns
The buffer height

◆ axo_buffer_get_id()

unsigned long axo_buffer_get_id ( axo_buffer *  buffer)

Get the ID number of the buffer.

The combination of (overlay_id, buffer_id) is globally unique. However, ID numbers for deleted overlays and buffers may be recycled. The ID may be used to tell distinct buffers apart. This is useful in case the client needs to cache associated data for a particular buffer.

Parameters
bufferThe buffer in question
Returns
A number which, in combination with the overlay id, identifies this buffer

◆ axo_buffer_get_width()

unsigned axo_buffer_get_width ( axo_buffer *  buffer)

Get the width of a buffer, in pixels.

Parameters
bufferThe buffer in question
Returns
The buffer width

◆ axo_buffer_set_timestamp_to_submit()

void axo_buffer_set_timestamp_to_submit ( axo_buffer *  buffer,
struct timeval  timestamp 
)

Set the timestamp to submit the overlay buffer with. NOTE: the timestamp should be set BEFORE submitting the buffer by axo_submit_buffer.

Parameters
bufferThe buffer in question
timestampThe timestamp to submit the buffer with

◆ axo_create_overlay()

int axo_create_overlay ( axo_props *  props,
axo_match *  match,
axo_err **  err 
)

Create a new overlay with requested properties.

Parameters
propsThe properties object describing the overlay to be created. After a successful call to this function, the object is reset.
matchThe match object describing which streams the overlay should be applied to
errError return
Returns
The ID number of the newly created overlay, or -1 on error

◆ axo_detailed_format_free()

void axo_detailed_format_free ( axo_detailed_format *  detailed_format)

Free an object of type axo_detailed_format.

Parameters
detailed_formatThe object to free

◆ axo_detailed_format_get_aligned_size()

void axo_detailed_format_get_aligned_size ( axo_detailed_format *  detailed_format,
unsigned  width,
unsigned  height,
unsigned *  aligned_width_out,
unsigned *  aligned_height_out 
)

Return an appropriate overlay size for a given detailed format.

The user shall input their desired overlay size. This function then returns an aligned size which is suitable for passing to axo_props_set_size in combination with that detailed format.

The aligned size is never smaller than the original desired size.

The user is expected to draw a transparent or background colour to the extra padding pixels.

Parameters
detailed_formatThe detailed overlay format to query alignment for
widthDesired overlay width
heightDesired overlay height
aligned_width_outLocation to store aligned overlay width
aligned_height_outLocation to store where aligned overlay height

◆ axo_detailed_format_get_drm_fourcc()

uint32_t axo_detailed_format_get_drm_fourcc ( axo_detailed_format *  detailed_format)

Get the Linux DRM "fourcc" code corresponding to this detailed format.

This corresponds to the attribute EGL_LINUX_DRM_FOURCC_EXT in the Khronos EGL extension EGL_EXT_image_dma_buf_import.

Not all Axoverlay formats have a matching fourcc code defined. A code of zero (DRM_FORMAT_INVALID) will be returned for these formats.

Parameters
detailed_formatThe detailed format to get a fourcc for
Returns
The drm fourcc code, or zero if there is no applicable code

◆ axo_detailed_format_get_drm_modifier()

uint64_t axo_detailed_format_get_drm_modifier ( axo_detailed_format *  detailed_format,
unsigned  plane 
)

Get the Linux DRM "modifier" code corresponding to this detailed format.

This corresponds to the attributes EGL_DMA_BUF_PLANEx_MODIFIER_LO_EXT and EGL_DMA_BUF_PLANEx_MODIFIER_HI_EXT in the Khronos EGL extension EGL_EXT_image_dma_buf_import_modifiers where x is the plane number.

Note that HI refers to the high 32 bits of the modifier code and LO to the low 32 bits.

Multi-plane overlays are not supported at the moment, so the plane number is always zero.

The modifier code zero (DRM_FORMAT_MOD_NONE) is valid and will be returned for detailed formats that do not need a modifier.

Parameters
detailed_formatThe detailed format to get a modifier code for
planeShall be set to 0
Returns
The modifier code

◆ axo_err_clear()

void axo_err_clear ( axo_err **  err)

Clears the axo_err object.

If err or *err is NULL, does nothing. Otherwise, frees *err and sets *err to NULL.

Parameters
errError object to clear

◆ axo_err_get_code()

axo_err_code axo_err_get_code ( axo_err *  err)

Get error code from error object.

Parameters
errError object
Returns
The associated error code

◆ axo_err_get_message()

const char* axo_err_get_message ( axo_err *  err)

Get message string from error object.

The string remains valid until axo_err_clear is called.

Parameters
errError object
Returns
A message describing the error

◆ axo_get_aligned_size()

bool axo_get_aligned_size ( axo_format  format,
unsigned  width,
unsigned  height,
unsigned *  aligned_width_out,
unsigned *  aligned_height_out,
axo_err **  err 
)

Return an appropriate overlay size for an uncompressed overlay.

This is a shorthand for axo_detailed_format_get_aligned_size() in the case where the detailed format is just the uncompressed variant of the respective axo_format.

Parameters
formatDesired overlay format
widthDesired overlay width
heightDesired overlay height
aligned_width_outLocation to store aligned overlay width
aligned_height_outLocation to store where aligned overlay height
errError return
Returns
true on success, false on error

◆ axo_get_buffer()

axo_buffer* axo_get_buffer ( int  id,
axo_request *  request,
axo_err **  err 
)

Request an overlay buffer for the overlay having ID number id.

The ID number should be one that was previously returned by axo_create_overlay.

This is a blocking and synchronous operation.

The returned buffer object references a memory area suitable for drawing into. Once the application is done drawing, the buffer object should be passed to axo_submit_buffer.

This function does not always complete successfully. Even during normal operation it will return error codes which the client must handle:

  • AXO_ERR_WAIT : A buffer did not become available within a reasonable amount of time. The timeout can vary between platforms and is selected to avoid blocking the client for too long. This commonly occurs when drawing high-framerate animation on a low framerate video stream.

    Recommended action: Try again later, possibly skip a frame of animation.

  • AXO_ERR_NO_STREAM : The stream on which the overlay is placed has disconnected. No more buffers will ever be availabe. The client should soon receive a VDO stream event indicating that the stream has disconnected. This occurs whenever a stream disconnects and the client happens to call axo_get_buffer before receiving and handling the stream event.

    Recommended action: Ignore the error and continue, expect a stream disconnect event soon.

Parameters
idThe ID number of the overlay in question
requestUnused; should be NULL
errError return
Returns
A new buffer object, or NULL if the request failed

◆ axo_match_free()

void axo_match_free ( axo_match *  match)

Free a match object.

Parameters
matchThe match object to free

◆ axo_match_new()

axo_match* axo_match_new ( void  )

Create a new, blank match object.

The object is "blank" in the sense that it does not match any video streams.

The returned object has to be freed by axo_match_free.

Returns
The newly created match object

◆ axo_match_stream_id()

void axo_match_stream_id ( axo_match *  match,
int  id 
)

Set the "stream id" field on a match object.

This makes the match object match a stream having the ID number id. The overlay controlled by this match object will be applied to that stream, if it exists.

Axoverlay does not provide a means to obtain stream numbers for currently active streams. Another API should be used for this purpose.

Parameters
matchThe match object in question
idThe stream ID number that should be matched

◆ axo_palette_full_load_argb()

bool axo_palette_full_load_argb ( int  palette_id,
const axo_argb_entry *  entries,
int  count,
axo_err **  err 
)

Load ARGB data into a palette that was created by axo_palette_new.

The number of entries should match the number required for the selected overlay format.

Any previous contents of the palette are replaced.

The palette will be updated on the next call to axo_submit_buffer.

If the palette was currently in use by one or more overlays, they will be automatically updated to reflect the newly loaded data.

Parameters
palette_idThe ID number of the palette to replace
entriesThe ARGB data that should be loaded into the palette
countThe number of axo_argb_entry values to load
errError return
Returns
True on success, false on failure

◆ axo_palette_new()

int axo_palette_new ( axo_err **  err)

Allocate a new colour palette that may be used for overlays. The returned ID number is valid to pass to axo_props_set_palette.

The palette is initially empty and data may be loaded into it using axo_palette_full_load_argb.

There may be restrictions on the number of palettes that can be used for overlays at one time, depending on the platform and firmware version. In particular the platform may support only a single global palette that is shared between all applications and overlays.

It is recommended to create only a single palette and use it for all overlays that need palettes. It is not recommended to use the same palette for overlays with different formats.

Parameters
errError return
Returns
The ID number of the newly created palette, or -1 on error

◆ axo_palette_update_color()

bool axo_palette_update_color ( int  palette_id,
const axo_argb_entry  entry,
int  index,
axo_err **  err 
)

Update a single ARGB value of a palette that was created by axo_palette_new.

The palette will be updated on the next call to axo_submit_buffer.

If the palette was currently in use by one or more overlays, they will be automatically updated to reflect the newly loaded data.

Parameters
palette_idThe ID number of the palette to replace
entryAn axo_argb_entry containing the ARGB value that should be loaded into the palette slot specified by index"
indexThe index of the ARGB value slot to be updated
errError return
Returns
True on success, false on failure

◆ axo_props_free()

void axo_props_free ( axo_props *  props)

Free an overlay properties object.

Parameters
propsThe properties object to free

◆ axo_props_new()

axo_props* axo_props_new ( void  )

Create a new, blank overlay properties object.

The returned object is "blank" in the sense that it describes a null modification to any existing properties. That is, if the empty object was passed directly to axo_adjust_overlay, it would result in no change to the overlay.

The returned object has to be freed by axo_props_free.

Returns
The newly created properties object

◆ axo_props_set_anchor_point()

void axo_props_set_anchor_point ( axo_props *  props,
double  x,
double  y 
)

Set the "anchor point" field on an overlay properties object.

This field selects the anchor point used for interpreting the "position" field, corresponding to the "AnchorPoint" property documented in the Overlay AFD.

The anchor point is the point inside the overlay buffer which determines the position of the overlay itself. It is the point which is referred to when setting the position of the overlay using axo_props_set_position.

Parameters
propsThe properties object in question
xarbitrary X position of the point. Normalized value from [0..1]
yarbitrary Y position of the point. Normalized value from [0..1]

◆ axo_props_set_detailed_format()

void axo_props_set_detailed_format ( axo_props *  props,
axo_detailed_format *  detailed_format 
)

Set the detailed format field on an overlay properties object.

This selects the pixel storage format to use for the overlay. It also selects the type of compression to be used, if any.

Parameters
propsThe properties object in question
detailed_formatThe new detailed format

◆ axo_props_set_format()

void axo_props_set_format ( axo_props *  props,
axo_format  format 
)

Shorthand for axo_props_set_detailed_format() to select an uncompressed format.

Parameters
propsThe properties object in question
formatThe new format

◆ axo_props_set_manual_dma_sync()

void axo_props_set_manual_dma_sync ( axo_props *  props,
bool  manual_dma_sync 
)

Set dma sync strategy on an overlay properties object.

Setting this field to true makes the application responsible for dma sync operations, this can be useful if for instance the GPU was used to draw the overlay since GPU operations usually flush the framebuffer to memory before finishing.

Parameters
propsThe properties object in question
manual_dma_syncManual DMA sync mode enabled/disabled

◆ axo_props_set_nbr_of_buffers()

void axo_props_set_nbr_of_buffers ( axo_props *  props,
unsigned  nbr 
)

Set the "nbr_of_buffers" field on an overlay properties object.

Sets the number of buffers used. If not set, the number will default to two. For animation double or triple buffering must be used to prevent flickering. Triple buffering takes up more memory but is more performant than double or single buffering while single buffering takes up the least amount of memory but can only show static overlays.

Parameters
propsThe properties object in question
nbrThe number of buffers to use

◆ axo_props_set_palette()

void axo_props_set_palette ( axo_props *  props,
int  id 
)

Set the "palette" field on an overlay properties object.

This causes the overlay to use the specified palette for colour lookups. The ID number should be one which was previously returned by axo_palette_new.

Parameters
propsThe properties object in question
idThe ID number of the palette to use

◆ axo_props_set_position()

void axo_props_set_position ( axo_props *  props,
double  x,
double  y 
)

Set the "position" field on an overlay properties object.

This field describes the position of the overlay within the video frame, corresponding to the "Position" property documented in the Overlay AFD. The interpretation of the X and Y coordinates depends on the fields "position reference" and "anchor point".

Parameters
propsThe properties object in question
xThe new X position
yThe new Y position

◆ axo_props_set_position_reference()

void axo_props_set_position_reference ( axo_props *  props,
const char *  ref 
)

Set the "position reference" field on an overlay properties object.

This function exists for legacy reasons. Axoverlay2 only supports the "channel" reference, which is also the default when no reference is explicitly set. There is no need to call this function.

  • "channel": (x, y) are fractional numbers giving a position relative to the centre point of the scaled video stream. (x, y) range from -1.0 to +1.0 where -1.0 is left/top and +1.0 is right/bottom. Example: x = -1.0, y = -1.0 is top-left of stream. x = 0.0, y = 0.0 is centre of stream.
Parameters
propsThe properties object in question
refThe new position reference type

◆ axo_props_set_size()

void axo_props_set_size ( axo_props *  props,
unsigned  desired_width,
unsigned  desired_height 
)

Set the "size" field on an overlay properties object.

This field corresponds to the "Size" property documented in the Overlay AFD.

Depending on the selected format, there may be alignment restrictions on the size. It may be necessary to pad out the size to meet these requirements. The function axo_get_aligned_size shall always be used to select an appropriate size.

Parameters
propsThe properties object in question
desired_widthThe desired new pixel width. The actual overlay width might be different due to alignment requirements from the hardware. axo_buffer_get_width can be used to get the real width.
desired_heightThe desired new pixel height. The actual overlay height might be different due to alignment requirements from the hardware. axo_buffer_get_height can be used to get the real height.

◆ axo_props_set_upscale_x2()

void axo_props_set_upscale_x2 ( axo_props *  props,
bool  upscale 
)

Set 2x upscaling on an overlay properties objects.

True to cause the overlay size to be scaled up by the factor of two.

Parameters
propsThe properties object in question
upscaleTrue to upscale an overlay

◆ axo_props_set_z_priority()

void axo_props_set_z_priority ( axo_props *  props,
int  z_priority 
)

Set z priority on an overlay properties object.

An overlay with higher priority will be placed in front of an overlay with lower priority in case they overlay. The default is 0.

Parameters
propsThe properties object in question
z_priorityThe intended z-priority for the object

◆ axo_remove_overlay()

bool axo_remove_overlay ( int  id,
axo_err **  err 
)

Remove the overlay with the specified ID number.

If successful, the overlay will disappear from all streams it was applied to.

Parameters
idThe ID number of the overlay, as returned by axo_create_overlay
errError return

◆ axo_start()

bool axo_start ( axo_settings *  settings,
axo_err **  err 
)

Start up Axoverlay with the given global settings.

Axoverlay must be started before any other functions may be called, except the axo_settings family of functions and other exceptions as noted.

If Axoverlay cannot be started with the given settings, an error is returned.

Parameters
settingsUnused; should be NULL
errError return
Returns
true if successful, false otherwise

◆ axo_stop()

bool axo_stop ( axo_err **  err)

Stop Axoverlay.

This causes the removal of all overlays, palettes, and other objects managed by Axoverlay. All such objects become invalid.

If there is an error in stopping Axoverlay, it will be returned. This error is purely informational as there is no way for client to handle it, and Axoverlay will still stop working. Client should not call axo_stop again if it fails.

Parameters
errError return
Returns
true if successful, false otherwise

◆ axo_submit_buffer()

bool axo_submit_buffer ( axo_buffer *  buffer,
axo_submit *  submit,
axo_err **  err 
)

Submit an overlay buffer.

Normally, this causes the buffer to be shown in the video frame.

Parameters
bufferThe buffer in question
submitSubmit metadata object, or NULL to select defaults
errError return
Returns
True if successful, false otherwise

◆ axo_suggest_detailed_format()

axo_detailed_format* axo_suggest_detailed_format ( axo_format  format,
axo_format_flags  flags,
axo_err **  err 
)

Ask axoverlay to select a detailed format to be used for rendering, compatible with the current platform. The selection is valid for multiple overlays.

Example: Client wishes to render ARGB32 graphics using the platform GPU:

struct _axo_detailed_format axo_detailed_format
Definition: axoverlay2.h:207
axo_detailed_format * axo_suggest_detailed_format(axo_format format, axo_format_flags flags, axo_err **err)
@ AXO_FORMAT_FLAGS_COMPRESSED
Definition: axoverlay2.h:197
@ AXO_FORMAT_FLAGS_GPU
Definition: axoverlay2.h:200
@ AXO_FORMAT_ARGB32
Definition: axoverlay2.h:139

The returned object shall be freed using axo_detailed_format_free().

Parameters
formatThe pixel colour format to use
flagsFlags to influence the choice
errError return
Returns
A detailed format to be used, or NULL in case of error