Spawn the capture routine, resetting the frame counter.
97{
100 "SpatialCapture: cannot start, null cache");
101 return;
102 }
103
106 "SpatialCapture: cannot start, no sources");
107 return;
108 }
109
111
112 m_state = std::make_shared<CaptureState>();
115 m_state->max_frames = max_frames;
116 m_state->recording.store(
true, std::memory_order_release);
117
119 + std::to_string(g_next_spatial_capture_id.fetch_add(1, std::memory_order_relaxed));
120
121 auto routine = [](Vruta::TaskScheduler&,
122 std::shared_ptr<CaptureState> state,
123 uint64_t interval) -> Vruta::GraphicsRoutine {
125 while (!p.should_terminate
126 && !state->stop_requested.load(std::memory_order_acquire)
128 co_await Kriya::FrameDelay { .frames_to_wait = interval };
129 }
130 state->recording.store(false, std::memory_order_release);
131 };
132
134 std::make_shared<Vruta::GraphicsRoutine>(
137
139 "SpatialCapture: recording {} stream(s) every {} frame(s), {}",
141 max_frames == 0 ? std::string("unbounded")
142 :
std::format(
"{} frames", max_frames));
143}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
std::shared_ptr< SpatialCache > m_cache
std::vector< SpatialCaptureSource > m_sources
static bool run_one_frame(CaptureState &state)
One tick: write every source's stream.
std::shared_ptr< CaptureState > m_state
Vruta::TaskScheduler & m_scheduler
void stop()
Request the capture routine stop.
void add_task(const std::shared_ptr< Routine > &routine, const std::string &name="", bool initialize=false)
Add a routine to the scheduler based on its processing token.
@ FileIO
Filesystem I/O operations.
@ IO
Networking, file handling, streaming.
GetPromiseBase< Vruta::graphics_promise > GetGraphicsPromise
Graphics domain promise accessor.