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

◆ register_camera_source()

uint64_t MayaFlux::IO::IOManager::register_camera_source ( std::shared_ptr< CameraSource >  source)

Assign a globally unique reader_id and take ownership of a CameraSource that is already open.

The backend-agnostic entry point for camera hosting: any CameraSource implementation, from any backend, is registered identically. open() and configuration are entirely the caller's concern beforehand — this call never touches either.

Parameters
sourceFully-opened CameraSource.
Returns
Globally unique reader_id assigned to this source.

Definition at line 382 of file IOManager.cpp.

383{
384 if (!source) {
386 "IOManager::register_camera_source called with null source");
387 return 0;
388 }
389
390 const uint64_t id = m_next_reader_id.fetch_add(1, std::memory_order_relaxed);
391
392 {
393 std::unique_lock lock(m_camera_mutex);
394 m_camera_readers.emplace(id, std::move(source));
395 }
396
398 "IOManager: registered CameraSource id={}", id);
399
400 return id;
401}
#define MF_WARN(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
std::shared_mutex m_camera_mutex
std::atomic< uint64_t > m_next_reader_id
std::unordered_map< uint64_t, std::shared_ptr< CameraSource > > m_camera_readers
@ FileIO
Filesystem I/O operations.
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, MayaFlux::Journal::FileIO, m_camera_mutex, m_camera_readers, m_next_reader_id, MF_DEBUG, and MF_WARN.

Referenced by open_camera().

+ Here is the caller graph for this function: