diff --git a/README.md b/README.md index d6a4f9a..a38eebc 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,7 @@ true | audio/x-wav | wav | | audio/amr | amr | | audio/aac | aac | +| audio/aiff | aiff | ### Document diff --git a/lib/matchers.ex b/lib/matchers.ex index 33d8274..0ca684c 100644 --- a/lib/matchers.ex +++ b/lib/matchers.ex @@ -63,6 +63,7 @@ defmodule Infer.Matchers do %Infer.Type{matcher_type: :audio, mime_type: "audio/x-wav", extension: "wav", matcher: &Infer.Audio.is_wav/1}, %Infer.Type{matcher_type: :audio, mime_type: "audio/amr", extension: "amr", matcher: &Infer.Audio.is_amr/1}, %Infer.Type{matcher_type: :audio, mime_type: "audio/aac", extension: "aac", matcher: &Infer.Audio.is_aac/1}, + %Infer.Type{matcher_type: :audio, mime_type: "audio/x-aiff", extension: "aiff", matcher: &Infer.Audio.is_aiff/1}, # Font %Infer.Type{matcher_type: :font, mime_type: "application/font-woff", extension: "woff", matcher: &Infer.Font.is_woff/1}, %Infer.Type{matcher_type: :font, mime_type: "application/font-woff2", extension: "woff2", matcher: &Infer.Font.is_woff2/1}, diff --git a/lib/matchers/audio.ex b/lib/matchers/audio.ex index 677e848..74c5ac9 100644 --- a/lib/matchers/audio.ex +++ b/lib/matchers/audio.ex @@ -67,4 +67,11 @@ defmodule Infer.Audio do @spec is_aac(binary()) :: boolean() def is_aac(<<0xFF, 0xF1, 0xF9, _rest::binary>>), do: true def is_aac(_binary), do: false + + @doc """ + Takes the binary file contents as arguments. Returns `true` if it's an aiff. + """ + @spec is_aiff(binary()) :: boolean() + def is_aiff(<<0x46, 0x4F, 0x52, 0x4D, _data::binary-size(4), 0x41, 0x49, 0x46, 0x46, _rest::binary>>), do: true + def is_aiff(_binary), do: false end