Voyant API 0.2.1
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>
10
13{
14private:
15 void *playbackHandle;
16 double playbackRate;
17 bool looping;
18 uint64_t prevTimestamp;
19 std::chrono::steady_clock::time_point startTime;
20 uint64_t firstFrameTimestamp;
21 bool firstFrame;
22 size_t framesProcessed;
23 size_t loopsCompleted;
24 std::string lastErrorMsg;
25
26 // Pre-allocated frame wrapper and buffer
27 VoyantFrameWrapper currentFrameData;
28 static constexpr size_t BUFFER_SIZE = 4 * 1024 * 1024;
29 uint8_t *frameBuffer;
30
31public:
38 VoyantPlayback(double rate = 1.0, bool loop = false, bool filter_points = false);
39
42
44 VoyantPlayback(const VoyantPlayback &) = delete;
46
50 bool openFile(const std::string &filePath);
51
55 bool nextFrame();
56
61
66
71
76
79 size_t getFramesProcessed() const;
80
83 size_t getLoopsCompleted() const;
84
87 bool isValid() const;
88
91 std::string getLastError() const;
92
93private:
95 void applyTiming(uint64_t currentTimestamp);
96
98 void resetTiming();
99
102 bool parseCurrentFrame();
103
105 void setError(const std::string &message);
106};
Wrapper for VoyantFrame messages.
Definition voyant_frame_wrapper.hpp:19
C++ wrapper for the Voyant playback system with timing capabilities.
Definition voyant_playback.hpp:13
VoyantPlayback(double rate=1.0, bool loop=false, bool filter_points=false)
bool isValid() const
std::string getLastError() const
VoyantPlayback(const VoyantPlayback &)=delete
Non-copyable.
const VoyantFrameWrapper & currentFrame() const
size_t getLoopsCompleted() const
VoyantPlayback & operator=(const VoyantPlayback &)=delete
~VoyantPlayback()
Destructor.
VoyantFrameWrapper & currentFrame()
size_t getFramesProcessed() const
size_t currentFrameIndex()
bool openFile(const std::string &filePath)
uint64_t currentFrameTimestamp()