Voyant API 1.0.0
Loading...
Searching...
No Matches
voyant_playback_base_ffi.hpp File Reference
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>
#include <voyant_types_ffi.hpp>

Go to the source code of this file.

Classes

struct  VoyantPlaybackBaseC

Functions

VoyantPlaybackBaseC voyant_playback_create (bool keep_invalid_points)
int32_t voyant_playback_open_file (VoyantPlaybackBaseC *playback, const char *file_path, char *error_buf, uintptr_t error_capacity)
int32_t voyant_playback_reset (VoyantPlaybackBaseC *playback)
int32_t voyant_playback_next_frame (VoyantPlaybackBaseC *playback)
VoyantFrameMeta voyant_playback_frame_meta (const VoyantPlaybackBaseC *playback)
int64_t voyant_playback_frame_points (const VoyantPlaybackBaseC *playback, PointDataV1 *dest, uintptr_t capacity)
int32_t voyant_playback_current_frame_timestamp (const VoyantPlaybackBaseC *playback, uint64_t *timestamp_out)
int32_t voyant_playback_current_frame_index (const VoyantPlaybackBaseC *playback, uintptr_t *index_out)
int32_t voyant_playback_api_version (const VoyantPlaybackBaseC *playback, char *version_buf, uintptr_t version_capacity)
void voyant_playback_free (VoyantPlaybackBaseC playback)

Function Documentation

◆ voyant_playback_api_version()

int32_t voyant_playback_api_version ( const VoyantPlaybackBaseC * playback,
char * version_buf,
uintptr_t version_capacity )

Gets the version of the API that produced the open recording, e.g. "1.0.0" or "1.0.0-alpha". A converted recording reports the version that produced the original, not the one that converted it.

Safety

  • playback must be a valid VoyantPlaybackBaseC instance
  • version_buf must point to at least version_capacity writable bytes

Parameters

  • playback: Pointer to VoyantPlaybackBaseC instance
  • version_buf: Buffer the NUL-terminated version string is written into
  • version_capacity: Size of version_buf in bytes

Returns

  • 1: Success, the version was written to version_buf
  • 0: Failure, playback is invalid, no file is open, or version_buf is null or too small for the version and its terminator

◆ voyant_playback_create()

VoyantPlaybackBaseC voyant_playback_create ( bool keep_invalid_points)

Creates a new VoyantPlayback instance

Parameters
keep_invalid_pointsWhether frames keep their invalid points. When false, invalid points are removed as frames are read. Invalid points come from a capture made with the client's diagnostic mode enabled, or from frames built by hand.
Returns
VoyantPlaybackBaseC struct containing the playback instance

◆ voyant_playback_current_frame_index()

int32_t voyant_playback_current_frame_index ( const VoyantPlaybackBaseC * playback,
uintptr_t * index_out )

Gets the current frame index (0-based). Frame 0 is the first frame in the file.

Safety

Parameters

  • playback: Pointer to VoyantPlaybackBaseC instance
  • index_out: Pointer to a usize where the frame index will be stored

Returns

  • 1: Success, index was written to index_out
  • 0: Failure, playback is invalid

◆ voyant_playback_current_frame_timestamp()

int32_t voyant_playback_current_frame_timestamp ( const VoyantPlaybackBaseC * playback,
uint64_t * timestamp_out )

Gets the current frame timestamp in nanoseconds

Safety

Parameters

  • playback: Pointer to VoyantPlaybackBaseC instance
  • timestamp_out: Pointer to a u64 where the timestamp will be stored

Returns

  • 1: Success, timestamp was written to timestamp_out
  • 0: Failure, playback is invalid

◆ voyant_playback_frame_meta()

VoyantFrameMeta voyant_playback_frame_meta ( const VoyantPlaybackBaseC * playback)

Gets the current frame's fixed-size fields

Size the point buffer for voyant_playback_frame_points from the returned n_points.

Safety

Parameters

Returns

The current frame's fields, or a zeroed (empty, stateless) value if the playback instance is invalid

◆ voyant_playback_frame_points()

int64_t voyant_playback_frame_points ( const VoyantPlaybackBaseC * playback,
PointDataV1 * dest,
uintptr_t capacity )

Copies the current frame's points into dest, up to capacity points

Safety

Parameters

  • playback: Pointer to VoyantPlaybackBaseC instance
  • dest: Pointer to the destination point buffer
  • capacity: Size of dest in points

Returns

  • >= 0: Number of points copied
  • -1: Playback is invalid, or dest is null with nonzero capacity

◆ voyant_playback_free()

void voyant_playback_free ( VoyantPlaybackBaseC playback)

Frees memory associated with a VoyantPlaybackBaseC instance

Safety

  • playback must be a valid VoyantPlaybackBaseC instance
  • After calling this function, the playback instance should not be used

Parameters

◆ voyant_playback_next_frame()

int32_t voyant_playback_next_frame ( VoyantPlaybackBaseC * playback)

Reads the next frame

Safety

Parameters

Returns

  • 1: Successfully read a frame
  • 0: End of file reached
  • -1: Error (IO error, deserialization error, etc.)
  • -2: Invalid playback instance

◆ voyant_playback_open_file()

int32_t voyant_playback_open_file ( VoyantPlaybackBaseC * playback,
const char * file_path,
char * error_buf,
uintptr_t error_capacity )

Opens a file for playback

Safety

  • playback must be a valid VoyantPlaybackBaseC instance
  • file_path must be a valid null-terminated C string
  • error_buf must be null or point to a buffer of at least error_capacity bytes

Parameters

  • playback: Pointer to VoyantPlaybackBaseC instance
  • file_path: C string containing path to the recording file
  • error_buf: Buffer receiving the failure reason (see the string contract in voyant_types_ffi.hpp); untouched on success. A rejected pre-v1.0.0 recording's message names the conversion command for that exact file.
  • error_capacity: Size of error_buf in bytes

Returns

  • 1: Success
  • 0: Failure

◆ voyant_playback_reset()

int32_t voyant_playback_reset ( VoyantPlaybackBaseC * playback)

Resets playback to the beginning of the file

Safety

Parameters

Returns

  • 1: Success
  • 0: Failure (no file open or invalid playback)