Distinguish between M4{A,B,P} formats.

Note: Removes tag.AAC.
This commit is contained in:
David Howden
2016-02-22 21:01:12 +11:00
parent 5b94194b29
commit a35ac09042
3 changed files with 37 additions and 17 deletions
+14 -2
View File
@@ -26,8 +26,20 @@ func Identify(r io.ReadSeeker) (format Format, fileType FileType, err error) {
case string(b[0:4]) == "OggS":
return VORBIS, OGG, nil
case string(b[4:11]) == "ftypM4A":
return AAC, MP4, nil
case string(b[4:8]) == "ftyp":
b = b[8:11]
fileType = UnknownFileType
switch string(b) {
case "M4A":
fileType = M4A
case "M4B":
fileType = M4B
case "M4P":
fileType = M4P
}
return MP4, fileType, nil
case string(b[0:3]) == "ID3":
b := b[3:]