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

◆ save_spatial_snapshot()

MAYAFLUX_API bool MayaFlux::IO::save_spatial_snapshot ( const std::string &  path_pattern,
const std::vector< SpatialCaptureSource > &  sources 
)

Open a fresh SpatialCache, write every source once, then close it.

Splices a millisecond timestamp into path_pattern the same way save_mesh_snapshot does, so repeated calls never collide. A single time sample rather than a recording: useful for an ad hoc "what does this look like right now" export.

Returns
False if the cache fails to open or any source's capture_frame() call fails.

Definition at line 219 of file SpatialTransfer.cpp.

222{
223 if (sources.empty()) {
224 MF_ERROR(Journal::Component::IO, Journal::Context::FileIO,
225 "save_spatial_snapshot: no sources");
226 return false;
227 }
228
229 const auto now_ms = std::chrono::duration_cast<std::chrono::milliseconds>(
230 std::chrono::system_clock::now().time_since_epoch())
231 .count();
232 const auto path = resolve_sequence_path(path_pattern, static_cast<uint64_t>(now_ms));
233
234 SpatialCache cache;
235 if (!cache.open(path)) {
236 MF_ERROR(Journal::Component::IO, Journal::Context::FileIO,
237 "save_spatial_snapshot: failed to open '{}': {}", path, cache.get_last_error());
238 return false;
239 }
240
241 const bool ok = run_sources(cache, sources);
242 cache.close();
243 return ok;
244}
#define MF_ERROR(comp, ctx,...)

References MayaFlux::IO::SpatialCache::close(), MayaFlux::Journal::FileIO, MayaFlux::IO::SpatialCache::get_last_error(), MayaFlux::Journal::IO, MF_ERROR, MayaFlux::IO::SpatialCache::open(), and resolve_sequence_path().

Referenced by MayaFlux::IO::Detail::execute_spatial_snapshot().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: