OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — C API referencev12.0

optris_sdk_video_picture

One BGRA picture the application composed, and when it belongs.

A plain buffer rather than an SDK frame, because an application that draws over the SDK's picture does not have one of those: it has its own surface, with its own row stride.

Public attributes

struct_size

uint32_t struct_size

Set to sizeof(optris_sdk_video_picture), or call optris_sdk_video_picture_init().

reserved0

uint32_t reserved0

Reserved; always zero. Named so the pointer below sits at an offset this header states rather than one the compiler chose.

bgra

const uint8_t * bgra

BGRA8 pixels, row-major: byte 0 blue, 1 green, 2 red, 3 alpha. The same layout optris_sdk_imager_set_bgra_callback() delivers, and the one Windows bitmaps, Avalonia's Bgra8888 and most GPU uploads want, so the common case is a straight copy with no channel work.

data_size

size_t data_size

Bytes bgra points at. Required, and checked against stride * height before anything is read: everything else here describes the work rather than the memory, and a caller that gets one of them wrong would otherwise have the SDK read off the end of its surface with nothing to catch it.

width

uint32_t width

Picture width in pixels. Must equal optris_sdk_video_export_config::width.

A video stream has one frame size for its whole length and the encoder is opened once, so this cannot vary per frame. It is carried and validated rather than omitted, so a caller that changes its surface size mid-export is told rather than producing a file of sheared pictures.

height

uint32_t height

Picture height in pixels. Must equal optris_sdk_video_export_config::height.

stride

uint32_t stride

Row stride in bytes. 0 means width * 4, which is the tight case.

This is the field that makes a caller-composed surface usable: a GPU readback, a Windows DIB and a Cairo surface are all padded to an alignment, and before this the stride was computed from the configured width and a padded buffer sheared.

has_timestamp

int32_t has_timestamp

Non-zero when timestamp_us is the time this picture belongs at.

This is what keeps a recording's gaps in the video. Neither pacing the exporter offers fits an export: counting frames closes the gaps in a recording, and optris_sdk_video_export_config::pace_by_arrival follows the speed the replay is being fed at. The recording's own time per frame is the only one that keeps the video in step with what was recorded, gaps included -- and a BgraFrame carries none, which is why it is here.

Zero falls back to whatever optris_sdk_video_export_config::pace_by_arrival selects.

timestamp_us

uint64_t timestamp_us

Presentation time in microseconds from the start of the video, read only while has_timestamp is non-zero.

Quantised to the stream's time base, which is one optris_sdk_video_export_config::frame_rate period per unit, so a gap shorter than one frame period cannot be represented and closes. Timestamps must increase: one that does not is advanced to the next free slot rather than written, because a repeated timestamp is not a slightly wrong duration -- it is a stream a demuxer may refuse.