Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions filetype/types/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,25 @@ def __init__(self):
)

def match(self, buf):
return (len(buf) > 2 and
((buf[0] == 0x49 and
buf[1] == 0x44 and
buf[2] == 0x33) or
(buf[0] == 0xFF and
buf[1] == 0xF2) or
(buf[0] == 0xFF and
buf[1] == 0xF3) or
(buf[0] == 0xFF and
buf[1] == 0xFB)))
if len(buf) > 2:
if (
buf[0] == 0x49 and
buf[1] == 0x44 and
buf[2] == 0x33
):
return True

if buf[0] == 0xFF:
if (
buf[1] == 0xE2 or # MPEG 2.5 with error protection
buf[1] == 0xE3 or # MPEG 2.5 w/o error protection
buf[1] == 0xF2 or # MPEG 2 with error protection
buf[1] == 0xF3 or # MPEG 2 w/o error protection
buf[1] == 0xFA or # MPEG 1 with error protection
buf[1] == 0xFB # MPEG 1 w/o error protection
):
return True
return False


class M4a(Type):
Expand Down