126 IOManager(
Core::GlobalStreamInfo& stream_info, uint32_t frame_rate,
const std::shared_ptr<Buffers::BufferManager>& buffer_manager,
const std::shared_ptr<Vruta::TaskScheduler>& scheduler);
184 [[nodiscard]] std::shared_ptr<Kakshya::VideoFileContainer> load_video(
const std::string& filepath);
220 [[nodiscard]] std::shared_ptr<Buffers::VideoContainerBuffer>
221 hook_video_container_to_buffer(
222 const std::shared_ptr<Kakshya::VideoStreamContainer>& container);
233 [[nodiscard]] std::shared_ptr<Buffers::VideoContainerBuffer>
235 const std::shared_ptr<Kakshya::VideoStreamContainer>& container)
const;
252 [[nodiscard]] std::shared_ptr<Kakshya::SoundFileContainer> load_audio(
const std::string& filepath,
VideoLoadConfig config = {});
267 [[nodiscard]] std::shared_ptr<Kakshya::DynamicSoundStream> load_audio_bounded(
268 const std::string& filepath,
269 uint64_t max_frames = 0,
270 bool truncate =
false);
289 [[nodiscard]] std::shared_ptr<SoundFileWriter>
290 create_writer(
const std::string& filepath,
292 uint32_t sample_rate = 48000,
293 AVCodecID codec_id = AV_CODEC_ID_NONE);
306 void write(
const std::shared_ptr<Kakshya::SoundStreamContainer>& container,
307 const std::string& filepath,
308 AVCodecID codec_id = AV_CODEC_ID_NONE);
324 [[nodiscard]] uint32_t capture_output(
const std::string& filepath,
325 AVCodecID codec_id = AV_CODEC_ID_NONE);
335 void stop_audio_capture(uint32_t capture_id);
350 [[nodiscard]] std::vector<std::shared_ptr<Buffers::SoundContainerBuffer>>
351 hook_audio_container_to_buffers(
352 const std::shared_ptr<Kakshya::SoundFileContainer>& container);
363 [[nodiscard]] std::vector<std::shared_ptr<Buffers::SoundContainerBuffer>>
365 const std::shared_ptr<Kakshya::SoundFileContainer>& container)
const;
372 [[nodiscard]] std::shared_ptr<Kakshya::SoundFileContainer>
373 get_extracted_audio(
const std::shared_ptr<Kakshya::VideoFileContainer>& container)
const;
400 [[nodiscard]] std::shared_ptr<Kakshya::CameraContainer>
417 [[nodiscard]] std::shared_ptr<Buffers::VideoContainerBuffer>
418 hook_camera_to_buffer(
const std::shared_ptr<Kakshya::CameraContainer>& container);
427 [[nodiscard]] std::shared_ptr<Buffers::VideoContainerBuffer>
428 get_camera_buffer(
const std::shared_ptr<Kakshya::CameraContainer>& container)
const;
446 [[nodiscard]] uint64_t register_camera_source(std::shared_ptr<CameraSource> source);
455 void release_camera_source(uint64_t reader_id);
473 [[nodiscard]] uint64_t register_video_reader(std::shared_ptr<VideoFileReader> reader);
484 void release_video_reader(uint64_t reader_id);
505 [[nodiscard]] std::shared_ptr<VideoFileWriter>
506 create_writer(
const std::string& filepath,
510 AVPixelFormat src_pixel_format,
511 AVCodecID codec_id = AV_CODEC_ID_NONE);
529 [[nodiscard]] uint32_t capture_window(
530 const std::shared_ptr<Core::Window>&
window,
531 const std::string& filepath,
533 AVCodecID codec_id = AV_CODEC_ID_NONE);
544 void stop_video_capture(uint32_t capture_id);
555 void stop_capture(
const std::shared_ptr<Core::Window>&
window);
560 [[nodiscard]] std::vector<uint32_t> get_video_capture_ids()
const;
565 [[nodiscard]] std::vector<std::shared_ptr<VideoFileWriter>> get_video_writers()
const;
583 [[nodiscard]] std::shared_ptr<Buffers::TextureBuffer>
584 load_image(
const std::string& filepath,
int desired_channels = 4,
585 std::optional<Kakshya::Region> region = std::nullopt);
599 [[nodiscard]] std::shared_ptr<CompositeReader>
600 open_composite_reader(
601 const std::string& filepath,
602 std::optional<Kakshya::CompositeLayout> layout = std::nullopt);
615 [[nodiscard]] std::shared_ptr<Kakshya::CompositeContainer>
617 const std::string& filepath,
618 std::optional<Kakshya::CompositeLayout> layout = std::nullopt,
619 size_t batch_size = 1);
633 [[nodiscard]] std::shared_ptr<CompositeWriter>
634 open_composite_writer(
635 const std::string& filepath,
651 const std::shared_ptr<Kakshya::CompositeContainer>& container,
652 const std::string& filepath);
673 [[nodiscard]] std::vector<std::shared_ptr<Buffers::MeshBuffer>>
675 const std::string& filepath,
689 [[nodiscard]] std::shared_ptr<Nodes::Network::MeshNetwork>
691 const std::string& filepath,
714 const std::shared_ptr<Buffers::MeshBuffer>& mesh_buffer,
715 const std::string& filepath,
726 const std::vector<Kakshya::MeshData>& meshes,
727 const std::string& filepath,
745 const std::shared_ptr<Nodes::Network::MeshNetwork>&
network,
746 const std::string& filepath,
747 const IO::ModelWriteOptions& options = {});
764 const std::shared_ptr<Buffers::ComputeMeshBuffer>&
buffer,
765 const std::string& filepath,
766 const IO::ModelWriteOptions& options = {});
778 const std::shared_ptr<Buffers::ComputeMeshBuffer>&
buffer,
779 const std::string& path_pattern,
780 const IO::ModelWriteOptions& options = {});
805 const std::shared_ptr<Core::VKImage>&
image,
806 const std::string& filepath,
807 const IO::ImageWriteOptions& options = {});
810 const std::shared_ptr<Buffers::TextureBuffer>&
buffer,
811 const std::string& filepath,
812 const IO::ImageWriteOptions& options = {});
815 const std::shared_ptr<Buffers::TextBuffer>&
buffer,
816 const std::string& filepath,
817 const IO::ImageWriteOptions& options = {});
828 const std::string& filepath,
829 const IO::ImageWriteOptions& options = {});
837 void wait_for_pending_saves();
868 [[nodiscard]] std::shared_ptr<Buffers::VolumeGridBuffer>
870 const std::string& filepath,
871 const IO::VolumeReadOptions& options = {});
876 [[nodiscard]] std::vector<std::shared_ptr<Buffers::VolumeGridBuffer>>
899 const std::string& filepath,
919 const std::shared_ptr<Buffers::VolumeGridBuffer>& volume,
920 const std::string& filepath,
922 const std::vector<std::string>& field_names = {});
949 [[nodiscard]] uint32_t capture_volume(
950 const std::shared_ptr<Buffers::VolumeGridBuffer>& volume,
951 const std::string& path_pattern,
952 const std::vector<std::string>& field_names = {},
953 const IO::VolumeWriteOptions& options = {},
954 uint32_t max_frames = 0,
955 uint64_t frame_interval = 1);
963 void stop_volume_capture(uint32_t capture_id);
968 [[nodiscard]] std::vector<uint32_t> get_volume_capture_ids()
const;
999 [[nodiscard]] uint32_t capture_spatial(
1000 const std::string& filepath,
1001 std::vector<IO::SpatialCaptureSource> sources,
1002 uint32_t max_frames = 0,
1003 uint64_t frame_interval = 1);
1012 void stop_spatial_capture(uint32_t capture_id);
1017 [[nodiscard]] std::vector<uint32_t> get_spatial_capture_ids()
const;
1032 std::vector<IO::SpatialCaptureSource> sources,
1033 const std::string& path_pattern);
1038 [[nodiscard]] std::vector<uint64_t> get_video_reader_ids()
const;
1043 [[nodiscard]] std::shared_ptr<VideoFileReader> get_video_reader(uint64_t
id)
const;
1048 [[nodiscard]] std::vector<uint64_t> get_camera_reader_ids()
const;
1053 [[nodiscard]] std::shared_ptr<CameraSource> get_camera_reader(uint64_t
id)
const;
1058 [[nodiscard]] std::vector<std::shared_ptr<SoundFileReader>>
get_audio_readers()
const {
return m_audio_readers; };
1063 [[nodiscard]] std::vector<std::shared_ptr<ImageReader>>
get_image_readers()
const {
return m_image_readers; };
1068 [[nodiscard]] std::vector<std::shared_ptr<ModelReader>>
get_model_readers()
const {
return m_model_readers; };
1073 [[nodiscard]] std::vector<uint32_t> get_audio_capture_ids()
const;
1078 [[nodiscard]] std::vector<std::shared_ptr<SoundFileWriter>>
get_sound_writers()
const {
return m_writers; };
1084 std::atomic<bool> m_stop_done {
false };
1085 std::atomic<bool> m_shutdown_done {
false };
1091 void dispatch_decode_request(uint64_t reader_id);
1097 void dispatch_frame_request(uint64_t reader_id);
1113 void track_save_task(std::future<bool> fut);
1115 void configure_frame_processor(
1116 const std::shared_ptr<Kakshya::VideoFileContainer>& container)
const;
1118 void configure_audio_processor(
1119 const std::shared_ptr<Kakshya::SoundFileContainer>& container)
const;
1126 uint32_t observer_id {};
1136 uint32_t capture_id {};
1141 std::atomic<uint32_t> m_next_video_capture_id { 1 };
1147 std::atomic<uint32_t> m_next_volume_capture_id { 1 };
1159 std::atomic<uint32_t> m_next_spatial_capture_id { 1 };
1167 std::atomic<uint64_t> m_next_reader_id { 1 };
1188 std::shared_ptr<Kakshya::VideoStreamContainer>,
1189 std::shared_ptr<Buffers::VideoContainerBuffer>>
1193 std::shared_ptr<Kakshya::CameraContainer>,
1194 std::shared_ptr<Buffers::VideoContainerBuffer>>
1198 std::shared_ptr<Kakshya::VideoFileContainer>,
1199 std::shared_ptr<Kakshya::SoundFileContainer>>
1203 std::shared_ptr<Kakshya::SoundFileContainer>,
1204 std::vector<std::shared_ptr<Buffers::SoundContainerBuffer>>>