Video feeds API#

Library to access the video feeds (see Video feeds) from different cameras.

C api#

Here are the objects and functions provided.

Enumerations#

enum vipc_configure_flag#

Configure flag.

This enum is intended to set one or more configuration operation within the vipc_configure structure. The field vipc_configure.flags must be set with one or more if the flags and the associated field must be set accordingly.

Values:

enumerator VIPC_CONFIGURE_FLAG_NONE#

No configuration operation.

enumerator VIPC_CONFIGURE_FLAG_ERROR#

The configuration request has failed. If one of the operations is not supported, the flag VIPC_CONFIGURE_FLAG_NOT_SUPPORTED is be set additionally. Otherwise, it means that one of the values related to operations requested is invalid.

enumerator VIPC_CONFIGURE_FLAG_NOT_SUPPORTED#

One of the operations is not supported. The not supported operations should be set as well in the vipc_configure.flags field to specify which operations are not supported.

enumerator VIPC_CONFIGURE_FLAG_RESET#

Reset all frame settings to default.

enumerator VIPC_CONFIGURE_FLAG_RESOLUTION#

Change the frame resolution. The resolution of the frame which will be sent by the video IPC server.

enumerator VIPC_CONFIGURE_FLAG_CROP#

Change the crop rectangle in the original frame. The crop is applied on the original video frame: the frame resolution set with VIPC_CONFIGURE_FLAG_RESOLUTION will be a down/up-scale from the resolution set by the crop rectangle.

enum vipc_eos_reason#

End Of Stream reason.

This enum is used to know the reason why a video IPC stream is stopping.

Values:

enumerator VIPC_EOS_REASON_NONE#

No reason. When the video IPC stream is stopped for a long period or the program is exited and the video source is not anymore active, this reason should be used.

enumerator VIPC_EOS_REASON_RESTART#

Restart of video IPC stream. This reason can be used to specify the source of the video IPC stream is restarting or changing its configuration. It means that the stream is temporarily stopped but will restart as soon as possible.

enumerator VIPC_EOS_REASON_CONFIGURATION#

Configuration change has stopped the video IPC stream. This reason can be used to indicate that a configuration change has stopped the video IPC stream but does not mean that the stream will restart.

enum vipc_meta_flag#

Frame meta data presence flag.

When a bit is set, the associated meta data value is set in the vipc_frame_meta structure.

Values:

enumerator VIPC_META_FLAG_NONE#

No meta data are set.

enumerator VIPC_META_FLAG_EXPOSURE_TIME#

Exposure time is set in vipc_frame_meta.exposure_time_ns.

enumerator VIPC_META_FLAG_SNAPSHOT#

A snapshot has been taken (no field is set in vipc_frame_meta)

enumerator VIPC_META_FLAG_FULL_RANGE#

YUV full-range is used (no field is set in vipc_frame_meta)

Structures#

struct vipcc_cfg_info#

Client configuration information

Public Members

char *address#

Remote address to connect to (in pomp_addr_parse format)

char *backend#

Backend name

const struct vipc_be_cb *be_cbs#

Callbacks for the backend

struct vipc_status#

Status, sent at connection or whenever the configuration changes.

width, height, display aspect ratio is the “original” format of the server:

  • this is what will be sent by default (without vipc_configure being called)

  • frame cannot be configured bigger than this original format

Public Members

char *method#

underlying backend

char *method_params#

underlying backend parameters, used for backend initialisation

enum vacq_pix_format format#

frame format

bool full_range#

YUV full-range flag

enum vdef_color_primaries color_primaries#

Color primaries

enum vdef_transfer_function transfer_function#

Transfer function

enum vdef_dynamic_range dynamic_range#

Dynamic range

enum vdef_tone_mapping tone_mapping#

Tone mapping

uint32_t width#

frame width

uint32_t height#

frame height

float dar#

display aspect ratio

unsigned int num_planes#

number of planes [1, VIPC_PLANE_COUNT]

uint32_t stride#

stride (size in bytes of a row) for the plane

size_t size#

size in byte of the plane

struct vipc_status::[anonymous] planes[VIPC_PLANE_COUNT]#

planes

uint32_t framerate_num#

framerate numerator

uint32_t framerate_den#

framerate denominator

struct vipc_dim#

Frame dimension.

Public Members

uint32_t width#

Width of the frame.

uint32_t height#

Height of the frame.

struct vipc_configure#

Configure frame resolution / crop.

This structure is used to do dynamic configuration on a video IPC server, even if it is started. For operations currently supported, please refer to vipc_configure_flag enumerator.

Public Members

uint8_t flags#

Configuration flags. This is a bit-field composed by the enum vipc_configure_flag values. For more details, please read its documentation.

struct vipc_dim resolution#

Frame resolution to output. This field must be set when flag VIPC_CONFIGURE_FLAG_RESOLUTION is set.

struct vipc_crop crop#

Crop in original image. This crop is effective only when the flag VIPC_CONFIGURE_FLAG_CROP is set in flags.

struct vipcc_cb#

Video IPC client callbacks.

This structure defines all the client callbacks which will be called by the client instance when events happen (new status, configure response, new frame, end of stream, …).

The callbacks are not mandatory.

Public Members

void (*status_cb)(struct vipcc_ctx *ctx, const struct vipc_status *status, void *userdata)#

New status received.

This function is called when a new status is received from the server: while no status is received, the vipcc_start() call will fail.

Param ctx:

[in] the client context

Param status:

[in] the actual status

Param userdata:

[in] the user data passed at context creation

void (*configure_cb)(struct vipcc_ctx *ctx, const struct vipc_configure *config, void *userdata)#

Configure response.

This function is called when the server has processed a configure request from the current client instance.

The values found on the config structure are the actual values applied by the server: they can be slightly different from the requested values. If the request has failed, the flag VIPC_CONFIGURE_FLAG_ERROR will be set:

  • If the flag VIPC_CONFIGURE_FLAG_NOT_SUPPORTED is also set, it means that one of the operations is not supported. The unsupported operations will be notified by flags field: the respective flags of the unsupported operations will be set,

  • Otherwise, it means that one of the operation values is invalid.

Param ctx:

[in] the client context

Param config:

[in] the actual configuration

Param userdata:

[in] the user data passed at context creation

void (*frame_cb)(struct vipcc_ctx *ctx, const struct vipc_frame *frame, void *be_frame, void *userdata)#

New frame received.

This function is called when a new frame is received from the server side.

If the map has been set to true during vipcc_new() call, the addresses of video frame planes is set and can be used to read the data frame.

The be_frame argument will contain the back-end frame or NULL if not applicable.

When the frame is no longer used by the application, it must be released with a call to vipcc_release(). If the release is not done, the frame will be locked and won’t be usable by the server to handle next frames.

Param ctx:

[in] the client context

Param frame:

[in] the video IPC frame

Param be_frame:

[in] the underlying back-end frame

Param userdata:

[in] the user data passed at context creation

void (*connection_status_cb)(struct vipcc_ctx *ctx, bool connected, void *userdata)#

Connection to server status.

This function is called when the client instance is connected or disconnected from the server: it is useful to monitor when a server is online or not.

Param ctx:

[in] the client context

Param connected:

[in] true when connected, false when disconnected

Param userdata:

[in] the user data passed at context creation

void (*eos_cb)(struct vipcc_ctx *ctx, enum vipc_eos_reason reason, void *userdata)#

End of stream.

This function is called when the stream is finished: no more frame will be received. In such case, the client instance is automatically stopped and the call to vipcc_stop() can be avoided.

Param ctx:

[in] the client context

Param reason:

[in] the reason why video IPC stream is stopping

Param userdata:

[in] the user data passed at context creation

struct vipc_crop#

Frame crop rectangle.

The crop rectangle is composed of float which must be set in the range of 0.0 to 1.0: the values are relative.

Public Members

float left#

Horizontal offset of the top-left corner of the crop rectangle.

float top#

Vertical offset of the top-left corner of the crop rectangle.

float width#

Width of the crop rectangle.

float height#

Height of the crop rectangle.

struct vipc_frame_meta#

Frame meta data.

This structure fields are intended to store some addition meta data within a frame. The fields are optional and if no meta data are linked to the frame, the flags value must be 0.

Public Members

uint64_t flags#

Meta data presence. This is a bit-field composed by the enum vipc_meta_flag values. For more details, please read its documentation. When a bit is set, the associated meta data value is set below.

uint64_t exposure_time_ns#

Exposure time in ns (set VIPC_META_FLAG_EXPOSURE_TIME).

