mirror of
https://github.com/storytold/k4a-sys-temp.git
synced 2026-10-09 00:09:45 +00:00
Split vendor/include into windows and linux versions, because the headers are slightly different. The issue I noticed is
k4a_export.h uses decltype on windows, and something else on linux. For this reason I just took the k4a/*.h from /usr/local/include and added them here.
This commit is contained in:
+42
@@ -0,0 +1,42 @@
|
||||
|
||||
#ifndef K4A_EXPORT_H
|
||||
#define K4A_EXPORT_H
|
||||
|
||||
#ifdef K4A_STATIC_DEFINE
|
||||
# define K4A_EXPORT
|
||||
# define K4A_NO_EXPORT
|
||||
#else
|
||||
# ifndef K4A_EXPORT
|
||||
# ifdef k4a_EXPORTS
|
||||
/* We are building this library */
|
||||
# define K4A_EXPORT __attribute__((visibility("default")))
|
||||
# else
|
||||
/* We are using this library */
|
||||
# define K4A_EXPORT __attribute__((visibility("default")))
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef K4A_NO_EXPORT
|
||||
# define K4A_NO_EXPORT __attribute__((visibility("hidden")))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef K4A_DEPRECATED
|
||||
# define K4A_DEPRECATED __attribute__ ((__deprecated__))
|
||||
#endif
|
||||
|
||||
#ifndef K4A_DEPRECATED_EXPORT
|
||||
# define K4A_DEPRECATED_EXPORT K4A_EXPORT K4A_DEPRECATED
|
||||
#endif
|
||||
|
||||
#ifndef K4A_DEPRECATED_NO_EXPORT
|
||||
# define K4A_DEPRECATED_NO_EXPORT K4A_NO_EXPORT K4A_DEPRECATED
|
||||
#endif
|
||||
|
||||
#if 0 /* DEFINE_NO_DEPRECATED */
|
||||
# ifndef K4A_NO_DEPRECATED
|
||||
# define K4A_NO_DEPRECATED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the MIT License. */
|
||||
|
||||
#ifndef K4AVERSION_H
|
||||
#define K4AVERSION_H
|
||||
|
||||
#define K4A_VERSION_MAJOR 1
|
||||
#define K4A_VERSION_MINOR 3
|
||||
#define K4A_VERSION_PATCH 0
|
||||
#define K4A_VERSION_PRERELEASE "private"
|
||||
#define K4A_VERSION_BUILD_METADATA ""
|
||||
|
||||
#define K4A_VERSION_STR "1.3.0-private"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
#ifndef K4ARECORD_EXPORT_H
|
||||
#define K4ARECORD_EXPORT_H
|
||||
|
||||
#ifdef K4ARECORD_STATIC_DEFINE
|
||||
# define K4ARECORD_EXPORT
|
||||
# define K4ARECORD_NO_EXPORT
|
||||
#else
|
||||
# ifndef K4ARECORD_EXPORT
|
||||
# ifdef k4arecord_EXPORTS
|
||||
/* We are building this library */
|
||||
# define K4ARECORD_EXPORT __attribute__((visibility("default")))
|
||||
# else
|
||||
/* We are using this library */
|
||||
# define K4ARECORD_EXPORT __attribute__((visibility("default")))
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef K4ARECORD_NO_EXPORT
|
||||
# define K4ARECORD_NO_EXPORT __attribute__((visibility("hidden")))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef K4ARECORD_DEPRECATED
|
||||
# define K4ARECORD_DEPRECATED __attribute__ ((__deprecated__))
|
||||
#endif
|
||||
|
||||
#ifndef K4ARECORD_DEPRECATED_EXPORT
|
||||
# define K4ARECORD_DEPRECATED_EXPORT K4ARECORD_EXPORT K4ARECORD_DEPRECATED
|
||||
#endif
|
||||
|
||||
#ifndef K4ARECORD_DEPRECATED_NO_EXPORT
|
||||
# define K4ARECORD_DEPRECATED_NO_EXPORT K4ARECORD_NO_EXPORT K4ARECORD_DEPRECATED
|
||||
#endif
|
||||
|
||||
#if 0 /* DEFINE_NO_DEPRECATED */
|
||||
# ifndef K4ARECORD_NO_DEPRECATED
|
||||
# define K4ARECORD_NO_DEPRECATED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Vendored
+2277
File diff suppressed because it is too large
Load Diff
Vendored
+1441
File diff suppressed because it is too large
Load Diff
+1271
File diff suppressed because it is too large
Load Diff
Vendored
+917
@@ -0,0 +1,917 @@
|
||||
/** \file playback.h
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
* Kinect For Azure Recording Playback SDK.
|
||||
*/
|
||||
|
||||
#ifndef K4A_PLAYBACK_H
|
||||
#define K4A_PLAYBACK_H
|
||||
|
||||
#include <k4arecord/types.h>
|
||||
#include <k4arecord/k4arecord_export.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
*
|
||||
* \addtogroup Functions
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Opens an existing recording file for reading.
|
||||
*
|
||||
* \param path
|
||||
* Filesystem path of the existing recording.
|
||||
*
|
||||
* \param playback_handle
|
||||
* If successful, this contains a pointer to the recording handle. Caller must call k4a_playback_close() when
|
||||
* finished with the recording.
|
||||
*
|
||||
* \headerfile playback.h <k4arecord/playback.h>
|
||||
*
|
||||
* \returns ::K4A_RESULT_SUCCEEDED is returned on success
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_playback_open(const char *path, k4a_playback_t *playback_handle);
|
||||
|
||||
/** Get the raw calibration blob for the Azure Kinect device used during recording.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param data
|
||||
* Location to write the calibration data to. This field may optionally be set to NULL if the caller wants to query for
|
||||
* the needed data size.
|
||||
*
|
||||
* \param data_size
|
||||
* On passing \p data_size into the function this variable represents the available size to write the raw data to. On
|
||||
* return this variable is updated with the amount of data actually written to the buffer.
|
||||
*
|
||||
* \returns
|
||||
* ::K4A_BUFFER_RESULT_SUCCEEDED if \p data was successfully written. If \p data_size points to a buffer size that is
|
||||
* too small to hold the output, ::K4A_BUFFER_RESULT_TOO_SMALL is returned and \p data_size is updated to contain the
|
||||
* minimum buffer size needed to capture the calibration data.
|
||||
*
|
||||
* \remarks
|
||||
* The raw calibration may not exist if the device was not specified during recording.
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_buffer_result_t k4a_playback_get_raw_calibration(k4a_playback_t playback_handle,
|
||||
uint8_t *data,
|
||||
size_t *data_size);
|
||||
|
||||
/** Get the camera calibration for Azure Kinect device used during recording. The output struct is used as input to all
|
||||
* transformation functions.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param calibration
|
||||
* Location to write the calibration.
|
||||
*
|
||||
* \returns
|
||||
* ::K4A_RESULT_SUCCEEDED if \p calibration was successfully written. ::K4A_RESULT_FAILED otherwise.
|
||||
*
|
||||
* \remarks
|
||||
* The calibration may not exist if the device was not specified during recording.
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_playback_get_calibration(k4a_playback_t playback_handle,
|
||||
k4a_calibration_t *calibration);
|
||||
|
||||
/** Get the device configuration used during recording.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param config
|
||||
* Location to write the recording configuration.
|
||||
*
|
||||
* \returns
|
||||
* ::K4A_RESULT_SUCCEEDED if \p config was successfully written. ::K4A_RESULT_FAILED otherwise.
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_playback_get_record_configuration(k4a_playback_t playback_handle,
|
||||
k4a_record_configuration_t *config);
|
||||
|
||||
/** Checks whether a track with the given track name exists in the playback file.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param track_name
|
||||
* The track name to be checked to see whether it exists or not.
|
||||
*
|
||||
* \returns true if the track exists.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT bool k4a_playback_check_track_exists(k4a_playback_t playback_handle, const char *track_name);
|
||||
|
||||
/** Get the number of tracks in a playback file.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \returns the number of tracks in the playback file.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT size_t k4a_playback_get_track_count(k4a_playback_t playback_handle);
|
||||
|
||||
/** Gets the name of a track at a specific index.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param track_index
|
||||
* The index of the track to read the name form.
|
||||
*
|
||||
* \param track_name
|
||||
* Location to write the track name. This will be a UTF8 null terminated string. If a NULL buffer is specified,
|
||||
* \p track_name_size will be set to the size of buffer needed to store the string.
|
||||
*
|
||||
* \param track_name_size
|
||||
* On input, the size of the \p track_name buffer. On output, this is set to the length of the track_name value
|
||||
* (including the null terminator).
|
||||
*
|
||||
* \returns
|
||||
* A return of ::K4A_BUFFER_RESULT_SUCCEEDED means that the \p track_name has been filled in. If the buffer is too small
|
||||
* the function returns ::K4A_BUFFER_RESULT_TOO_SMALL and the needed size of the \p track_name buffer is returned in the
|
||||
* \p track_name_size parameter. ::K4A_BUFFER_RESULT_FAILED is returned if the track index does not exist. All other
|
||||
* failures return ::K4A_BUFFER_RESULT_FAILED.
|
||||
*
|
||||
* \remarks
|
||||
* When used along with k4a_playback_get_track_count(), this function can be used to enumerate all the available tracks
|
||||
* in a playback file. Additionally k4a_playback_track_is_builtin() can be used to filter custom tracks.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_buffer_result_t k4a_playback_get_track_name(k4a_playback_t playback_handle,
|
||||
size_t track_index,
|
||||
char *track_name,
|
||||
size_t *track_name_size);
|
||||
|
||||
/** Checks whether a track is one of the built-in tracks: "COLOR", "DEPTH", etc...
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param track_name
|
||||
* The track name to be checked to see whether it is a built-in track.
|
||||
*
|
||||
* \returns true if the track is built-in. If the provided track name does not exist, false will be returned.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT bool k4a_playback_track_is_builtin(k4a_playback_t playback_handle, const char *track_name);
|
||||
|
||||
/** Gets the video-specific track information for a particular video track.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param track_name
|
||||
* The track name to read video settings from.
|
||||
*
|
||||
* \param video_settings
|
||||
* Location to write the track's video settings.
|
||||
*
|
||||
* \returns ::K4A_RESULT_SUCCEEDED is returned on success, ::K4A_RESULT_FAILED is returned if the specified track does
|
||||
* not exist or is not a video track.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_playback_track_get_video_settings(k4a_playback_t playback_handle,
|
||||
const char *track_name,
|
||||
k4a_record_video_settings_t *video_settings);
|
||||
|
||||
/** Gets the codec id string for a particular track.
|
||||
*
|
||||
* The codec ID is a string that corresponds to the codec of the track's data. Some of the existing formats are listed
|
||||
* here: https://www.matroska.org/technical/specs/codecid/index.html. It can also be custom defined by the user.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param track_name
|
||||
* The track name to read the codec id from.
|
||||
*
|
||||
* \param codec_id
|
||||
* Location to write the codec id. This will be a UTF8 null terminated string. If a NULL buffer is specified,
|
||||
* \p codec_id_size will be set to the size of buffer needed to store the string.
|
||||
*
|
||||
* \param codec_id_size
|
||||
* On input, the size of the \p codec_id buffer. On output, this is set to the length of the codec_id value (including
|
||||
* the null terminator).
|
||||
*
|
||||
* \returns
|
||||
* A return of ::K4A_BUFFER_RESULT_SUCCEEDED means that the \p codec_id has been filled in. If the buffer is too small
|
||||
* the function returns ::K4A_BUFFER_RESULT_TOO_SMALL and the needed size of the \p codec_id buffer is returned in the
|
||||
* \p codec_id_size parameter. ::K4A_BUFFER_RESULT_FAILED is returned if the track_name does not exist. All other
|
||||
* failures return ::K4A_BUFFER_RESULT_FAILED.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_buffer_result_t k4a_playback_track_get_codec_id(k4a_playback_t playback_handle,
|
||||
const char *track_name,
|
||||
char *codec_id,
|
||||
size_t *codec_id_size);
|
||||
|
||||
/** Gets the codec context for a particular track.
|
||||
*
|
||||
* The codec context is a codec-specific buffer that contains any required codec metadata that is only known to the
|
||||
* codec. It is mapped to the matroska Codec Private field.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param track_name
|
||||
* The track name to read the codec context from.
|
||||
*
|
||||
* \param codec_context
|
||||
* Location to write the codec context data. If a NULL buffer is specified, \p codec_context_size will be set to the
|
||||
* size of buffer needed to store the data.
|
||||
*
|
||||
* \param codec_context_size
|
||||
* On input, the size of the \p codec_context buffer. On output, this is set to the length of the codec_context data.
|
||||
*
|
||||
* \returns
|
||||
* A return of ::K4A_BUFFER_RESULT_SUCCEEDED means that the \p codec_context has been filled in. If the buffer is too
|
||||
* small the function returns ::K4A_BUFFER_RESULT_TOO_SMALL and the needed size of the \p codec_context buffer is
|
||||
* returned in the \p codec_context_size parameter. ::K4A_BUFFER_RESULT_FAILED is returned if the track_name does not
|
||||
* exist. All other failures return ::K4A_BUFFER_RESULT_FAILED.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_buffer_result_t k4a_playback_track_get_codec_context(k4a_playback_t playback_handle,
|
||||
const char *track_name,
|
||||
uint8_t *codec_context,
|
||||
size_t *codec_context_size);
|
||||
|
||||
/** Read the value of a tag from a recording.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param name
|
||||
* The name of the tag to read.
|
||||
*
|
||||
* \param value
|
||||
* Location to write the tag value. This will be a UTF8 null terminated string. If a NULL buffer is specified,
|
||||
* \p value_size will be set to the size of buffer needed to store the string.
|
||||
*
|
||||
* \param value_size
|
||||
* On input, the size of the \p value buffer. On output, this is set to the length of the tag value (including the null
|
||||
* terminator).
|
||||
*
|
||||
* \returns
|
||||
* A return of ::K4A_BUFFER_RESULT_SUCCEEDED means that the \p value has been filled in. If the buffer is too small the
|
||||
* function returns ::K4A_BUFFER_RESULT_TOO_SMALL and the needed size of the \p value buffer is returned in the
|
||||
* \p value_size parameter. ::K4A_BUFFER_RESULT_FAILED is returned if the tag does not exist. All other failures return
|
||||
* ::K4A_BUFFER_RESULT_FAILED.
|
||||
*
|
||||
* \remarks
|
||||
* Tags are global to a file, and should store data related to the entire recording, such as camera configuration or
|
||||
* recording location.
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_buffer_result_t k4a_playback_get_tag(k4a_playback_t playback_handle,
|
||||
const char *name,
|
||||
char *value,
|
||||
size_t *value_size);
|
||||
|
||||
/** Set the image format that color captures will be converted to. By default the conversion format will be the same as
|
||||
* the image format stored in the recording file, and no conversion will occur.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param target_format
|
||||
* The target image format to be returned in captures.
|
||||
*
|
||||
* \returns
|
||||
* ::K4A_RESULT_SUCCEEDED if the format conversion is supported. ::K4A_RESULT_FAILED otherwise.
|
||||
*
|
||||
* \remarks
|
||||
* After the color conversion format is set, all \ref k4a_capture_t objects returned from the playback handle will have
|
||||
* their color images converted to the \p target_format.
|
||||
*
|
||||
* \remarks
|
||||
* Color format conversion occurs in the user-thread, so setting \p target_format to anything other than the format
|
||||
* stored in the file may significantly increase the latency of \p k4a_playback_get_next_capture() and
|
||||
* \p k4a_playback_get_previous_capture().
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_playback_set_color_conversion(k4a_playback_t playback_handle,
|
||||
k4a_image_format_t target_format);
|
||||
|
||||
/** Reads an attachment file from a recording.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param file_name
|
||||
* The attachment file name.
|
||||
*
|
||||
* \param data
|
||||
* Location to write the attachment data. If a NULL buffer is specified, \p data_size will be set to the size of
|
||||
* buffer needed to store the data.
|
||||
*
|
||||
* \param data_size
|
||||
* On input, the size of the \p data buffer. On output, this is set to the length of the attachment data.
|
||||
*
|
||||
* \returns
|
||||
* A return of ::K4A_BUFFER_RESULT_SUCCEEDED means that the \p data has been filled in. If the buffer is too small the
|
||||
* function returns ::K4A_BUFFER_RESULT_TOO_SMALL and the needed size of the \p data buffer is returned in the
|
||||
* \p data_size parameter. ::K4A_BUFFER_RESULT_FAILED is returned if the attachment \p file_name does not exist. All
|
||||
* other failures return ::K4A_BUFFER_RESULT_FAILED.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_buffer_result_t k4a_playback_get_attachment(k4a_playback_t playback_handle,
|
||||
const char *file_name,
|
||||
uint8_t *data,
|
||||
size_t *data_size);
|
||||
|
||||
/** Read the next capture in the recording sequence.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param capture_handle
|
||||
* If successful this contains a handle to a capture object. Caller must call k4a_capture_release() when its done using
|
||||
* this capture
|
||||
*
|
||||
* \returns
|
||||
* ::K4A_STREAM_RESULT_SUCCEEDED if a capture is returned, or ::K4A_STREAM_RESULT_EOF if the end of the recording is
|
||||
* reached. All other failures will return ::K4A_STREAM_RESULT_FAILED.
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \remarks
|
||||
* k4a_playback_get_next_capture() always returns the next capture in sequence after the most recently returned capture.
|
||||
*
|
||||
* \remarks
|
||||
* The first call to k4a_playback_get_next_capture() after k4a_playback_seek_timestamp() will return the capture
|
||||
* in the recording closest to the seek time with an image timestamp greater than or equal to the seek time.
|
||||
*
|
||||
* \remarks
|
||||
* If a call was made to k4a_playback_get_previous_capture() that returned ::K4A_STREAM_RESULT_EOF, the playback
|
||||
* position is at the beginning of the stream and k4a_playback_get_next_capture() will return the first capture in the
|
||||
* recording.
|
||||
*
|
||||
* \remarks
|
||||
* Capture objects returned by the playback API will always contain at least one image, but may have images missing if
|
||||
* frames were dropped in the original recording. When calling k4a_capture_get_color_image(),
|
||||
* k4a_capture_get_depth_image(), or k4a_capture_get_ir_image(), the image should be checked for NULL.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_stream_result_t k4a_playback_get_next_capture(k4a_playback_t playback_handle,
|
||||
k4a_capture_t *capture_handle);
|
||||
|
||||
/** Read the previous capture in the recording sequence.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param capture_handle
|
||||
* If successful this contains a handle to a capture object. Caller must call k4a_capture_release() when its done using
|
||||
* this capture.
|
||||
*
|
||||
* \returns
|
||||
* ::K4A_STREAM_RESULT_SUCCEEDED if a capture is returned, or ::K4A_STREAM_RESULT_EOF if the start of the recording is
|
||||
* reached. All other failures will return ::K4A_STREAM_RESULT_FAILED.
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \remarks
|
||||
* k4a_playback_get_previous_capture() always returns the previous capture in the sequence before the most
|
||||
* recently returned capture.
|
||||
*
|
||||
* \remarks
|
||||
* If a call was made to k4a_playback_get_next_capture() that returned ::K4A_STREAM_RESULT_EOF, the playback position
|
||||
* is at the end of the stream and k4a_playback_get_previous_capture() will return the last capture in
|
||||
* the recording.
|
||||
*
|
||||
* \remarks
|
||||
* The first call to k4a_playback_get_previous_capture() after k4a_playback_seek_timestamp() will return the
|
||||
* capture in the recording closest to the seek time with all image timestamps less than the seek time.
|
||||
*
|
||||
* \remarks
|
||||
* Capture objects returned by this API will always contain at least one image, but may have images missing if frames
|
||||
* were dropped in the original recording. When calling k4a_capture_get_color_image(), k4a_capture_get_depth_image(), or
|
||||
* k4a_capture_get_ir_image(), the image should be checked for NULL.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_stream_result_t k4a_playback_get_previous_capture(k4a_playback_t playback_handle,
|
||||
k4a_capture_t *capture_handle);
|
||||
|
||||
/** Read the next IMU sample in the recording sequence.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param imu_sample
|
||||
* The location to write the IMU sample.
|
||||
*
|
||||
* \returns
|
||||
* ::K4A_STREAM_RESULT_SUCCEEDED if a sample is returned, or ::K4A_STREAM_RESULT_EOF if the end of the recording is
|
||||
* reached. All other failures will return ::K4A_STREAM_RESULT_FAILED.
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \remarks
|
||||
* k4a_playback_get_next_imu_sample() always returns the IMU sample after the most recently returned sample.
|
||||
*
|
||||
* \remarks
|
||||
* If a call was made to k4a_playback_get_previous_imu_sample() which returned ::K4A_STREAM_RESULT_EOF, then the
|
||||
* playback position is at the beginning of the recording and k4a_playback_get_next_imu_sample() will return the first
|
||||
* IMU sample in the recording.
|
||||
*
|
||||
* \remarks
|
||||
* The first call to k4a_playback_get_next_imu_sample() after k4a_playback_seek_timestamp() will return the IMU
|
||||
* sample in the recording closest to the seek time with a timestamp greater than or equal to the seek time.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_stream_result_t k4a_playback_get_next_imu_sample(k4a_playback_t playback_handle,
|
||||
k4a_imu_sample_t *imu_sample);
|
||||
|
||||
/** Read the previous IMU sample in the recording sequence.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param imu_sample [OUT]
|
||||
* The location to write the IMU sample.
|
||||
*
|
||||
* \returns
|
||||
* ::K4A_STREAM_RESULT_SUCCEEDED if a sample is returned, or ::K4A_STREAM_RESULT_EOF if the start of the recording is
|
||||
* reached. All other failures will return ::K4A_STREAM_RESULT_FAILED.
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \remarks
|
||||
* k4a_playback_get_previous_imu_sample() always returns the IMU sample before the most recently returned sample.
|
||||
*
|
||||
* \remarks
|
||||
* If a call was made to to k4a_playback_get_next_imu_sample() which returned ::K4A_STREAM_RESULT_EOF, then the playback
|
||||
* position is at the end of the recording and k4a_playback_get_previous_imu_sample() will return the last IMU sample in
|
||||
* the recording.
|
||||
*
|
||||
* \remarks
|
||||
* The first call to k4a_playback_get_previous_imu_sample() after k4a_playback_seek_timestamp() will return the
|
||||
* IMU sample closest to the seek time with a timestamp less than the seek time.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_stream_result_t k4a_playback_get_previous_imu_sample(k4a_playback_t playback_handle,
|
||||
k4a_imu_sample_t *imu_sample);
|
||||
|
||||
/** Read the next data block for a particular track.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param track_name
|
||||
* The name of the track to read the next data block from.
|
||||
*
|
||||
* \param data_block_handle
|
||||
* The location to write the data block handle.
|
||||
*
|
||||
* \returns
|
||||
* ::K4A_STREAM_RESULT_SUCCEEDED if a data block is returned, or ::K4A_STREAM_RESULT_EOF if the end of the recording is
|
||||
* reached. All other failures will return ::K4A_STREAM_RESULT_FAILED.
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \remarks
|
||||
* k4a_playback_get_next_data_block() always returns the data block after the most recently returned data block for a
|
||||
* particular track.
|
||||
*
|
||||
* \remarks
|
||||
* If a call was made to k4a_playback_get_previous_data_block() which returned ::K4A_STREAM_RESULT_EOF, then the
|
||||
* playback position is at the beginning of the recording and calling k4a_playback_get_next_data_block() with the same
|
||||
* track will return the first data block in the track.
|
||||
*
|
||||
* \remarks
|
||||
* The first call to k4a_playback_get_next_data_block() after k4a_playback_seek_timestamp() will return the data
|
||||
* block in the recording closest to the seek time with a timestamp greater than or equal to the seek time.
|
||||
*
|
||||
* \remarks
|
||||
* k4a_playback_get_next_data_block() cannot be used with the built-in tracks: "COLOR", "DEPTH", etc...
|
||||
* k4a_playback_track_is_builtin() can be used to determine if a track is a built-in track.
|
||||
*
|
||||
* \remarks
|
||||
* If the call is successful, callers must call k4a_playback_data_block_release() to return the allocated memory for
|
||||
* data_block_handle.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_stream_result_t k4a_playback_get_next_data_block(k4a_playback_t playback_handle,
|
||||
const char *track_name,
|
||||
k4a_playback_data_block_t *data_block_handle);
|
||||
|
||||
/** Read the previous data block for a particular track.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param track_name
|
||||
* The name of the track to read the previous data block from.
|
||||
*
|
||||
* \param data_block_handle
|
||||
* The location to write the data block.
|
||||
*
|
||||
* \returns
|
||||
* ::K4A_STREAM_RESULT_SUCCEEDED if a sample is returned, or ::K4A_STREAM_RESULT_EOF if the start of the recording is
|
||||
* reached. All other failures will return ::K4A_STREAM_RESULT_FAILED.
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \remarks
|
||||
* k4a_playback_get_previous_data_block() always returns the data block before the most recently returned data block for
|
||||
* a particular track.
|
||||
*
|
||||
* \remarks
|
||||
* If a call was made to to k4a_playback_get_next_data_block() which returned ::K4A_STREAM_RESULT_EOF, then the playback
|
||||
* position is at the end of the recording and calling k4a_playback_get_previous_data_block() with the same track will
|
||||
* return the last data block in the track.
|
||||
*
|
||||
* \remarks
|
||||
* The first call to k4a_playback_get_previous_data_block() after k4a_playback_seek_timestamp() will return the
|
||||
* data block closest to the seek time with a timestamp less than the seek time.
|
||||
*
|
||||
* \remarks
|
||||
* If the call is successful, callers must call k4a_playback_data_block_release() to return the allocated memory for
|
||||
* data_block_handle.
|
||||
*
|
||||
* \remarks
|
||||
* k4a_playback_get_previous_data_block() cannot be used with the built-in tracks: "COLOR", "DEPTH", etc...
|
||||
* k4a_playback_track_is_builtin() can be used to determine if a track is a built-in track.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_stream_result_t k4a_playback_get_previous_data_block(k4a_playback_t playback_handle,
|
||||
const char *track_name,
|
||||
k4a_playback_data_block_t *data_block_handle);
|
||||
|
||||
/** Get the device timestamp of a data block in microseconds.
|
||||
*
|
||||
* \param data_block_handle
|
||||
* Handle obtained by k4a_playback_get_next_data_block() or k4a_playback_get_previous_data_block().
|
||||
*
|
||||
* \returns
|
||||
* Returns the device timestamp of the data block. If the \p data_block_handle is invalid this function will return 0.
|
||||
* It is also possible for 0 to be a valid timestamp originating from when a device was first powered on.
|
||||
*
|
||||
* \relates k4a_playback_data_block_t
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT uint64_t
|
||||
k4a_playback_data_block_get_device_timestamp_usec(k4a_playback_data_block_t data_block_handle);
|
||||
|
||||
/** Get the buffer size of a data block.
|
||||
*
|
||||
* \param data_block_handle
|
||||
* Handle obtained by k4a_playback_get_next_data_block() or k4a_playback_get_previous_data_block().
|
||||
*
|
||||
* \returns
|
||||
* Returns the buffer size of the data block, or 0 if the data block is invalid.
|
||||
*
|
||||
* \relates k4a_playback_data_block_t
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT size_t k4a_playback_data_block_get_buffer_size(k4a_playback_data_block_t data_block_handle);
|
||||
|
||||
/** Get the buffer of a data block.
|
||||
*
|
||||
* \param data_block_handle
|
||||
* Handle obtained by k4a_playback_get_next_data_block() or k4a_playback_get_previous_data_block().
|
||||
*
|
||||
* \remarks
|
||||
* Use this buffer to access the data written to a custom recording track.
|
||||
*
|
||||
* \returns
|
||||
* Returns a pointer to the data block buffer, or NULL if the data block is invalid.
|
||||
*
|
||||
* \relates k4a_playback_data_block_t
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT uint8_t *k4a_playback_data_block_get_buffer(k4a_playback_data_block_t data_block_handle);
|
||||
|
||||
/** Release a data block handle.
|
||||
*
|
||||
* \param data_block_handle
|
||||
* Handle obtained by k4a_playback_get_next_data_block() or k4a_playback_get_previous_data_block().
|
||||
*
|
||||
* \remarks
|
||||
* Release the memory of a data block. The caller must not access the object after it is released.
|
||||
*
|
||||
* \relates k4a_playback_data_block_t
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT void k4a_playback_data_block_release(k4a_playback_data_block_t data_block_handle);
|
||||
|
||||
/** Seek to a specific timestamp within a recording.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \param offset_usec
|
||||
* The timestamp offset to seek to, relative to \p origin
|
||||
*
|
||||
* \param origin
|
||||
* Specifies how the given timestamp should be interpreted. Seek can be done relative to the beginning or end of the
|
||||
* recording, or using an absolute device timestamp.
|
||||
*
|
||||
* \returns
|
||||
* ::K4A_RESULT_SUCCEEDED if the seek operation was successful, or ::K4A_RESULT_FAILED if an error occured. The current
|
||||
* seek position is left unchanged if a failure is returned.
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \remarks
|
||||
* The first device timestamp in a recording is usually non-zero. The recording file starts at the device timestamp
|
||||
* defined by start_timestamp_offset_usec, which is accessible via k4a_playback_get_record_configuration().
|
||||
*
|
||||
* \remarks
|
||||
* The first call to k4a_playback_get_next_capture() after k4a_playback_seek_timestamp() will return the first capture
|
||||
* containing an image timestamp greater than or equal to the seek time.
|
||||
*
|
||||
* \remarks
|
||||
* The first call to k4a_playback_get_previous_capture() after k4a_playback_seek_timestamp() will return the first
|
||||
* capture with all image timestamps less than the seek time.
|
||||
*
|
||||
* \remarks
|
||||
* The first call to k4a_playback_get_next_imu_sample() after k4a_playback_seek_timestamp() will return the first imu
|
||||
* sample with a timestamp greter than or equal to the seek time.
|
||||
*
|
||||
* \remarks
|
||||
* The first call to k4a_playback_get_previous_imu_sample() after k4a_playback_seek_timestamp() will return the first
|
||||
* imu sample with a timestamp less than the seek time.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_playback_seek_timestamp(k4a_playback_t playback_handle,
|
||||
int64_t offset_usec,
|
||||
k4a_playback_seek_origin_t origin);
|
||||
|
||||
/** Returns the length of the recording in microseconds.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \returns
|
||||
* The recording length, calculated as the difference between the first and last timestamp in the file.
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \remarks
|
||||
* The recording length may be longer than an individual track if, for example, the IMU continues to run after the last
|
||||
* color image is recorded.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT uint64_t k4a_playback_get_recording_length_usec(k4a_playback_t playback_handle);
|
||||
|
||||
/** Gets the last timestamp in a recording, relative to the start of the recording.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \returns
|
||||
* The file timestamp of the last capture image or IMU sample in microseconds.
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \remarks
|
||||
* This function returns a file timestamp, not an absolute device timestamp, meaning it is relative to the start of the
|
||||
* recording. This function is equivalent to the length of the recording.
|
||||
*
|
||||
* \deprecated
|
||||
* Deprecated starting in 1.2.0. Please use k4a_playback_get_recording_length_usec().
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_DEPRECATED_EXPORT uint64_t k4a_playback_get_last_timestamp_usec(k4a_playback_t playback_handle);
|
||||
|
||||
/** Closes a recording playback handle.
|
||||
*
|
||||
* \param playback_handle
|
||||
* Handle obtained by k4a_playback_open().
|
||||
*
|
||||
* \headerfile playback.h <k4arecord/playback.h>
|
||||
*
|
||||
* \relates k4a_playback_t
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">playback.h (include k4arecord/playback.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT void k4a_playback_close(k4a_playback_t playback_handle);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* K4A_PLAYBACK_H */
|
||||
+339
@@ -0,0 +1,339 @@
|
||||
/** \file playback.hpp
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
* Kinect For Azure SDK - C++ wrapper.
|
||||
*/
|
||||
|
||||
#ifndef K4A_PLAYBACK_HPP
|
||||
#define K4A_PLAYBACK_HPP
|
||||
|
||||
#include <k4a/k4a.hpp>
|
||||
#include <k4arecord/playback.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace k4a
|
||||
{
|
||||
|
||||
/** \class playback playback.hpp
|
||||
* Wrapper for \ref k4a_playback_t
|
||||
*
|
||||
* Wraps a handle for a playback object
|
||||
*
|
||||
* \sa k4a_playback_t
|
||||
*/
|
||||
class playback
|
||||
{
|
||||
public:
|
||||
/** Creates a k4a::playback from a k4a_playback_t
|
||||
* Takes ownership of the handle, i.e. you should not call
|
||||
* k4a_playback_close on the handle after giving it to the
|
||||
* k4a::playback; the k4a::playback will take care of that.
|
||||
*/
|
||||
playback(k4a_playback_t handle = nullptr) noexcept : m_handle(handle) {}
|
||||
|
||||
/** Moves another k4a::playback into a new k4a::playback
|
||||
*/
|
||||
playback(playback &&other) noexcept : m_handle(other.m_handle)
|
||||
{
|
||||
other.m_handle = nullptr;
|
||||
}
|
||||
|
||||
playback(const playback &) = delete;
|
||||
|
||||
~playback()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
playback &operator=(const playback &) = delete;
|
||||
|
||||
/** Moves another k4a::playback into this k4a::playback; other is set to invalid
|
||||
*/
|
||||
playback &operator=(playback &&other) noexcept
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
close();
|
||||
m_handle = other.m_handle;
|
||||
other.m_handle = nullptr;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** Returns true if the k4a::playback is valid, false otherwise
|
||||
*/
|
||||
operator bool() const noexcept
|
||||
{
|
||||
return m_handle != nullptr;
|
||||
}
|
||||
|
||||
/** Closes a K4A recording.
|
||||
*
|
||||
* \sa k4a_playback_close
|
||||
*/
|
||||
void close() noexcept
|
||||
{
|
||||
if (m_handle != nullptr)
|
||||
{
|
||||
k4a_playback_close(m_handle);
|
||||
m_handle = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the raw calibration blob for the K4A device that made the recording.
|
||||
* Throws error on failure.
|
||||
*
|
||||
* \sa k4a_playback_get_raw_calibration
|
||||
*/
|
||||
std::vector<uint8_t> get_raw_calibration() const
|
||||
{
|
||||
std::vector<uint8_t> calibration;
|
||||
size_t buffer = 0;
|
||||
k4a_buffer_result_t result = k4a_playback_get_raw_calibration(m_handle, &calibration[0], &buffer);
|
||||
|
||||
if (result == K4A_BUFFER_RESULT_TOO_SMALL && buffer > 1)
|
||||
{
|
||||
calibration.resize(buffer);
|
||||
result = k4a_playback_get_raw_calibration(m_handle, &calibration[0], &buffer);
|
||||
}
|
||||
|
||||
if (result != K4A_BUFFER_RESULT_SUCCEEDED)
|
||||
{
|
||||
throw error("Failed to read raw device calibration from recording!");
|
||||
}
|
||||
|
||||
return calibration;
|
||||
}
|
||||
|
||||
/** Get the camera calibration for the K4A device that made the recording, which is used for all transformation
|
||||
* functions. Throws error on failure.
|
||||
*
|
||||
* \sa k4a_playback_get_calibration
|
||||
*/
|
||||
calibration get_calibration() const
|
||||
{
|
||||
calibration calib;
|
||||
k4a_result_t result = k4a_playback_get_calibration(m_handle, &calib);
|
||||
|
||||
if (K4A_RESULT_SUCCEEDED != result)
|
||||
{
|
||||
throw error("Failed to read device calibration from recording!");
|
||||
}
|
||||
|
||||
return calib;
|
||||
}
|
||||
|
||||
/** Gets the configuration of the recording
|
||||
*
|
||||
* \sa k4a_playback_get_record_configuration
|
||||
*/
|
||||
k4a_record_configuration_t get_record_configuration() const
|
||||
{
|
||||
k4a_record_configuration_t config;
|
||||
k4a_result_t result = k4a_playback_get_record_configuration(m_handle, &config);
|
||||
|
||||
if (K4A_RESULT_SUCCEEDED != result)
|
||||
{
|
||||
throw error("Failed to read record configuration!");
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
/** Get the next capture in the recording
|
||||
* Returns true if a capture was available, false if there are none left
|
||||
* Throws error on failure.
|
||||
*
|
||||
* \sa k4a_playback_get_next_capture
|
||||
*/
|
||||
bool get_next_capture(capture *cap)
|
||||
{
|
||||
k4a_capture_t capture_handle;
|
||||
k4a_stream_result_t result = k4a_playback_get_next_capture(m_handle, &capture_handle);
|
||||
|
||||
if (K4A_STREAM_RESULT_SUCCEEDED == result)
|
||||
{
|
||||
*cap = capture(capture_handle);
|
||||
return true;
|
||||
}
|
||||
else if (K4A_STREAM_RESULT_EOF == result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
throw error("Failed to get next capture!");
|
||||
}
|
||||
|
||||
/** Get the next capture in the recording
|
||||
* Returns true if a capture was available, false if there are none left
|
||||
* Throws error on failure.
|
||||
*
|
||||
* \sa k4a_playback_get_previous_capture
|
||||
*/
|
||||
bool get_previous_capture(capture *cap)
|
||||
{
|
||||
k4a_capture_t capture_handle;
|
||||
k4a_stream_result_t result = k4a_playback_get_previous_capture(m_handle, &capture_handle);
|
||||
|
||||
if (K4A_STREAM_RESULT_SUCCEEDED == result)
|
||||
{
|
||||
*cap = capture(capture_handle);
|
||||
return true;
|
||||
}
|
||||
else if (K4A_STREAM_RESULT_EOF == result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
throw error("Failed to get next capture!");
|
||||
}
|
||||
|
||||
/** Reads the value of a tag from the recording
|
||||
* Returns false if the tag does not exist.
|
||||
*
|
||||
* \sa k4a_playback_get_tag
|
||||
*/
|
||||
bool get_tag(const char *name, std::string *out) const
|
||||
{
|
||||
std::string tag;
|
||||
size_t buffer = 0;
|
||||
k4a_buffer_result_t result = k4a_playback_get_tag(m_handle, name, &tag[0], &buffer);
|
||||
|
||||
if (result == K4A_BUFFER_RESULT_TOO_SMALL && buffer > 0)
|
||||
{
|
||||
tag.resize(buffer);
|
||||
result = k4a_playback_get_tag(m_handle, name, &tag[0], &buffer);
|
||||
if (result == K4A_BUFFER_RESULT_SUCCEEDED && tag[buffer - 1] == 0)
|
||||
{
|
||||
// std::string expects there to not be as null terminator at the end of its data but
|
||||
// k4a_playback_get_tag adds a null terminator, so we drop the last character of the string after we
|
||||
// get the result back.
|
||||
tag.resize(buffer - 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (result != K4A_BUFFER_RESULT_SUCCEEDED)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
*out = std::move(tag);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Get the next IMU sample in the recording
|
||||
* Returns true if a sample was available, false if there are none left
|
||||
* Throws error on failure.
|
||||
*
|
||||
* \sa k4a_playback_get_next_imu_sample
|
||||
*/
|
||||
bool get_next_imu_sample(k4a_imu_sample_t *sample)
|
||||
{
|
||||
k4a_stream_result_t result = k4a_playback_get_next_imu_sample(m_handle, sample);
|
||||
|
||||
if (K4A_STREAM_RESULT_SUCCEEDED == result)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (K4A_STREAM_RESULT_EOF == result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
throw error("Failed to get next IMU sample!");
|
||||
}
|
||||
|
||||
/** Get the previous IMU sample in the recording
|
||||
* Returns true if a sample was available, false if there are none left
|
||||
* Throws error on failure.
|
||||
*
|
||||
* \sa k4a_playback_get_previous_imu_sample
|
||||
*/
|
||||
bool get_previous_imu_sample(k4a_imu_sample_t *sample)
|
||||
{
|
||||
k4a_stream_result_t result = k4a_playback_get_previous_imu_sample(m_handle, sample);
|
||||
|
||||
if (K4A_STREAM_RESULT_SUCCEEDED == result)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (K4A_STREAM_RESULT_EOF == result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
throw error("Failed to get previous IMU sample!");
|
||||
}
|
||||
|
||||
/** Seeks to a specific time point in the recording
|
||||
* Throws error on failure.
|
||||
*
|
||||
* \sa k4a_playback_seek_timestamp
|
||||
*/
|
||||
void seek_timestamp(std::chrono::microseconds offset, k4a_playback_seek_origin_t origin)
|
||||
{
|
||||
k4a_result_t result = k4a_playback_seek_timestamp(m_handle, offset.count(), origin);
|
||||
|
||||
if (K4A_RESULT_SUCCEEDED != result)
|
||||
{
|
||||
throw error("Failed to seek recording!");
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the last valid timestamp in the recording
|
||||
*
|
||||
* \sa k4a_playback_get_recording_length_usec
|
||||
*/
|
||||
std::chrono::microseconds get_recording_length() const noexcept
|
||||
{
|
||||
return std::chrono::microseconds(k4a_playback_get_recording_length_usec(m_handle));
|
||||
}
|
||||
|
||||
/** Set the image format that color captures will be converted to. By default the conversion format will be the same
|
||||
* as the image format stored in the recording file, and no conversion will occur.
|
||||
*
|
||||
* Throws error on failure.
|
||||
*
|
||||
* \sa k4a_playback_set_color_conversion
|
||||
*/
|
||||
void set_color_conversion(k4a_image_format_t format)
|
||||
{
|
||||
k4a_result_t result = k4a_playback_set_color_conversion(m_handle, format);
|
||||
|
||||
if (K4A_RESULT_SUCCEEDED != result)
|
||||
{
|
||||
throw error("Failed to set color conversion!");
|
||||
}
|
||||
}
|
||||
|
||||
/** Opens a K4A recording for playback.
|
||||
* Throws error on failure.
|
||||
*
|
||||
* \sa k4a_playback_open
|
||||
*/
|
||||
static playback open(const char *path)
|
||||
{
|
||||
k4a_playback_t handle = nullptr;
|
||||
k4a_result_t result = k4a_playback_open(path, &handle);
|
||||
|
||||
if (K4A_RESULT_SUCCEEDED != result)
|
||||
{
|
||||
throw error("Failed to open recording!");
|
||||
}
|
||||
|
||||
return playback(handle);
|
||||
}
|
||||
|
||||
private:
|
||||
k4a_playback_t m_handle;
|
||||
};
|
||||
|
||||
} // namespace k4a
|
||||
|
||||
#endif
|
||||
+473
@@ -0,0 +1,473 @@
|
||||
/** \file record.h
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
* Kinect For Azure Recording SDK.
|
||||
*/
|
||||
|
||||
#ifndef K4A_RECORD_H
|
||||
#define K4A_RECORD_H
|
||||
|
||||
#include <k4arecord/types.h>
|
||||
#include <k4arecord/k4arecord_export.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
*
|
||||
* \addtogroup Functions
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Opens a new recording file for writing.
|
||||
*
|
||||
* \param path
|
||||
* Filesystem path for the new recording.
|
||||
*
|
||||
* \param device
|
||||
* The Azure Kinect device that is being recorded. The device handle is used to store device calibration and serial
|
||||
* number information. May be NULL if recording user-generated data.
|
||||
*
|
||||
* \param device_config
|
||||
* The configuration the Azure Kinect device was started with.
|
||||
*
|
||||
* \param recording_handle
|
||||
* If successful, this contains a pointer to the new recording handle. Caller must call k4a_record_close()
|
||||
* when finished with recording.
|
||||
*
|
||||
* \remarks
|
||||
* The file will be created if it doesn't exist, or overwritten if an existing file is specified.
|
||||
*
|
||||
* \remarks
|
||||
* Streaming does not need to be started on the device at the time this function is called, but when it is started
|
||||
* it should be started with the same configuration provided in \p device_config.
|
||||
*
|
||||
* \remarks
|
||||
* Subsequent calls to k4a_record_write_capture() will need to have images in the resolution and format defined
|
||||
* in \p device_config.
|
||||
*
|
||||
* \headerfile record.h <k4arecord/record.h>
|
||||
*
|
||||
* \returns ::K4A_RESULT_SUCCEEDED is returned on success
|
||||
*
|
||||
* \relates k4a_record_t
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">record.h (include k4arecord/record.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_record_create(const char *path,
|
||||
k4a_device_t device,
|
||||
const k4a_device_configuration_t device_config,
|
||||
k4a_record_t *recording_handle);
|
||||
|
||||
/** Adds a tag to the recording.
|
||||
*
|
||||
* \param recording_handle
|
||||
* The handle of a new recording, obtained by k4a_record_create().
|
||||
*
|
||||
* \param name
|
||||
* The name of the tag to write.
|
||||
*
|
||||
* \param value
|
||||
* The string value to store in the tag.
|
||||
*
|
||||
* \headerfile record.h <k4arecord/record.h>
|
||||
*
|
||||
* \relates k4a_record_t
|
||||
*
|
||||
* \returns ::K4A_RESULT_SUCCEEDED is returned on success.
|
||||
*
|
||||
* \remarks
|
||||
* Tags are global to a file, and should store data related to the entire recording, such as camera configuration or
|
||||
* recording location.
|
||||
*
|
||||
* \remarks
|
||||
* Tag names must be ALL CAPS and may only contain A-Z, 0-9, '-' and '_'.
|
||||
*
|
||||
* \remarks
|
||||
* All tags need to be added before the recording header is written.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">record.h (include k4arecord/record.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_record_add_tag(k4a_record_t recording_handle, const char *name, const char *value);
|
||||
|
||||
/** Adds the track header for recording IMU.
|
||||
*
|
||||
* \param recording_handle
|
||||
* The handle of a new recording, obtained by k4a_record_create().
|
||||
*
|
||||
* \headerfile record.h <k4arecord/record.h>
|
||||
*
|
||||
* \relates k4a_record_t
|
||||
*
|
||||
* \returns ::K4A_RESULT_SUCCEEDED is returned on success
|
||||
*
|
||||
* \remarks
|
||||
* The track needs to be added before the recording header is written.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">record.h (include k4arecord/record.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_record_add_imu_track(k4a_record_t recording_handle);
|
||||
|
||||
/** Adds an attachment to the recording.
|
||||
*
|
||||
* \param recording_handle
|
||||
* The handle of a new recording, obtained by k4a_record_create().
|
||||
*
|
||||
* \param attachment_name
|
||||
* The name of the attachment to be stored in the recording file. This name should be a valid filename with an
|
||||
* extension.
|
||||
*
|
||||
* \param buffer
|
||||
* The attachment data buffer.
|
||||
*
|
||||
* \param buffer_size
|
||||
* The size of the attachment data buffer.
|
||||
*
|
||||
* \headerfile record.h <k4arecord/record.h>
|
||||
*
|
||||
* \relates k4a_record_t
|
||||
*
|
||||
* \returns ::K4A_RESULT_SUCCEEDED is returned on success
|
||||
*
|
||||
* \remarks
|
||||
* All attachments need to be added before the recording header is written.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">record.h (include k4arecord/record.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_record_add_attachment(const k4a_record_t recording_handle,
|
||||
const char *attachment_name,
|
||||
const uint8_t *buffer,
|
||||
size_t buffer_size);
|
||||
|
||||
/** Adds custom video tracks to the recording.
|
||||
*
|
||||
* \param recording_handle
|
||||
* The handle of a new recording, obtained by k4a_record_create().
|
||||
*
|
||||
* \param track_name
|
||||
* The name of the custom video track to be added.
|
||||
*
|
||||
* \param codec_id
|
||||
* A UTF8 null terminated string containing the codec ID of the track. Some of the existing formats are listed here:
|
||||
* https://www.matroska.org/technical/specs/codecid/index.html. The codec ID can also be custom defined by the user.
|
||||
* Video codec ID's should start with 'V_'.
|
||||
*
|
||||
* \param codec_context
|
||||
* The codec context is a codec-specific buffer that contains any required codec metadata that is only known to the
|
||||
* codec. It is mapped to the matroska 'CodecPrivate' element.
|
||||
*
|
||||
* \param codec_context_size
|
||||
* The size of the codec context buffer.
|
||||
*
|
||||
* \param track_settings
|
||||
* Additional metadata for the video track such as resolution and framerate.
|
||||
*
|
||||
* \headerfile record.h <k4arecord/record.h>
|
||||
*
|
||||
* \relates k4a_record_t
|
||||
*
|
||||
* \returns ::K4A_RESULT_SUCCEEDED is returned on success
|
||||
*
|
||||
* \remarks
|
||||
* Built-in video tracks like the DEPTH, IR, and COLOR tracks will be created automatically when the k4a_record_create()
|
||||
* API is called. This API can be used to add additional video tracks to save custom data.
|
||||
*
|
||||
* \remarks
|
||||
* Track names must be ALL CAPS and may only contain A-Z, 0-9, '-' and '_'.
|
||||
*
|
||||
* \remarks
|
||||
* All tracks need to be added before the recording header is written.
|
||||
*
|
||||
* \remarks
|
||||
* Call k4a_record_write_custom_track_data() with the same track_name to write data to this track.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">record.h (include k4arecord/record.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_record_add_custom_video_track(const k4a_record_t recording_handle,
|
||||
const char *track_name,
|
||||
const char *codec_id,
|
||||
const uint8_t *codec_context,
|
||||
size_t codec_context_size,
|
||||
const k4a_record_video_settings_t *track_settings);
|
||||
|
||||
/** Adds custom subtitle tracks to the recording.
|
||||
*
|
||||
* \param recording_handle
|
||||
* The handle of a new recording, obtained by k4a_record_create().
|
||||
*
|
||||
* \param track_name
|
||||
* The name of the custom subtitle track to be added.
|
||||
*
|
||||
* \param codec_id
|
||||
* A UTF8 null terminated string containing the codec ID of the track. Some of the existing formats are listed here:
|
||||
* https://www.matroska.org/technical/specs/codecid/index.html. The codec ID can also be custom defined by the user.
|
||||
* Subtitle codec ID's should start with 'S_'.
|
||||
*
|
||||
* \param codec_context
|
||||
* The codec context is a codec-specific buffer that contains any required codec metadata that is only known to the
|
||||
* codec. It is mapped to the matroska 'CodecPrivate' element.
|
||||
*
|
||||
* \param codec_context_size
|
||||
* The size of the codec context buffer.
|
||||
*
|
||||
* \param track_settings
|
||||
* Additional metadata for the subtitle track. If NULL, the default settings will be used.
|
||||
*
|
||||
* \headerfile record.h <k4arecord/record.h>
|
||||
*
|
||||
* \relates k4a_record_t
|
||||
*
|
||||
* \returns ::K4A_RESULT_SUCCEEDED is returned on success
|
||||
*
|
||||
* \remarks
|
||||
* Built-in subtitle tracks like the IMU track will be created automatically when the k4a_record_add_imu_track() API is
|
||||
* called. This API can be used to add additional subtitle tracks to save custom data.
|
||||
*
|
||||
* \remarks
|
||||
* Track names must be ALL CAPS and may only contain A-Z, 0-9, '-' and '_'.
|
||||
*
|
||||
* \remarks
|
||||
* All tracks need to be added before the recording header is written.
|
||||
*
|
||||
* \remarks
|
||||
* Call k4a_record_write_custom_track_data() with the same track_name to write data to this track.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">record.h (include k4arecord/record.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t
|
||||
k4a_record_add_custom_subtitle_track(const k4a_record_t recording_handle,
|
||||
const char *track_name,
|
||||
const char *codec_id,
|
||||
const uint8_t *codec_context,
|
||||
size_t codec_context_size,
|
||||
const k4a_record_subtitle_settings_t *track_settings);
|
||||
|
||||
/** Writes the recording header and metadata to file.
|
||||
*
|
||||
* \param recording_handle
|
||||
* The handle of a new recording, obtained by k4a_record_create().
|
||||
*
|
||||
* \headerfile record.h <k4arecord/record.h>
|
||||
*
|
||||
* \relates k4a_record_t
|
||||
*
|
||||
* \returns ::K4A_RESULT_SUCCEEDED is returned on success
|
||||
*
|
||||
* \remarks
|
||||
* This must be called before captures or any track data can be written.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">record.h (include k4arecord/record.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_record_write_header(k4a_record_t recording_handle);
|
||||
|
||||
/** Writes a camera capture to file.
|
||||
*
|
||||
* \param recording_handle
|
||||
* The handle of a new recording, obtained by k4a_record_create().
|
||||
*
|
||||
* \param capture_handle
|
||||
* The handle of a capture to write to file.
|
||||
*
|
||||
* \headerfile record.h <k4arecord/record.h>
|
||||
*
|
||||
* \relates k4a_record_t
|
||||
*
|
||||
* \returns ::K4A_RESULT_SUCCEEDED is returned on success
|
||||
*
|
||||
* \remarks
|
||||
* Captures must be written in increasing order of timestamp, and the file's header must already be written.
|
||||
*
|
||||
* \remarks
|
||||
* k4a_record_write_capture() will write all images in the capture to the corresponding tracks in the recording file.
|
||||
* If any of the images fail to write, other images will still be written before a failure is returned.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">record.h (include k4arecord/record.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_record_write_capture(k4a_record_t recording_handle, k4a_capture_t capture_handle);
|
||||
|
||||
/** Writes an imu sample to file.
|
||||
*
|
||||
* \param recording_handle
|
||||
* The handle of a new recording, obtained by k4a_record_create().
|
||||
*
|
||||
* \param imu_sample
|
||||
* A structure containing the imu sample data and timestamps.
|
||||
*
|
||||
* \headerfile record.h <k4arecord/record.h>
|
||||
*
|
||||
* \relates k4a_record_t
|
||||
*
|
||||
* \returns ::K4A_RESULT_SUCCEEDED is returned on success
|
||||
*
|
||||
* \remarks
|
||||
* Samples must be written in increasing order of timestamp, and the file's header must already be written.
|
||||
*
|
||||
* \remarks
|
||||
* When writing imu samples at the same time as captures, the samples should be within 1 second of the most recently
|
||||
* written capture.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">record.h (include k4arecord/record.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_record_write_imu_sample(k4a_record_t recording_handle, k4a_imu_sample_t imu_sample);
|
||||
|
||||
/** Writes data for a custom track to file.
|
||||
*
|
||||
* \param recording_handle
|
||||
* The handle of a new recording, obtained by k4a_record_create().
|
||||
*
|
||||
* \param track_name
|
||||
* The name of the custom track that the data is going to be written to.
|
||||
*
|
||||
* \param device_timestamp_usec
|
||||
* The timestamp in microseconds for the custom track data. This timestamp should be in the same time domain as the
|
||||
* device timestamp used for recording.
|
||||
*
|
||||
* \param custom_data
|
||||
* The buffer of custom track data.
|
||||
*
|
||||
* \param custom_data_size
|
||||
* The size of the custom track data buffer.
|
||||
*
|
||||
* \headerfile record.h <k4arecord/record.h>
|
||||
*
|
||||
* \relates k4a_record_t
|
||||
*
|
||||
* \returns ::K4A_RESULT_SUCCEEDED is returned on success
|
||||
*
|
||||
* \remarks
|
||||
* Custom track data must be written in increasing order of timestamp, and the file's header must already be written.
|
||||
* When writing custom track data at the same time as captures or IMU data, the custom data should be within 1 second of
|
||||
* the most recently written timestamp.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">record.h (include k4arecord/record.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_record_write_custom_track_data(const k4a_record_t recording_handle,
|
||||
const char *track_name,
|
||||
uint64_t device_timestamp_usec,
|
||||
uint8_t *custom_data,
|
||||
size_t custom_data_size);
|
||||
|
||||
/** Flushes all pending recording data to disk.
|
||||
*
|
||||
* \param recording_handle
|
||||
* Handle obtained by k4a_record_create().
|
||||
*
|
||||
* \headerfile record.h <k4arecord/record.h>
|
||||
*
|
||||
* \relates k4a_record_t
|
||||
*
|
||||
* \returns ::K4A_RESULT_SUCCEEDED is returned on success, or ::K4A_RESULT_FAILED if an error occurred.
|
||||
*
|
||||
* \remarks
|
||||
* k4a_record_flush() ensures that all data passed to the recording API prior to calling flush is written to disk.
|
||||
* If continuing to write recording data, care must be taken to ensure no new timestamps are added from before the
|
||||
* flush.
|
||||
*
|
||||
* \remarks
|
||||
* If an error occurs, best effort is made to flush as much data to disk as possible, but the integrity of the file is
|
||||
* not guaranteed.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">record.h (include k4arecord/record.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT k4a_result_t k4a_record_flush(k4a_record_t recording_handle);
|
||||
|
||||
/** Closes a recording handle.
|
||||
*
|
||||
* \param recording_handle
|
||||
* Handle obtained by k4a_record_create().
|
||||
*
|
||||
* \headerfile record.h <k4arecord/record.h>
|
||||
*
|
||||
* \relates k4a_record_t
|
||||
*
|
||||
* \remarks
|
||||
* If there is any unwritten data it will be flushed to disk before closing the recording.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">record.h (include k4arecord/record.h)</requirement>
|
||||
* <requirement name="Library">k4arecord.lib</requirement>
|
||||
* <requirement name="DLL">k4arecord.dll</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4ARECORD_EXPORT void k4a_record_close(k4a_record_t recording_handle);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* K4A_RECORD_H */
|
||||
+261
@@ -0,0 +1,261 @@
|
||||
/** \file types.h
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
* Kinect For Azure Playback/Record type definitions.
|
||||
*/
|
||||
|
||||
#ifndef K4ARECORD_TYPES_H
|
||||
#define K4ARECORD_TYPES_H
|
||||
|
||||
#include <k4a/k4atypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup Handles
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \class k4a_record_t types.h <k4arecord/types.h>
|
||||
* Handle to a k4a recording opened for writing.
|
||||
*
|
||||
* \remarks
|
||||
* Handles are created with k4a_record_create(), and closed with k4a_record_close().
|
||||
* Invalid handles are set to 0.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">types.h (include k4arecord/types.h)</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4A_DECLARE_HANDLE(k4a_record_t);
|
||||
|
||||
/** \class k4a_playback_t types.h <k4arecord/types.h>
|
||||
* Handle to a k4a recording opened for playback.
|
||||
*
|
||||
* \remarks
|
||||
* Handles are created with k4a_playback_open(), and closed with k4a_playback_close().
|
||||
* Invalid handles are set to 0.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">types.h (include k4arecord/types.h)</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4A_DECLARE_HANDLE(k4a_playback_t);
|
||||
|
||||
/** \class k4a_playback_data_block_t types.h <k4arecord/types.h>
|
||||
* Handle to a block of data read from a k4a_playback_t custom track.
|
||||
*
|
||||
* \remarks
|
||||
* Handles are obtained from k4a_playback_get_next_data_block() or k4a_playback_get_previous_data_block(), and released
|
||||
* with k4a_playback_data_block_release(). Invalid handles are set to 0.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">types.h (include k4arecord/types.h)</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
K4A_DECLARE_HANDLE(k4a_playback_data_block_t)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
* \addtogroup Definitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Name of the built-in color track used in recordings.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">types.h (include k4arecord/types.h)</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
#define K4A_TRACK_NAME_COLOR "COLOR"
|
||||
|
||||
/** Name of the built-in depth track used in recordings.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">types.h (include k4arecord/types.h)</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
#define K4A_TRACK_NAME_DEPTH "DEPTH"
|
||||
|
||||
/** Name of the built-in IR track used in recordings.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">types.h (include k4arecord/types.h)</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
#define K4A_TRACK_NAME_IR "IR"
|
||||
|
||||
/** Name of the built-in imu track used in recordings.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">types.h (include k4arecord/types.h)</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
#define K4A_TRACK_NAME_IMU "IMU"
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
* \addtogroup Enumerations
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Return codes returned by Azure Kinect playback API.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">types.h (include k4arecord/types.h)</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
K4A_STREAM_RESULT_SUCCEEDED = 0, /**< The result was successful. */
|
||||
K4A_STREAM_RESULT_FAILED, /**< The result was a failure. */
|
||||
K4A_STREAM_RESULT_EOF, /**< The end of the data stream was reached. */
|
||||
} k4a_stream_result_t;
|
||||
|
||||
/** Playback seeking positions.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">types.h (include k4arecord/types.h)</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
K4A_PLAYBACK_SEEK_BEGIN, /**< Seek relative to the beginning of a recording. */
|
||||
K4A_PLAYBACK_SEEK_END, /**< Seek relative to the end of a recording. */
|
||||
K4A_PLAYBACK_SEEK_DEVICE_TIME /**< Seek to an absolute device timestamp. */
|
||||
} k4a_playback_seek_origin_t;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
* \addtogroup Structures
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Structure containing the device configuration used to record.
|
||||
*
|
||||
* \see k4a_device_configuration_t
|
||||
* \see k4a_playback_get_record_configuration()
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">types.h (include k4arecord/types.h)</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
typedef struct _k4a_record_configuration_t
|
||||
{
|
||||
/** Image format used to record the color camera. */
|
||||
k4a_image_format_t color_format;
|
||||
|
||||
/** Image resolution used to record the color camera. */
|
||||
k4a_color_resolution_t color_resolution;
|
||||
|
||||
/** Mode used to record the depth camera. */
|
||||
k4a_depth_mode_t depth_mode;
|
||||
|
||||
/** Frame rate used to record the color and depth camera. */
|
||||
k4a_fps_t camera_fps;
|
||||
|
||||
/** True if the recording contains Color camera frames. */
|
||||
bool color_track_enabled;
|
||||
|
||||
/** True if the recording contains Depth camera frames. */
|
||||
bool depth_track_enabled;
|
||||
|
||||
/** True if the recording contains IR camera frames. */
|
||||
bool ir_track_enabled;
|
||||
|
||||
/** True if the recording contains IMU sample data. */
|
||||
bool imu_track_enabled;
|
||||
|
||||
/**
|
||||
* The delay between color and depth images in the recording.
|
||||
* A negative delay means depth images are first, and a positive delay means color images are first.
|
||||
*/
|
||||
int32_t depth_delay_off_color_usec;
|
||||
|
||||
/** External synchronization mode */
|
||||
k4a_wired_sync_mode_t wired_sync_mode;
|
||||
|
||||
/**
|
||||
* The delay between this recording and the externally synced master camera.
|
||||
* This value is 0 unless \p wired_sync_mode is set to ::K4A_WIRED_SYNC_MODE_SUBORDINATE
|
||||
*/
|
||||
uint32_t subordinate_delay_off_master_usec;
|
||||
|
||||
/**
|
||||
* The timestamp offset of the start of the recording. All recorded timestamps are offset by this value such that
|
||||
* the recording starts at timestamp 0. This value can be used to synchronize timestamps between 2 recording files.
|
||||
*/
|
||||
uint32_t start_timestamp_offset_usec;
|
||||
} k4a_record_configuration_t;
|
||||
|
||||
/** Structure containing additional metadata specific to custom video tracks.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">types.h (include k4arecord/types.h)</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
typedef struct _k4a_record_video_settings_t
|
||||
{
|
||||
uint64_t width; /**< Frame width of the video */
|
||||
uint64_t height; /**< Frame height of the video */
|
||||
uint64_t frame_rate; /**< Frame rate (frames-per-second) of the video */
|
||||
} k4a_record_video_settings_t;
|
||||
|
||||
/** Structure containing additional metadata specific to custom subtitle tracks.
|
||||
*
|
||||
* \xmlonly
|
||||
* <requirements>
|
||||
* <requirement name="Header">types.h (include k4arecord/types.h)</requirement>
|
||||
* </requirements>
|
||||
* \endxmlonly
|
||||
*/
|
||||
typedef struct _k4a_record_subtitle_settings_t
|
||||
{
|
||||
/**
|
||||
* If true, data will be grouped together in batches to reduce overhead. In this mode, only a single timestamp will
|
||||
* be stored per batch, and an estimated timestamp will be used by k4a_playback_seek_timestamp() and
|
||||
* k4a_playback_data_block_get_timestamp_usec(). The estimated timestamp is calculated with the assumption that
|
||||
* blocks are evenly spaced within a batch. If precise timestamps are required, the timestamp should be added to
|
||||
* each data block itself.
|
||||
*
|
||||
* If false, data will be stored as individual blocks with full timestamp information (Default).
|
||||
*/
|
||||
bool high_freq_data;
|
||||
} k4a_record_subtitle_settings_t;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* K4ARECORD_TYPES_H */
|
||||
Reference in New Issue
Block a user