Commit 66c76d8
feat: Ogg Vorbis / Ogg Opus / FLAC decode, capture SOURCE Ogg headers
Transcoder and AutoDJ now handle any of MP3, Ogg Vorbis, Ogg Opus or
native FLAC as input instead of only MP3. A new OpenDecoder factory
sniffs the first bytes (ID3/MP3 sync, OggS with OpusHead/vorbis, fLaC)
and returns a PCMDecoder producing interleaved S16LE stereo PCM. This
replaces the direct mp3.NewDecoder calls in relay/transcode.go and
relay/streamer.go. Output encoding still targets MP3 (shine) or Opus
(kazzmir opus-go) — AAC is intentionally not included because no
pure-Go encoder is viable.
validateAudioFile now accepts OggS and fLaC magic bytes so AutoDJ will
play .ogg/.opus/.flac files from disk.
Fix BOS/Tags handling on the Icecast SOURCE handler: the code captures
the initial Ogg pages (those with granule_position == 0 or the
continuation sentinel) as bytes flow in, then stores them on the
Stream as OggHead / OggHeaderOffset. Late-joining listeners get the
full codec setup prepended instead of "Codec not found". Triggered by
Content-Type of application/ogg or audio/ogg (plus variants).
New deps: github.com/jfreymuth/oggvorbis, github.com/mewkiz/flac. Both
pure Go, no CGO required.
Added relay/decode_test.go covering the Ogg page walker and the
decoder sniff.1 parent cc26bbd commit 66c76d8
8 files changed
Lines changed: 577 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
52 | 59 | | |
53 | 60 | | |
54 | 61 | | |
| |||
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
60 | 73 | | |
61 | 74 | | |
62 | 75 | | |
| |||
0 commit comments