dosier / dosier/kodio

FLAC decode support (pure Kotlin)

Open
#27 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
37
Forks
2
PR merge metrics
No merged PRs in 30d

Description

## Motivation

FLAC is a common lossless interchange format. Users pick `.flac` files in the sample app and get `UnsupportedFormat` today.

FLAC is a good fit for commonMain: STREAMINFO, frame headers, constant/verbatim/fixed/LPC subframes, Rice residuals. Prior art: Nayuki's MIT Java FLAC decoder.

## Proposed architecture

Add `io/files/flac/` implementing `AudioFileCodec`:

- `matchesMagic`: `fLaC`
- `readMetadata`: STREAMINFO + VorbisComment into `AudioFileMetadata` / `AudioTags`
- `decode`: FLAC to interleaved little-endian PCM `AudioSource`
- `canEncode = false` initially (encode can be a follow-up)

Register in `AudioFileCodecs.all` and add `AudioFileFormat.Flac`.

Optional later: `AudioEncodingInfo.Compressed.Flac` with bits-per-sample and MD5.

## Acceptance criteria

- [ ] `AudioFileFormat.Flac` and `FlacCodec` registered
- [ ] Decode produces PCM `AudioRecording` via `AudioFileReader` / `fromBytes`
- [ ] VorbisComment mapped into `AudioTags` (+ raw)
- [ ] Tests with real FLAC fixtures (commonTest smoke + jvmTest resources)
- [ ] Docs format table updated

## Out of scope

- FLAC encode
- Exotic channel layouts beyond stereo (unless trivial)

## Related

- Audio codec roadmap umbrella issue
- `AudioFileCodec` registry

Contributor guide

Open the contributing guide

Research direction

Start with the AudioFileCodec registry, AudioFileCodecs.all, AudioFileReader/fromBytes, and the proposed io/files/flac/ package. Implement the listed FLAC metadata and decoding scope, then add commonTest smoke coverage with jvmTest resources and update the docs format table; completion is defined by the acceptance criteria and excludes encoding.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
audio-video-rtc
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.