FLAC: Add appendOnly option for FlaxMuxer, fix FlacDemuxer reading it (#325)

* implement in FlacOutputFormatOptions

* implement in flac-muxer.ts

* Fix demuxer: Handle minimumFrameSize = 0, maxiumFrameSize = 0

* add a test

* Update flac-demuxer.ts

* Update flac.test.ts

* clean up comments for minima and maxima

* Add FlacOutputFormatOptions.appendOnly to docs

---------

Co-authored-by: Vanilagy <[email protected]>
This commit is contained in:
Jonny Burger
2026-03-19 13:43:28 +00:00
committed by GitHub
co-authored by Vanilagy
parent 0d50526ff6
commit 31d86331ec
5 changed files with 146 additions and 40 deletions
+10
View File
@@ -928,6 +928,13 @@ export class AdtsOutputFormat extends OutputFormat {
* @public
*/
export type FlacOutputFormatOptions = {
/**
* Configures the output to only append new data at the end, useful for live-streaming the file as it's being
* created. When enabled, the STREAMINFO block will not be finalized with accurate min/max block sizes, frame sizes,
* or total sample count, so don't use this option when you want to write out a clean file for later use.
*/
appendOnly?: boolean;
/**
* Will be called for each FLAC frame that is written.
*
@@ -951,6 +958,9 @@ export class FlacOutputFormat extends OutputFormat {
if (!options || typeof options !== 'object') {
throw new TypeError('options must be an object.');
}
if (options.appendOnly !== undefined && typeof options.appendOnly !== 'boolean') {
throw new TypeError('options.appendOnly, when provided, must be a boolean.');
}
super();