Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mkv/webm cleanup #191

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
18 changes: 12 additions & 6 deletions filetype/types/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ def __init__(self):
)

def match(self, buf):
contains_ebml_element = buf.startswith(b'\x1A\x45\xDF\xA3')
contains_doctype_element = buf.find(b'\x42\x82\x88matroska') > -1
return contains_ebml_element and contains_doctype_element
if(len(buf) > 5 and
buf[0] == 0x1A and
buf[1] == 0x45 and
buf[2] == 0xDF and
buf[3] == 0xA3):
return buf.find(b"matroska", 5, 64) > -1


class Webm(Type):
Expand All @@ -86,9 +89,12 @@ def __init__(self):
)

def match(self, buf):
contains_ebml_element = buf.startswith(b'\x1A\x45\xDF\xA3')
contains_doctype_element = buf.find(b'\x42\x82\x84webm') > -1
return contains_ebml_element and contains_doctype_element
if(len(buf) > 5 and
buf[0] == 0x1A and
buf[1] == 0x45 and
buf[2] == 0xDF and
buf[3] == 0xA3):
return buf.find(b"webm", 5, 64) > -1


class Mov(IsoBmff):
Expand Down
Loading