Skip to content

feat(riff): add RF64/BW64 format support#447

Open
tphakala wants to merge 1 commit intopdeljanov:dev-0.6from
tphakala:feature/rf64-support-v2
Open

feat(riff): add RF64/BW64 format support#447
tphakala wants to merge 1 commit intopdeljanov:dev-0.6from
tphakala:feature/rf64-support-v2

Conversation

@tphakala
Copy link

Summary

Adds RF64/BW64 format support to the WAV demuxer, enabling playback of audio files exceeding the 4GB RIFF size limit.

  • DS64 chunk parser — parses 64-bit sizes (riff_size, data_size, sample_count) and table entries per EBU Tech 3306
  • RF64 detection — recognizes RF64 stream marker alongside standard RIFF
  • 64-bit size handling — uses ds64 values only when the 32-bit sentinel (0xFFFFFFFF) is present, per spec
  • Probe/scoring — adds RF64 probe descriptor and accepts RF64 marker in format scoring
  • Overflow safety — validated ds64 table bounds, checked arithmetic for data position calculations
  • Tests — ds64 parsing unit tests + RF64 integration tests (small files, >4GB metadata, fallback, ds64-in-standard-WAV ignored, malformed table rejection)

EBU Tech 3306 compliance

  • DS64 values only override 32-bit fields when those fields are set to -1 (sentinel)
  • DS64 sample_count takes precedence over fact chunk and computed value for RF64 files
  • Table entry count validated against declared chunk size

Context

Fresh rewrite of #425 for dev-0.6 as requested. The original PR targeted master but a mechanical rebase failed due to significant API changes in dev-0.6 (lifetimes on WavReader, FormatInfo/MetadataInfo constants, Track construction, DataChunk.len as Option<u32>, etc).

Test plan

  • cargo check -p symphonia-format-riff (all platforms)
  • cargo test -p symphonia-format-riff (11/11 pass)
  • cargo clippy -p symphonia-format-riff (clean)

Note: Rustfmt CI may fail due to pre-existing formatting issues in aiff/mod.rs and fix_wave_channel_mask on the dev-0.6 branch — unrelated to this change.

Add support for RF64/BW64 audio files, enabling playback of WAV files
exceeding the 4GB RIFF size limit per EBU Tech 3306.

- Add Ds64Chunk parser for 64-bit sizes (riff_size, data_size,
  sample_count) with table entry skipping
- Detect RF64 stream marker alongside standard RIFF in try_new
- Use ds64 values only when 32-bit sentinel (0xFFFFFFFF) is present
- Prefer ds64 sample_count over fact chunk for RF64 files
- Add RF64 probe descriptor and accept RF64 marker in scoring
- Use checked arithmetic for data_start_pos + data_len overflow safety
- Add unit tests for ds64 parsing and RF64 integration tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant