+
+
+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