TOOLS/matroska.py: support outputting to file

Like the previous commit, it's better to just output it to a file for
meson.
This commit is contained in:
Dudemanguy 2021-10-16 23:55:03 -05:00
parent f7fab994eb
commit 94950b1b22
1 changed files with 7 additions and 2 deletions

View File

@ -459,10 +459,15 @@ if __name__ == "__main__":
def parse_toplevel(s):
parse_one(s, 0, None, 1 << 63)
if len(sys.argv) < 3:
outfile = sys.stdout
else:
outfile = open(sys.argv[2], "w")
if sys.argv[1] == '--generate-header':
generate_C_header(sys.stdout)
generate_C_header(outfile)
elif sys.argv[1] == '--generate-definitions':
generate_C_definitions(sys.stdout)
generate_C_definitions(outfile)
else:
s = open(sys.argv[1], "rb")
while 1: