feat(19-01): implement WAV RIFF parser/writer and writeWavTags

- Add FormatWAV constant and .wav DetectFormat case
- Add FormatWAV dispatch in pipeline WriteTrackTags switch
- Create wav.go with custom RIFF chunk parser/writer
- parseRIFF: lenient read, RF64 rejection, case-insensitive ID3 chunk detection
- writeRIFF: strict write with correct padding and 4GB size check
- writeWavTags: merge existing ID3v2, reuse applyTextChanges/applyCoverArtChanges
- Atomic write via fileutil.AtomicWrite for crash safety
This commit is contained in:
2026-03-19 08:44:38 -04:00
parent 8f4c4a0c2b
commit e6610ff15e
3 changed files with 287 additions and 0 deletions
+4
View File
@@ -36,6 +36,8 @@ const (
FormatMP3 AudioFormat = "mp3"
// FormatFLAC is the FLAC audio format.
FormatFLAC AudioFormat = "flac"
// FormatWAV is the WAV audio format.
FormatWAV AudioFormat = "wav"
)
// errUnsupportedFormat is returned when the audio format is not supported.
@@ -50,6 +52,8 @@ func DetectFormat(filePath string) (AudioFormat, error) {
return FormatMP3, nil
case ".flac":
return FormatFLAC, nil
case ".wav":
return FormatWAV, nil
default:
return "", fmt.Errorf("%w: %s", errUnsupportedFormat, ext)
}