]> id.pley.net Git - movie_parser.git/blobdiff - Atom.js
Upload Dropbox.com versions of everything
[movie_parser.git] / Atom.js
diff --git a/Atom.js b/Atom.js
old mode 100644 (file)
new mode 100755 (executable)
index a3ff73b..0875055
--- a/Atom.js
+++ b/Atom.js
@@ -408,7 +408,7 @@ class EditListBox extends FullBox {
             var mediaRateFraction = view.getUint16(headerOffset);
             headerOffset += 2;
 
-            this.edits.push([segmentDuration, mediaTime, mediaRateFraction, mediaRateInteger]);
+            this.edits.push([segmentDuration, mediaTime, mediaRateInteger, mediaRateFraction]);
         }
 
         return headerOffset;
@@ -1831,3 +1831,36 @@ class TrackFragmentBaseMediaDecodeTimeBox extends FullBox {
 };
 
 Atom.constructorMap['tfdt'] = TrackFragmentBaseMediaDecodeTimeBox.bind(null);
+
+
+class ColorBox extends Atom {
+    constructor(parent) {
+        super(parent);
+        this.description = "Color";
+    };
+
+    parse(buffer, offset) {
+        var headerOffset = super.parse(buffer, offset);
+        var view = new DataView(buffer, offset);
+
+        var typeArrayView = new Uint8Array(buffer, offset + headerOffset, 4);
+        this.colorType = String.fromCharCode.apply(null, typeArrayView);
+        headerOffset += 4;
+
+        if (this.colorType == 'nclx') {
+            this.colorPrimaries = view.getUint16(headerOffset);
+            headerOffset += 2;
+
+            this.transferCharacteristics = view.getUint16(headerOffset);
+            headerOffset += 2;
+
+            this.matrixCoefficients = view.getUint16(headerOffset);
+            headerOffset += 2;
+
+            this.fullRangeFlag = view.getUint8(headerOffset) & 0xF
+            headerOffset++;
+        }
+    }
+}
+
+Atom.constructorMap['colr'] = ColorBox.bind(null);
\ No newline at end of file