struct vipc_frame#

frame

Public Members

void *context#

private context

uint32_t index#

frame index, used by the backend

enum vacq_pix_format format#

frame format

uint64_t ts_sof_ns#

start of frame timestamp, ns

uint64_t ts_eof_ns#

end of frame timestamp, ns

uint32_t width#

frame width

uint32_t height#

frame height

float dar#

display aspect ratio

unsigned int num_planes#

number of planes [1, VIPC_PLANE_COUNT]

uint32_t stride#

stride (size in bytes of a row) for the plane

size_t size#

size in byte of the plane

uintptr_t virt_addr#

virtual address if the plane is mapped

struct vipc_frame::[anonymous] planes[VIPC_PLANE_COUNT]#

planes

struct vipc_crop crop#

Effective crop applied on frame.

struct vipc_frame_meta meta#

Additional meta data.

uint64_t ts_out_ns#

debug: vipc client output timestamp, ns

void *priv#

private data (used by backend implementation)

Functions#

VIPC_API int vipcc_cfg_get_info(const char *stream, struct vipcc_cfg_info *info)#

Get client configuration information based on stream name

Parameters:
  • stream[in] the stream name

  • info[out] the information about the stream

Returns:

0 in case of success, -errno for failure

VIPC_API void vipcc_cfg_release_info(struct vipcc_cfg_info *info)#

Release client configuration information

Parameters:

info[in] the information about the stream

VIPC_API struct vipcc_ctx *vipcc_new(struct pomp_loop *loop, const struct vipcc_cb *cbs, const struct vipc_be_cb *be_cbs, const char *pomp_addr, void *userdata, size_t max_frames, bool map)#

Create a VIDEO IPC Client context

Backend will be created through a backend callback when the status is received. Frame after received after max_frames will be immediately released.

See also

vipcc_cb

Parameters:
  • loop[in] The pomp loop where the server will be registered

  • cbs[in] Array of callbacks,

  • be_cbs[in] Callbacks for the backend

  • pomp_addr[in] remote address to connect to (in pomp_addr_parse format)

  • userdata[in] passed as an extra argument to the callbacks

  • max_frames[in] max frames that can be held at a given time

  • map[in] wether to map the frame in the address space of the client

Returns:

a valid context or NULL

VIPC_API int vipcc_destroy(struct vipcc_ctx *ctx)#

Destroy a VIDEO IPC Client context

Release all frames and disconnect from the server.

Warning

this function must not be called from any of the VIPC client callbacks.

Parameters:

ctx[in] video ipc ctx

Returns:

0 in case of success, -errno for failure

VIPC_API int vipcc_start(struct vipcc_ctx *ctx)#

Send start to the server

The server will send frames after receiving this message. It can only be send if the status has been received.

Parameters:

ctx[in] video ipc ctx

Returns:

0 in case of success, -errno for failure

VIPC_API int vipcc_stop(struct vipcc_ctx *ctx)#

Send stop to the server

The server will send frames after receiving this message. It can only be send if the status has been received.

Parameters:

ctx[in] video ipc ctx

Returns:

0 in case of success, -errno for failure

VIPC_API int vipcc_release(struct vipcc_ctx *ctx, const struct vipc_frame *frame)#

Release a frame

Send a release message to the server. All resources associated with the frame in the client will be freed as well.

Parameters:
  • ctx[in] video ipc ctx

  • frame[in] to release.

Returns:

0 in case of success, -errno for failure

VIPC_API int vipcc_release_safe(const struct vipc_frame *frame)#

Release a frame, thread safe (can be called outside of the pomp loop)

Send a release message to the server. All resources associated with the frame in the client will be freed as well. This will be done asynchronously, not all errors will be propagated back

Parameters:
  • ctx[in] video ipc ctx

  • frame[in] to release.

Returns:

0 in case of success, -errno for failure

VIPC_API int vipcc_configure(struct vipcc_ctx *ctx, const struct vipc_configure *config)#

Send a new config to the server

Parameters:
  • ctx[in] video ipc context

  • config[in] new config

C++ api#

Classes#

Warning

doxygenclass: Cannot find class “vipc::Client” in doxygen xml output for project “libvideo-ipc” from directory: /data/jenkins/jobs/sphinx-doc-release/workspace/out/doc-sdk/doc/libvideo-ipc/xml