7 #ifndef K4A_PLAYBACK_HPP 8 #define K4A_PLAYBACK_HPP 10 #include <k4a/k4a.hpp> 11 #include <k4arecord/playback.h> 42 other.m_handle =
nullptr;
61 m_handle = other.m_handle;
62 other.m_handle =
nullptr;
70 operator bool() const noexcept
72 return m_handle !=
nullptr;
81 if (m_handle !=
nullptr)
83 k4a_playback_close(m_handle);
97 k4a_buffer_result_t result = k4a_playback_get_raw_calibration(m_handle, &calibration[0], &buffer);
101 calibration.resize(buffer);
102 result = k4a_playback_get_raw_calibration(m_handle, &calibration[0], &buffer);
107 throw error(
"Failed to read raw device calibration from recording!");
121 k4a_result_t result = k4a_playback_get_calibration(m_handle, &calib);
125 throw error(
"Failed to read device calibration from recording!");
138 k4a_result_t result = k4a_playback_get_record_configuration(m_handle, &config);
142 throw error(
"Failed to read record configuration!");
161 *cap =
capture(capture_handle);
169 throw error(
"Failed to get next capture!");
185 *cap =
capture(capture_handle);
193 throw error(
"Failed to get next capture!");
201 bool get_tag(
const char *name, std::string *out)
const 210 result = k4a_playback_get_tag(m_handle, name, &tag[0], &buffer);
216 tag.resize(buffer - 1);
225 *out = std::move(tag);
249 throw error(
"Failed to get next IMU sample!");
271 throw error(
"Failed to get previous IMU sample!");
281 k4a_result_t result = k4a_playback_seek_timestamp(m_handle, offset.count(), origin);
285 throw error(
"Failed to seek recording!");
295 return std::chrono::microseconds(k4a_playback_get_last_timestamp_usec(m_handle));
307 k4a_result_t result = k4a_playback_set_color_conversion(m_handle, format);
311 throw error(
"Failed to set color conversion!");
327 throw error(
"Failed to open recording!");
The result was successful.
Definition: k4atypes.h:233
The result was successful.
Definition: types.h:68
playback(k4a_playback_t handle=nullptr) noexcept
Creates a k4a::playback from a k4a_playback_t Takes ownership of the handle, i.e. ...
Definition: playback.hpp:36
std::chrono::microseconds get_last_timestamp() const noexcept
Get the last valid timestamp in the recording.
Definition: playback.hpp:293
k4a_result_t
Result code returned by Azure Kinect APIs.
Definition: k4atypes.h:217
Exception type thrown when a K4A API call fails.
Definition: k4a.hpp:33
playback & operator=(playback &&other) noexcept
Moves another k4a::playback into this k4a::playback; other is set to invalid.
Definition: playback.hpp:56
Handle to an Azure Kinect capture.
Definition: k4atypes.h:122
k4a_buffer_result_t
Result code returned by Azure Kinect APIs.
Definition: k4atypes.h:231
void seek_timestamp(std::chrono::microseconds offset, k4a_playback_seek_origin_t origin)
Seeks to a specific time point in the recording Throws error on failure.
Definition: playback.hpp:279
k4a_stream_result_t
Return codes returned by Azure Kinect playback API.
Definition: types.h:66
bool get_next_imu_sample(k4a_imu_sample_t *sample)
Get the next IMU sample in the recording Returns true if a sample was available, false if there are n...
Definition: playback.hpp:236
IMU sample.
Definition: k4atypes.h:1157
static playback open(const char *path)
Opens a K4A recording for playback.
Definition: playback.hpp:320
calibration get_calibration() const
Get the camera calibration for the K4A device that made the recording, which is used for all transfor...
Definition: playback.hpp:118
std::vector< uint8_t > get_raw_calibration() const
Get the raw calibration blob for the K4A device that made the recording.
Definition: playback.hpp:93
k4a_record_configuration_t get_record_configuration() const
Gets the configuration of the recording.
Definition: playback.hpp:135
void close() noexcept
Closes a K4A recording.
Definition: playback.hpp:79
playback(playback &&other) noexcept
Moves another k4a::playback into a new k4a::playback.
Definition: playback.hpp:40
bool get_next_capture(capture *cap)
Get the next capture in the recording Returns true if a capture was available, false if there are non...
Definition: playback.hpp:154
Wrapper for k4a_capture_t.
Definition: k4a.hpp:402
bool get_previous_imu_sample(k4a_imu_sample_t *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.
Definition: playback.hpp:258
k4a_playback_seek_origin_t
Playback seeking positions.
Definition: types.h:81
Structure containing the device configuration used to record.
Definition: types.h:105
The result was successful.
Definition: k4atypes.h:219
Handle to a k4a recording opened for playback.
Definition: types.h:49
void set_color_conversion(k4a_image_format_t format)
Set the image format that color captures will be converted to.
Definition: playback.hpp:305
The input buffer was too small.
Definition: k4atypes.h:235
bool get_previous_capture(capture *cap)
Get the next capture in the recording Returns true if a capture was available, false if there are non...
Definition: playback.hpp:178
Wrapper for k4a_playback_t.
Definition: playback.hpp:28
Wrapper for k4a_calibration_t.
Definition: k4a.hpp:614
bool get_tag(const char *name, std::string *out) const
Reads the value of a tag from the recording Returns false if the tag does not exist.
Definition: playback.hpp:201
The end of the data stream was reached.
Definition: types.h:70
k4a_image_format_t
Image format type.
Definition: k4atypes.h:332