MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ start()

void MayaFlux::IO::VolumeCapture::start ( uint32_t  max_frames = 0,
uint64_t  frame_interval = 1 
)

Spawn the capture routine, resetting the frame counter.

Parameters
max_framesStop after this many frames. Zero records until stop(), which at tens of megabytes per frame fills a disk given time.
frame_intervalFrames between captures. One records every frame; higher values thin the sequence, which is usually what a large lattice wants.

Definition at line 287 of file VolumeTransfer.cpp.

288{
289 if (!m_volume) {
291 "VolumeCapture: cannot start, null volume");
292 return;
293 }
294
295 stop();
296
297 m_frame = 0;
298 m_max_frames = max_frames;
299 m_recording = true;
300 m_task_name = "volume_capture_"
301 + std::to_string(g_next_capture_id.fetch_add(1, std::memory_order_relaxed));
302
303 auto routine = [](Vruta::TaskScheduler&,
304 VolumeCapture* capture,
305 uint64_t interval) -> Vruta::GraphicsRoutine {
306 auto& p = co_await Kriya::GetGraphicsPromise {};
307 while (!p.should_terminate && capture->capture_frame()) {
308 co_await Kriya::FrameDelay { .frames_to_wait = interval };
309 }
310 capture->m_recording = false;
311 };
312
314 std::make_shared<Vruta::GraphicsRoutine>(
315 routine(m_scheduler, this, frame_interval)),
316 m_task_name, false);
317
319 "VolumeCapture: recording '{}' every {} frame(s), {}",
320 m_pattern, frame_interval,
321 max_frames == 0 ? std::string("unbounded")
322 : std::format("{} frames", max_frames));
323}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
VolumeCapture(Vruta::TaskScheduler &scheduler, std::shared_ptr< Buffers::VolumeGridBuffer > volume, std::string path_pattern, std::vector< std::string > field_names={}, VolumeWriteOptions options={}, VolumeWriteHook write=nullptr)
std::shared_ptr< Buffers::VolumeGridBuffer > m_volume
Vruta::TaskScheduler & m_scheduler
void stop()
Cancel the capture routine.
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.
Definition Scheduler.cpp:23
@ FileIO
Filesystem I/O operations.
@ IO
Networking, file handling, streaming.
GetPromiseBase< Vruta::graphics_promise > GetGraphicsPromise
Graphics domain promise accessor.

References MayaFlux::Vruta::TaskScheduler::add_task(), MayaFlux::Journal::FileIO, MayaFlux::Kriya::FrameDelay::frames_to_wait, MayaFlux::Journal::IO, m_frame, m_max_frames, m_pattern, m_recording, m_scheduler, m_task_name, m_volume, MF_ERROR, MF_INFO, and stop().

+ Here is the call graph for this function: