|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
Optional orchestration layer for IO reader lifetime and IOService dispatch. More...
#include <IOManager.hpp>
Collaboration diagram for MayaFlux::IO::IOManager:Classes | |
| struct | AudioCaptureState |
| struct | SpatialCaptureEntry |
| struct | VideoCaptureState |
Public Member Functions | |
| uint32_t | capture_output (const std::string &filepath, AVCodecID codec_id=AV_CODEC_ID_NONE) |
| Begin continuous capture of live audio output to a file. | |
| uint32_t | capture_spatial (const std::string &filepath, std::vector< IO::SpatialCaptureSource > sources, uint32_t max_frames=0, uint64_t frame_interval=1) |
| Begin (or join) recording time-sampled streams into an Alembic archive. | |
| uint32_t | capture_volume (const std::shared_ptr< Buffers::VolumeGridBuffer > &volume, const std::string &path_pattern, const std::vector< std::string > &field_names={}, const IO::VolumeWriteOptions &options={}, uint32_t max_frames=0, uint64_t frame_interval=1) |
| Begin recording a numbered .vdb sequence from a volume. | |
| uint32_t | capture_window (const std::shared_ptr< Core::Window > &window, const std::string &filepath, double frame_rate, AVCodecID codec_id=AV_CODEC_ID_NONE) |
| Begin continuous capture of a window's rendered frames to a file. | |
| std::shared_ptr< SoundFileWriter > | create_writer (const std::string &filepath, uint32_t channels, uint32_t sample_rate=48000, AVCodecID codec_id=AV_CODEC_ID_NONE) |
| Construct an open SoundFileWriter the caller drives manually. | |
| std::shared_ptr< VideoFileWriter > | create_writer (const std::string &filepath, uint32_t width, uint32_t height, double frame_rate, AVPixelFormat src_pixel_format, AVCodecID codec_id=AV_CODEC_ID_NONE) |
| Construct an open VideoFileWriter the caller drives manually. | |
| 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::vector< uint32_t > | get_audio_capture_ids () const |
| Returns all active audio capture IDs. | |
| std::vector< std::shared_ptr< SoundFileReader > > | get_audio_readers () const |
| Returns all retained audio readers. | |
| std::shared_ptr< Buffers::VideoContainerBuffer > | get_camera_buffer (const std::shared_ptr< Kakshya::CameraContainer > &container) const |
| Retrieve the VideoContainerBuffer created for a camera container. | |
| std::shared_ptr< CameraSource > | get_camera_reader (uint64_t id) const |
| Returns the camera source assigned to the given ID, or nullptr. | |
| std::vector< uint64_t > | get_camera_reader_ids () const |
| Returns all active camera reader IDs. | |
| std::shared_ptr< Kakshya::SoundFileContainer > | get_extracted_audio (const std::shared_ptr< Kakshya::VideoFileContainer > &container) const |
| Retrieve the SoundFileContainer extracted from a video file. | |
| std::vector< std::shared_ptr< ImageReader > > | get_image_readers () const |
| Returns all retained image readers. | |
| std::vector< std::shared_ptr< Buffers::VolumeGridBuffer > > | get_loaded_volumes () const |
| Returns all VolumeGridBuffers created via load_volume(). | |
| std::vector< std::shared_ptr< ModelReader > > | get_model_readers () const |
| Returns all retained model readers. | |
| std::vector< std::shared_ptr< SoundFileWriter > > | get_sound_writers () const |
| Returns all registered SoundFileWriters created via create_writer() or write(). | |
| std::vector< uint32_t > | get_spatial_capture_ids () const |
| Returns all active spatial capture IDs. | |
| std::shared_ptr< Buffers::VideoContainerBuffer > | get_video_buffer (const std::shared_ptr< Kakshya::VideoStreamContainer > &container) const |
| Retrieve the VideoContainerBuffer created for a container. | |
| std::vector< uint32_t > | get_video_capture_ids () const |
| Returns all active video capture IDs (capture_window()). | |
| std::shared_ptr< VideoFileReader > | get_video_reader (uint64_t id) const |
| Returns the video reader assigned to the given ID, or nullptr. | |
| std::vector< uint64_t > | get_video_reader_ids () const |
| Returns all active video reader IDs. | |
| std::vector< std::shared_ptr< VideoFileWriter > > | get_video_writers () const |
| Returns all VideoFileWriters created via create_writer(). | |
| std::vector< uint32_t > | get_volume_capture_ids () const |
| Returns all active volume capture IDs. | |
| 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::VideoContainerBuffer > | hook_camera_to_buffer (const std::shared_ptr< Kakshya::CameraContainer > &container) |
| Wire a CameraContainer to the graphics buffer system. | |
| std::shared_ptr< Buffers::VideoContainerBuffer > | hook_video_container_to_buffer (const std::shared_ptr< Kakshya::VideoStreamContainer > &container) |
| Wire a video container to the graphics buffer system. | |
| IOManager (const IOManager &)=delete | |
| IOManager (Core::GlobalStreamInfo &stream_info, uint32_t frame_rate, const std::shared_ptr< Buffers::BufferManager > &buffer_manager, const std::shared_ptr< Vruta::TaskScheduler > &scheduler) | |
| Construct IOManager and register the IOService into BackendRegistry. | |
| IOManager (IOManager &&)=delete | |
| std::shared_ptr< Kakshya::SoundFileContainer > | load_audio (const std::string &filepath, VideoLoadConfig config={}) |
| Load an audio file into a SoundFileContainer. | |
| std::shared_ptr< Kakshya::DynamicSoundStream > | load_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< Kakshya::CompositeContainer > | load_composite (const std::string &filepath, std::optional< Kakshya::CompositeLayout > layout=std::nullopt, size_t batch_size=1) |
| Load a complete Composite file into an owning container. | |
| std::shared_ptr< Buffers::TextureBuffer > | load_image (const std::string &filepath, int desired_channels=4, std::optional< Kakshya::Region > region=std::nullopt) |
| 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::MeshNetwork > | load_mesh_network (const std::string &filepath, TextureResolver resolver=nullptr) |
| Load a 3D model file as a MeshNetwork. | |
| std::shared_ptr< Kakshya::VideoFileContainer > | load_video (const std::string &filepath) |
| Load a video file into a VideoFileContainer. | |
| VideoLoadResult | load_video (const std::string &filepath, VideoLoadConfig config) |
| Load a video file into a VideoFileContainer. | |
| std::shared_ptr< Buffers::VolumeGridBuffer > | load_volume (const std::string &filepath, const IO::VolumeReadOptions &options={}) |
| Load a volume file into a newly constructed VolumeGridBuffer. | |
| std::shared_ptr< Kakshya::CameraContainer > | open_camera (const CameraConfig &config) |
| Open an FFmpeg camera device and create a CameraContainer. | |
| std::shared_ptr< CompositeReader > | open_composite_reader (const std::string &filepath, std::optional< Kakshya::CompositeLayout > layout=std::nullopt) |
| Open a schema-bearing reader selected by file format. | |
| std::shared_ptr< CompositeWriter > | open_composite_writer (const std::string &filepath, const Kakshya::CompositeLayout &layout) |
| Open a Composite writer selected by the output file format. | |
| IOManager & | operator= (const IOManager &)=delete |
| IOManager & | operator= (IOManager &&)=delete |
| uint64_t | register_camera_source (std::shared_ptr< CameraSource > source) |
| Assign a globally unique reader_id and take ownership of a CameraSource that is already open. | |
| uint64_t | register_video_reader (std::shared_ptr< VideoFileReader > reader) |
| Assign a globally unique reader_id and take ownership of a reader. | |
| void | release_camera_source (uint64_t reader_id) |
| Release ownership of the camera source identified by reader_id. | |
| void | release_video_reader (uint64_t reader_id) |
| Release ownership of the reader identified by reader_id. | |
| bool | save_composite (const std::shared_ptr< Kakshya::CompositeContainer > &container, const std::string &filepath) |
| Save a complete CompositeContainer in a supported format. | |
| 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. | |
| bool | save_mesh (const std::shared_ptr< Buffers::ComputeMeshBuffer > &buffer, const std::string &filepath, const IO::ModelWriteOptions &options={}) |
| Save a ComputeMeshBuffer's current live geometry to disk asynchronously. | |
| bool | save_mesh (const std::shared_ptr< Buffers::MeshBuffer > &mesh_buffer, const std::string &filepath, const IO::ModelWriteOptions &options={}) |
| Save a MeshBuffer's mesh data to disk asynchronously. | |
| bool | save_mesh (const std::shared_ptr< Nodes::Network::MeshNetwork > &network, const std::string &filepath, const IO::ModelWriteOptions &options={}) |
| Save a MeshNetwork's current slots to disk asynchronously. | |
| bool | save_mesh (const std::vector< Kakshya::MeshData > &meshes, const std::string &filepath, const IO::ModelWriteOptions &options={}) |
| Save one or more meshes to disk asynchronously. | |
| bool | save_mesh_snapshot (const std::shared_ptr< Buffers::ComputeMeshBuffer > &buffer, const std::string &path_pattern, const IO::ModelWriteOptions &options={}) |
| Save a ComputeMeshBuffer with a millisecond epoch timestamp spliced into the path, queued asynchronously. | |
| bool | save_spatial_snapshot (std::vector< IO::SpatialCaptureSource > sources, const std::string &path_pattern) |
| Save every source once, as a single time sample, with a millisecond epoch timestamp spliced into the path, queued asynchronously. | |
| bool | save_volume (const std::shared_ptr< Buffers::VolumeGridBuffer > &volume, const std::string &filepath, const IO::VolumeWriteOptions &options={}, const std::vector< std::string > &field_names={}) |
| Download and save a GPU-resident volume to disk asynchronously. | |
| bool | save_volume (Kakshya::VolumeData data, const std::string &filepath, const IO::VolumeWriteOptions &options={}) |
| Save an already-downloaded VolumeData to disk asynchronously. | |
| void | shutdown () |
| Unregisters IOService and releases readers, writers, buffers and caches. | |
| void | stop () |
| Finalizes all in-flight output while consumers are still running. | |
| void | stop_audio_capture (uint32_t capture_id) |
| Stop a running audio capture and finalise the file. | |
| void | stop_capture (const std::shared_ptr< Core::Window > &window) |
| Stop the active window capture and finalise the file. | |
| void | stop_spatial_capture (uint32_t capture_id) |
| Stop a running spatial capture and release it. | |
| void | stop_video_capture (uint32_t capture_id) |
| Stop a running video capture and finalise the file. | |
| void | stop_volume_capture (uint32_t capture_id) |
| Stop a running volume capture and release it. | |
| void | wait_for_pending_saves () |
| Wait for all in-flight save operations to complete. | |
| void | write (const std::shared_ptr< Kakshya::SoundStreamContainer > &container, const std::string &filepath, AVCodecID codec_id=AV_CODEC_ID_NONE) |
| Write a SoundStreamContainer to file in one shot. | |
| ~IOManager () | |
| Calls shutdown() if it has not already run. | |
Private Member Functions | |
| void | configure_audio_processor (const std::shared_ptr< Kakshya::SoundFileContainer > &container) const |
| void | configure_frame_processor (const std::shared_ptr< Kakshya::VideoFileContainer > &container) const |
| 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(). | |
| void | track_save_task (std::future< bool > fut) |
| Retain a save task in m_save_tasks and opportunistically reclaim finished ones. | |
Private Attributes | |
| Registry::Service::AudioBackendService * | m_audio_backend_service {} |
| std::unordered_map< std::shared_ptr< Kakshya::SoundFileContainer >, std::vector< std::shared_ptr< Buffers::SoundContainerBuffer > > > | m_audio_buffers |
| std::unordered_map< uint32_t, AudioCaptureState > | m_audio_captures |
| std::mutex | m_audio_captures_mutex |
| std::vector< std::shared_ptr< SoundFileReader > > | m_audio_readers |
| std::shared_ptr< Buffers::BufferManager > | m_buffer_manager |
| 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< CameraSource > > | 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::IOService > | m_io_service |
| std::vector< std::shared_ptr< Buffers::VolumeGridBuffer > > | m_loaded_volumes |
| std::vector< std::shared_ptr< ModelReader > > | m_model_readers |
| std::atomic< uint64_t > | m_next_reader_id { 1 } |
| std::atomic< uint32_t > | m_next_spatial_capture_id { 1 } |
| std::atomic< uint32_t > | m_next_video_capture_id { 1 } |
| std::atomic< uint32_t > | m_next_volume_capture_id { 1 } |
| std::shared_mutex | m_readers_mutex |
| Parallel::AsyncGroup< bool > | m_save_tasks |
| std::shared_ptr< Vruta::TaskScheduler > | m_scheduler |
| std::atomic< bool > | m_shutdown_done { false } |
| std::unordered_map< std::string, int > | m_spatial_cache_refcounts |
| Closes+erases a cache at zero. | |
| std::unordered_map< std::string, std::shared_ptr< IO::SpatialCache > > | m_spatial_caches |
| std::unordered_map< uint32_t, SpatialCaptureEntry > | m_spatial_captures |
| std::mutex | m_spatial_captures_mutex |
| std::atomic< bool > | m_stop_done { false } |
| Core::GlobalStreamInfo & | m_stream_info |
| std::unordered_map< std::shared_ptr< Kakshya::VideoStreamContainer >, std::shared_ptr< Buffers::VideoContainerBuffer > > | m_video_buffers |
| std::unordered_map< uint32_t, VideoCaptureState > | m_video_captures |
| std::mutex | m_video_captures_mutex |
| std::unordered_map< uint64_t, std::shared_ptr< VideoFileReader > > | m_video_readers |
| std::vector< std::shared_ptr< VideoFileWriter > > | m_video_writers |
| std::unordered_map< uint32_t, std::unique_ptr< IO::VolumeCapture > > | m_volume_captures |
| std::mutex | m_volume_captures_mutex |
| std::vector< std::shared_ptr< SoundFileWriter > > | m_writers |
| std::mutex | m_writers_mutex |
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:
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):
Definition at line 118 of file IOManager.hpp.