File tree Expand file tree Collapse file tree 1 file changed +6
-20
lines changed Expand file tree Collapse file tree 1 file changed +6
-20
lines changed Original file line number Diff line number Diff line change @@ -67,20 +67,9 @@ def __init__(self):
6767 )
6868
6969 def match (self , buf ):
70- return ((len (buf ) > 15 and
71- buf [0 ] == 0x1A and buf [1 ] == 0x45 and
72- buf [2 ] == 0xDF and buf [3 ] == 0xA3 and
73- buf [4 ] == 0x93 and buf [5 ] == 0x42 and
74- buf [6 ] == 0x82 and buf [7 ] == 0x88 and
75- buf [8 ] == 0x6D and buf [9 ] == 0x61 and
76- buf [10 ] == 0x74 and buf [11 ] == 0x72 and
77- buf [12 ] == 0x6F and buf [13 ] == 0x73 and
78- buf [14 ] == 0x6B and buf [15 ] == 0x61 ) or
79- (len (buf ) > 38 and
80- buf [31 ] == 0x6D and buf [32 ] == 0x61 and
81- buf [33 ] == 0x74 and buf [34 ] == 0x72 and
82- buf [35 ] == 0x6f and buf [36 ] == 0x73 and
83- buf [37 ] == 0x6B and buf [38 ] == 0x61 ))
70+ contains_ebml_element = buf .startswith (b'\x1A \x45 \xDF \xA3 ' )
71+ contains_doctype_element = buf .find (b'\x42 \x82 \x88 matroska' ) > - 1
72+ return contains_ebml_element and contains_doctype_element
8473
8574
8675class Webm (Type ):
@@ -97,12 +86,9 @@ def __init__(self):
9786 )
9887
9988 def match (self , buf ):
100- return (len (buf ) > 3 and
101- buf [0 ] == 0x1A and
102- buf [1 ] == 0x45 and
103- buf [2 ] == 0xDF and
104- buf [3 ] == 0xA3 )
105-
89+ contains_ebml_element = buf .startswith (b'\x1A \x45 \xDF \xA3 ' )
90+ contains_doctype_element = buf .find (b'\x42 \x82 \x84 webm' ) > - 1
91+ return contains_ebml_element and contains_doctype_element
10692
10793class Mov (IsoBmff ):
10894 """
You can’t perform that action at this time.
0 commit comments