diff --git a/internal/matchers/audio.go b/internal/matchers/audio.go index 32f7440..b1d6736 100644 --- a/internal/matchers/audio.go +++ b/internal/matchers/audio.go @@ -57,3 +57,13 @@ func Au(in []byte) bool { func Amr(in []byte) bool { return len(in) > 5 && bytes.Equal(in[:5], []byte("\x23\x21\x41\x4D\x52")) } + +// Aac matches an Advanced Audio Coding file. +func Aac(in []byte) bool { + return bytes.HasPrefix(in, []byte{0xFF, 0xF1}) || bytes.HasPrefix(in, []byte{0xFF, 0xF9}) +} + +// Voc matches a Creative Voice file. +func Voc(in []byte) bool { + return bytes.HasPrefix(in, []byte("Creative Voice File")) +} diff --git a/mime_test.go b/mime_test.go index 2afc7fd..a01a6c7 100644 --- a/mime_test.go +++ b/mime_test.go @@ -84,6 +84,8 @@ var files = map[string]*node{ "ogg.ogg": ogg, "amr.amr": amr, "mpc.mpc": musePack, + "aac.aac": aac, + "voc.voc": voc, "m4a.m4a": m4a, "m4b.m4b": aMp4, diff --git a/supported_mimes.md b/supported_mimes.md index e6b4b3f..c10dc84 100644 --- a/supported_mimes.md +++ b/supported_mimes.md @@ -1,4 +1,4 @@ -## 110 Supported MIME types +## 112 Supported MIME types This file is automatically generated when running tests. Do not edit manually. Extension | MIME type @@ -66,6 +66,8 @@ Extension | MIME type **flv** | video/x-flv **mkv** | video/x-matroska **asf** | video/x-ms-asf +**aac** | audio/aac +**voc** | audio/x-unknown **mp4** | audio/mp4 **m4a** | audio/x-m4a **txt** | text/plain diff --git a/testdata/aac.aac b/testdata/aac.aac new file mode 100644 index 0000000..0502be6 Binary files /dev/null and b/testdata/aac.aac differ diff --git a/testdata/voc.voc b/testdata/voc.voc new file mode 100644 index 0000000..0c02993 Binary files /dev/null and b/testdata/voc.voc differ diff --git a/tree.go b/tree.go index d86e741..c623c3f 100644 --- a/tree.go +++ b/tree.go @@ -9,8 +9,8 @@ var root = newNode("application/octet-stream", "", matchers.True, sevenZ, zip, pdf, xls, ppt, doc, ps, psd, ogg, png, jpg, gif, webp, exe, elf, ar, tar, xar, bz2, fits, tiff, bmp, ico, mp3, flac, midi, ape, musePack, amr, wav, aiff, au, mpeg, quickTime, mqv, mp4, webM, threeGP, threeG2, avi, flv, - mkv, asf, aMp4, m4a, txt, gzip, class, swf, crx, woff, woff2, wasm, shx, dbf, - dcm, rar, djvu, mobi, lit, bpg, sqlite3, dwg, + mkv, asf, aac, voc, aMp4, m4a, txt, gzip, class, swf, crx, woff, woff2, wasm, + shx, dbf, dcm, rar, djvu, mobi, lit, bpg, sqlite3, dwg, ) // The list of nodes appended to the root node @@ -78,6 +78,8 @@ var ( aiff = newNode("audio/aiff", "aiff", matchers.Aiff) au = newNode("audio/basic", "au", matchers.Au) amr = newNode("audio/amr", "amr", matchers.Amr) + aac = newNode("audio/aac", "aac", matchers.Aac) + voc = newNode("audio/x-unknown", "voc", matchers.Voc) aMp4 = newNode("audio/mp4", "mp4", matchers.AMp4) m4a = newNode("audio/x-m4a", "m4a", matchers.M4a) mp4 = newNode("video/mp4", "mp4", matchers.Mp4)