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

◆ stop_spatial_capture()

void MayaFlux::IO::IOManager::stop_spatial_capture ( uint32_t  capture_id)

Stop a running spatial capture and release it.

Frames already written are kept. The underlying archive stays open and registered under its filepath as long as any other capture still shares it. No-op with a warning if the id is unknown.

Definition at line 1464 of file IOManager.cpp.

1465{
1466 std::unique_ptr<IO::SpatialCapture> capture;
1467 std::shared_ptr<IO::SpatialCache> cache_to_close;
1468 {
1469 std::lock_guard lock(m_spatial_captures_mutex);
1470 auto it = m_spatial_captures.find(capture_id);
1471 if (it == m_spatial_captures.end()) {
1473 "stop_spatial_capture: unknown capture_id={}", capture_id);
1474 return;
1475 }
1476 capture = std::move(it->second.capture);
1477 const std::string filepath = std::move(it->second.filepath);
1478 m_spatial_captures.erase(it);
1479
1480 auto ref_it = m_spatial_cache_refcounts.find(filepath);
1481 if (ref_it != m_spatial_cache_refcounts.end() && --ref_it->second <= 0) {
1482 m_spatial_cache_refcounts.erase(ref_it);
1483 auto cache_it = m_spatial_caches.find(filepath);
1484 if (cache_it != m_spatial_caches.end()) {
1485 cache_to_close = cache_it->second;
1486 m_spatial_caches.erase(cache_it);
1487 }
1488 }
1489 }
1490
1491 capture.reset();
1492 if (cache_to_close) {
1493 cache_to_close->close();
1494 }
1495}
#define MF_WARN(comp, ctx,...)
std::unordered_map< uint32_t, SpatialCaptureEntry > m_spatial_captures
std::unordered_map< std::string, int > m_spatial_cache_refcounts
Closes+erases a cache at zero.
std::mutex m_spatial_captures_mutex
std::unordered_map< std::string, std::shared_ptr< IO::SpatialCache > > m_spatial_caches
@ FileIO
Filesystem I/O operations.
@ IO
Networking, file handling, streaming.

References MayaFlux::Journal::FileIO, MayaFlux::Journal::IO, m_spatial_cache_refcounts, m_spatial_caches, m_spatial_captures, m_spatial_captures_mutex, and MF_WARN.

Referenced by stop().

+ Here is the caller graph for this function: