MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::IO::IOManager Class Reference

Optional orchestration layer for IO reader lifetime and IOService dispatch. More...

#include <IOManager.hpp>

+ Collaboration diagram for MayaFlux::IO::IOManager:

Public Member Functions

std::vector< std::shared_ptr< Buffers::SoundContainerBuffer > > get_audio_buffers (const std::shared_ptr< Kakshya::SoundFileContainer > &container) const
 Retrieve the SoundContainerBuffers created for a container.
 
std::shared_ptr< Buffers::VideoContainerBufferget_camera_buffer (const std::shared_ptr< Kakshya::CameraContainer > &container) const
 Retrieve the VideoContainerBuffer created for a camera container.
 
std::shared_ptr< Kakshya::SoundFileContainerget_extracted_audio (const std::shared_ptr< Kakshya::VideoFileContainer > &container) const
 Retrieve the SoundFileContainer extracted from a video file.
 
std::shared_ptr< Buffers::VideoContainerBufferget_video_buffer (const std::shared_ptr< Kakshya::VideoFileContainer > &container) const
 Retrieve the VideoContainerBuffer created for a container.
 
std::vector< std::shared_ptr< Buffers::SoundContainerBuffer > > hook_audio_container_to_buffers (const std::shared_ptr< Kakshya::SoundFileContainer > &container)
 Wire a SoundFileContainer to the audio buffer system.
 
std::shared_ptr< Buffers::VideoContainerBufferhook_camera_to_buffer (const std::shared_ptr< Kakshya::CameraContainer > &container)
 Wire a CameraContainer to the graphics buffer system.
 
std::shared_ptr< Buffers::VideoContainerBufferhook_video_container_to_buffer (const std::shared_ptr< Kakshya::VideoFileContainer > &container)
 Wire a VideoFileContainer to the graphics buffer system.
 
 IOManager (const IOManager &)=delete
 
 IOManager (IOManager &&)=delete
 
 IOManager (uint64_t sample_rate, uint32_t buffer_size, uint32_t frame_rate, const std::shared_ptr< Buffers::BufferManager > &buffer_manager)
 Construct IOManager and register the IOService into BackendRegistry.
 
std::shared_ptr< Kakshya::SoundFileContainerload_audio (const std::string &filepath, LoadConfig config={})
 Load an audio file into a SoundFileContainer.
 
std::shared_ptr< Kakshya::DynamicSoundStreamload_audio_bounded (const std::string &filepath, uint64_t max_frames=0, bool truncate=false)
 Load an audio file into a fully resident, size-bounded DynamicSoundStream.
 
std::shared_ptr< Buffers::TextureBufferload_image (const std::string &filepath)
 Load an image file into a TextureBuffer.
 
std::vector< std::shared_ptr< Buffers::MeshBuffer > > load_mesh (const std::string &filepath, TextureResolver resolver=nullptr)
 Load all meshes from a 3D model file into MeshBuffer instances.
 
std::shared_ptr< Nodes::Network::MeshNetworkload_mesh_network (const std::string &filepath, TextureResolver resolver=nullptr)
 Load a 3D model file as a MeshNetwork.
 
std::shared_ptr< Kakshya::VideoFileContainerload_video (const std::string &filepath)
 Load a video file into a VideoFileContainer.
 
VideoLoadResult load_video (const std::string &filepath, LoadConfig config)
 Load a video file into a VideoFileContainer.
 
std::shared_ptr< Kakshya::CameraContaineropen_camera (const CameraConfig &config)
 Open a camera device and create a CameraContainer.
 
IOManageroperator= (const IOManager &)=delete
 
IOManageroperator= (IOManager &&)=delete
 
uint64_t register_video_reader (std::shared_ptr< VideoFileReader > reader)
 Assign a globally unique reader_id and take ownership of a reader.
 
void release_video_reader (uint64_t reader_id)
 Release ownership of the reader identified by reader_id.
 
bool save_image (const std::shared_ptr< Buffers::TextBuffer > &buffer, const std::string &filepath, const IO::ImageWriteOptions &options={})
 
bool save_image (const std::shared_ptr< Buffers::TextureBuffer > &buffer, const std::string &filepath, const IO::ImageWriteOptions &options={})
 
bool save_image (const std::shared_ptr< Core::VKImage > &image, const std::string &filepath, const IO::ImageWriteOptions &options={})
 Save image data to disk asynchronously.
 
bool save_image (IO::ImageData data, const std::string &filepath, const IO::ImageWriteOptions &options={})
 Save an already-downloaded ImageData to disk asynchronously.
 
void wait_for_pending_saves ()
 Wait for all in-flight save operations to complete.
 
 ~IOManager ()
 Unregisters IOService, releases all owned readers, clears stored buffers.
 

Private Member Functions

void configure_audio_processor (const std::shared_ptr< Kakshya::SoundFileContainer > &container)
 
void configure_frame_processor (const std::shared_ptr< Kakshya::VideoFileContainer > &container)
 
void dispatch_decode_request (uint64_t reader_id)
 IOService::request_decode target — shared-lock lookup + signal_decode().
 
void dispatch_frame_request (uint64_t reader_id)
 IOService::request_frame target — shared-lock lookup + pull_frame_all().
 

Private Attributes

std::unordered_map< std::shared_ptr< Kakshya::SoundFileContainer >, std::vector< std::shared_ptr< Buffers::SoundContainerBuffer > > > m_audio_buffers
 
std::vector< std::shared_ptr< SoundFileReader > > m_audio_readers
 
std::shared_ptr< Buffers::BufferManagerm_buffer_manager
 
uint32_t m_buffer_size
 
std::shared_mutex m_buffers_mutex
 
std::unordered_map< std::shared_ptr< Kakshya::CameraContainer >, std::shared_ptr< Buffers::VideoContainerBuffer > > m_camera_buffers
 
std::shared_mutex m_camera_mutex
 
std::unordered_map< uint64_t, std::shared_ptr< CameraReader > > m_camera_readers
 
std::unordered_map< std::shared_ptr< Kakshya::VideoFileContainer >, std::shared_ptr< Kakshya::SoundFileContainer > > m_extracted_audio
 
uint32_t m_frame_rate
 
std::vector< std::shared_ptr< ImageReader > > m_image_readers
 
std::shared_ptr< Registry::Service::IOServicem_io_service
 
std::vector< std::shared_ptr< ModelReader > > m_model_readers
 
std::atomic< uint64_t > m_next_reader_id { 1 }
 
std::shared_mutex m_readers_mutex
 
uint64_t m_sample_rate
 
std::vector< std::future< bool > > m_save_tasks
 
std::mutex m_save_tasks_mutex
 
std::unordered_map< std::shared_ptr< Kakshya::VideoFileContainer >, std::shared_ptr< Buffers::VideoContainerBuffer > > m_video_buffers
 
std::unordered_map< uint64_t, std::shared_ptr< VideoFileReader > > m_video_readers
 

Detailed Description

Optional orchestration layer for IO reader lifetime and IOService dispatch.

MayaFlux IO readers are fully self-sufficient — VideoFileReader, SoundFileReader, and ImageReader can all be used standalone without this class. IOManager exists to solve problems that only arise at scale:

  • Globally unique reader_ids across concurrent VideoFileReader instances, so IOService::request_decode routes to the correct decode thread.
  • A single IOService registration backed by a keyed dispatch map, rather than each reader overwriting the previous registration.
  • Shared ownership of VideoFileReader instances whose background decode thread must outlive the scope in which they were created.
  • High-level load/hook functions that collapse the full open→load→processor setup→buffer wiring sequence into single calls, mirroring what Depot does for audio and eliminating the boilerplate currently required for video.

VideoFileReader detects the IOService registration generically via BackendRegistry and skips its own registration — no IOManager-specific knowledge in the reader.

Levels of integration (all valid):

  1. VideoFileReader standalone, single stream — self-registers, self-ids.
  2. IOManager constructed directly — multi-stream safe, no Engine required.
  3. Engine constructs IOManager in Init() — fully orchestrated, zero user wiring.

Definition at line 91 of file IOManager.hpp.


The documentation for this class was generated from the following files: