writeKeyframeDeltaToSink function

void writeKeyframeDeltaToSink(
  1. Sink<List<int>> sink,
  2. List<FourdgsSample> samples,
  3. double durationSec, {
  4. FourdgsKeyframeDeltaOptions options = const FourdgsKeyframeDeltaOptions(verify: false),
})

Encode samples to sink, one complete framed record at a time.

The sink is borrowed and is not closed. The writer retains the current quantized sample, its reference, and the small Chunk Index, but releases each framed record after Sink.add returns; memory does not grow with the output file. Verification needs to read the completed file back, so this one-way API requires options.verify to be false. Use writeKeyframeDeltaBytes when read-back verification is wanted.

Implementation

void writeKeyframeDeltaToSink(
  Sink<List<int>> sink,
  List<FourdgsSample> samples,
  double durationSec, {
  FourdgsKeyframeDeltaOptions options = const FourdgsKeyframeDeltaOptions(
    verify: false,
  ),
}) {
  if (options.verify) {
    throw const FourdgsInvalidInput(
      'writeKeyframeDeltaToSink cannot verify a one-way sink; pass '
      'FourdgsKeyframeDeltaOptions(verify: false), or use '
      'writeKeyframeDeltaBytes for read-back verification',
    );
  }
  _writeKeyframeDeltaToSink(sink, samples, durationSec, options: options);
}