v0.3.0 - Ogg Opus Support & Security Hardening
What's New
Added
Ogg Opus Format Support
OggOpusFileclass for reading and writing Opus audio files- OpusHead identification header parsing (RFC 7845)
- Version, channels, pre-skip, input sample rate, output gain
- Channel mapping family support
- OpusTags (Vorbis Comment) metadata support (no framing bit, per RFC 7845)
- Full read/write round-trip support with atomic file saves
Audio Properties for Opus
AudioProperties.FromOpus()factory method- Duration calculation from granule position (always 48kHz output)
- Pre-skip compensation for accurate duration
MediaFile Factory Updates
MediaFormat.Opusenum value- Automatic Opus vs Vorbis detection by inspecting first Ogg packet
.opusfile extension support
R128 Loudness Convenience Properties
R128TrackGainDbandR128AlbumGainDbproperties onTagbase class- Convert Q7.8 fixed-point integers to/from decibels as doubles
Fixed
RFC 3533 Compliance (Ogg Container)
- Add segment table overflow validation in
OggPageHelper.BuildOggPage - Add bounds check in
FindLastGranulePositionfor truncated pages - Add
BuildMultiPagePackethelper for large metadata spanning multiple pages
RFC 7845 Compliance (Opus Codec)
- Add channel mapping family 1 validation (1-8 channels per §5.1.1.2)
- Existing OpusHead minimum size validation (19 bytes) now tested
R128 Gain Handling
- Fix integer overflow in
R128TrackGainDbandR128AlbumGainDbsetters for extreme values - Add
ClampToQ78helper to safely clamp dB values to Q7.8 format range
Vorbis Validation
- Add validation for invalid
vorbis_versionin identification header (must be 0 per spec) - Return explicit error for Vorbis files with zero sample rate or channel count
Security Hardening
- Add 16 MB max packet size limit in
OggPageHelper.ExtractHeaderPacketsto prevent DoS - Add stream/coupled count validation for Opus mapping families 1 & 255
Changed
- Refactor:
OggVorbisFilenow uses sharedOggPageHelpercode (eliminates ~160 lines of duplicate code) - Test count increased from 1939 to 2077 (+138 tests)
- Code coverage: 89.4% line / 75.8% branch
Full Changelog: https://github.com/decriptor/tagsharp/blob/main/CHANGELOG.md