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

◆ save_spatial_snapshot()

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 218 of file SpatialTransfer.cpp.

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

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