writeKeyframeDeltaBytes function

Uint8List writeKeyframeDeltaBytes(
  1. List<FourdgsSample> samples,
  2. double durationSec, {
  3. FourdgsKeyframeDeltaOptions options = const FourdgsKeyframeDeltaOptions(),
})

Encode samples as a complete keyframe-delta file.

The samples must tile the timeline: sample i covers [t_i, t_{i+1}), the first starts at 0, and the last ends at durationSec (spec ยง11.1). That is the writer's job to satisfy rather than the reader's to tolerate, so a sequence that does not is refused here and named.

Implementation

Uint8List writeKeyframeDeltaBytes(
  List<FourdgsSample> samples,
  double durationSec, {
  FourdgsKeyframeDeltaOptions options = const FourdgsKeyframeDeltaOptions(),
}) {
  final collector = _ByteCollector();
  _writeKeyframeDeltaToSink(collector, samples, durationSec, options: options);
  final bytes = collector.finish();
  if (options.verify) {
    _kdVerify(bytes, samples, options);
  }
  return bytes;
}