summaryrefslogtreecommitdiffstats
path: root/TOOLS/matroska.py
diff options
context:
space:
mode:
Diffstat (limited to 'TOOLS/matroska.py')
-rwxr-xr-xTOOLS/matroska.py38
1 files changed, 28 insertions, 10 deletions
diff --git a/TOOLS/matroska.py b/TOOLS/matroska.py
index 2b59d2d8c0..6abece6e95 100755
--- a/TOOLS/matroska.py
+++ b/TOOLS/matroska.py
@@ -21,8 +21,6 @@ Can also be used to directly parse Matroska files and display their contents.
# License along with mpv. If not, see <http://www.gnu.org/licenses/>.
#
-# for compatibility with Python 2.x
-from __future__ import print_function
elements_ebml = (
'EBML, 1a45dfa3, sub', (
@@ -94,6 +92,7 @@ elements_matroska = (
'MaxBlockAdditionID, 55ee, uint',
'Name, 536e, str',
'Language, 22b59c, str',
+ 'LanguageBCP47, 22b59d, str',
'CodecID, 86, str',
'CodecPrivate, 63a2, binary',
'CodecName, 258688, str',
@@ -107,6 +106,10 @@ elements_matroska = (
'DisplayWidth, 54b0, uint',
'DisplayHeight, 54ba, uint',
'DisplayUnit, 54b2, uint',
+ 'PixelCropTop, 54bb, uint',
+ 'PixelCropLeft, 54cc, uint',
+ 'PixelCropRight, 54dd, uint',
+ 'PixelCropBottom, 54aa, uint',
'FrameRate, 2383e3, float',
'ColourSpace, 2eb524, binary',
'StereoMode, 53b8, uint',
@@ -137,6 +140,13 @@ elements_matroska = (
'LuminanceMin, 55DA, float',
),
),
+ 'Projection, 7670, sub', (
+ 'ProjectionType, 7671, uint',
+ 'ProjectionPrivate, 7672, binary',
+ 'ProjectionPoseYaw, 7673, float',
+ 'ProjectionPosePitch, 7674, float',
+ 'ProjectionPoseRoll, 7675, float',
+ ),
),
'Audio, e1, sub', (
'SamplingFrequency, b5, float',
@@ -155,6 +165,12 @@ elements_matroska = (
),
),
),
+ 'BlockAdditionMapping*, 41e4, sub', (
+ 'BlockAddIDValue, 41f0, uint',
+ 'BlockAddIDName, 41a4, str',
+ 'BlockAddIDType, 41e7, uint',
+ 'BlockAddIDExtraData, 41ed, binary',
+ ),
),
),
@@ -197,6 +213,7 @@ elements_matroska = (
'ChapterDisplay*, 80, sub', (
'ChapString, 85, str',
'ChapLanguage*, 437c, str',
+ 'ChapLanguageBCP47*, 437d, str',
'ChapCountry*, 437e, str',
),
),
@@ -206,6 +223,7 @@ elements_matroska = (
'Tag*, 7373, sub', (
'Targets, 63c0, sub', (
'TargetTypeValue, 68ca, uint',
+ 'TargetType, 63ca, str',
'TargetTrackUID, 63c5, uint',
'TargetEditionUID, 63c9, uint',
'TargetChapterUID, 63c4, uint',
@@ -214,7 +232,9 @@ elements_matroska = (
'SimpleTag*, 67c8, sub', (
'TagName, 45a3, str',
'TagLanguage, 447a, str',
- 'TagString, 4487, str'
+ 'TagLanguageBCP47, 447b, str',
+ 'TagString, 4487, str',
+ 'TagDefault, 4484, uint',
),
),
),
@@ -267,7 +287,7 @@ class MatroskaElement(object):
def add_subelements(self, subelements):
self.subelements = subelements
- self.subids = set(x[0].elid for x in subelements)
+ self.subids = {x[0].elid for x in subelements}
elementd = {}
elementlist = []
@@ -291,8 +311,8 @@ parse_elems(elements_ebml, 'EBML')
parse_elems(elements_matroska, 'MATROSKA')
def printf(out, *args):
- out.write(u' '.join([str(x) for x in args]))
- out.write(u'\n')
+ out.write(' '.join(str(x) for x in args))
+ out.write('\n')
def generate_C_header(out):
printf(out, '// Generated by TOOLS/matroska.py, do not edit manually')
@@ -453,12 +473,10 @@ if __name__ == "__main__":
parse_one(s, 0, None, 1 << 63)
if sys.argv[1] == '--generate-header':
- generate_C_header(sys.stdout)
+ generate_C_header(open(sys.argv[2], "w"))
elif sys.argv[1] == '--generate-definitions':
- generate_C_definitions(sys.stdout)
+ generate_C_definitions(open(sys.argv[2], "w"))
else:
- if sys.version_info.major < 3:
- raise Exception("Dumping requires Python 3.")
s = open(sys.argv[1], "rb")
while 1:
start = s.tell()