Voyant API 1.0.0
Loading...
Searching...
No Matches
voyant_playback.hpp
Go to the documentation of this file.
1// Copyright (c) 2024-2025 Voyant Photonics, Inc.
2// All rights reserved.
3
4#pragma once
5
6#include <chrono>
7#include <string>
8#include <voyant_frame.hpp>
10
13{
14private:
17 bool looping;
18 uint64_t prevTimestamp;
19 std::chrono::steady_clock::time_point startTime;
24 std::string lastErrorMsg;
25
26 // Reused across frames so the point vector's capacity carries over
28
29public:
38 VoyantPlayback(double rate = 1.0, bool loop = false, bool keep_invalid_points = false);
39
42
46
53 bool openFile(const std::string& filePath);
54
59 bool nextFrame();
60
64 const VoyantFrame& currentFrame() const;
65
71
76
82
87 std::string apiVersion();
88
91 size_t getFramesProcessed() const;
92
95 size_t getLoopsCompleted() const;
96
99 bool isValid() const;
100
103 std::string getLastError() const;
104
105private:
107 void applyTiming(uint64_t currentTimestamp);
108
111
115
117 void setError(const std::string& message);
118};
A point-cloud frame: points plus the sensor/host state snapshots and frame metadata recorded with the...
Definition voyant_frame.hpp:68
uint64_t firstFrameTimestamp
Definition voyant_playback.hpp:20
bool isValid() const
std::string lastErrorMsg
Definition voyant_playback.hpp:24
void * playbackHandle
Definition voyant_playback.hpp:15
std::chrono::steady_clock::time_point startTime
Definition voyant_playback.hpp:19
std::string getLastError() const
VoyantPlayback(const VoyantPlayback &)=delete
Non-copyable.
std::string apiVersion()
VoyantPlayback(double rate=1.0, bool loop=false, bool keep_invalid_points=false)
double playbackRate
Definition voyant_playback.hpp:16
void setError(const std::string &message)
Sets an error message and invalidates the frame.
size_t framesProcessed
Definition voyant_playback.hpp:22
bool looping
Definition voyant_playback.hpp:17
void applyTiming(uint64_t currentTimestamp)
Applies timing based on the current frame and playback rate.
size_t getLoopsCompleted() const
VoyantPlayback & operator=(const VoyantPlayback &)=delete
~VoyantPlayback()
Destructor.
const VoyantFrame & currentFrame() const
VoyantFrame & currentFrame()
VoyantFrame currentFrameData
Definition voyant_playback.hpp:27
size_t getFramesProcessed() const
size_t currentFrameIndex()
uint64_t prevTimestamp
Definition voyant_playback.hpp:18
void resetTiming()
Resets the timing when starting a new loop.
size_t loopsCompleted
Definition voyant_playback.hpp:23
bool parseCurrentFrame()
bool openFile(const std::string &filePath)
bool firstFrame
Definition voyant_playback.hpp:21
uint64_t currentFrameTimestamp()