Skip to content

Commit

Permalink
Add AIFF support
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesbraun committed Sep 17, 2021
1 parent 3305bbb commit ae8e500
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ func main() {
- **wav** - `audio/x-wav`
- **amr** - `audio/amr`
- **aac** - `audio/aac`
- **aiff** - `audio/x-aiff`

#### Archive

Expand Down
10 changes: 10 additions & 0 deletions matchers/audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var (
TypeWav = newType("wav", "audio/x-wav")
TypeAmr = newType("amr", "audio/amr")
TypeAac = newType("aac", "audio/aac")
TypeAiff = newType("aiff", "audio/x-aiff")
)

var Audio = Map{
Expand All @@ -20,6 +21,7 @@ var Audio = Map{
TypeWav: Wav,
TypeAmr: Amr,
TypeAac: Aac,
TypeAiff: Aiff,
}

func Midi(buf []byte) bool {
Expand Down Expand Up @@ -73,3 +75,11 @@ func Aac(buf []byte) bool {
((buf[0] == 0xFF && buf[1] == 0xF1) ||
(buf[0] == 0xFF && buf[1] == 0xF9))
}

func Aiff(buf []byte) bool {
return len(buf) > 11 &&
buf[0] == 0x46 && buf[1] == 0x4F &&
buf[2] == 0x52 && buf[3] == 0x4D &&
buf[8] == 0x41 && buf[9] == 0x49 &&
buf[10] == 0x46 && buf[11] == 0x46
}

0 comments on commit ae8e500

Please sign in to comment.