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

◆ write()

void MayaFlux::IO::IOManager::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.

Opens a writer, posts the container's full data, closes, and stores the encode future in m_save_tasks. Non-blocking; returns immediately. Container metadata (sample_rate, channels) drives the encoder parameters.

Parameters
containerSource container; any SoundStreamContainer child.
filepathOutput file path.
codec_idEncoder override; AV_CODEC_ID_NONE = container default.

Definition at line 507 of file IOManager.cpp.

510{
511 if (!container) {
513 "write: null container");
514 return;
515 }
516
517 auto writer = std::make_shared<SoundFileWriter>();
518 if (!writer->open(filepath,
519 container->get_num_channels(),
520 container->get_sample_rate(),
521 codec_id)) {
523 "write: open failed for '{}': {}", filepath, writer->last_error());
524 return;
525 }
526
527 writer->write(container->get_data());
528 track_save_task(writer->close());
529}
#define MF_ERROR(comp, ctx,...)
void track_save_task(std::future< bool > fut)
Retain a save task in m_save_tasks and opportunistically reclaim finished ones.
@ FileIO
Filesystem I/O operations.
@ IO
Networking, file handling, streaming.

References MayaFlux::Journal::FileIO, MayaFlux::Journal::IO, MF_ERROR, and track_save_task().

+ Here is the call graph for this function: