X-Git-Url: http://105106.c2e0p.group/movie_parser.git/blobdiff_plain/b73211b4d80bf99a6cbb870c33a1d1a3afc8fbce..9f6e5972143632750cf78ecee63b173df93045a9:/Atom.js diff --git a/Atom.js b/Atom.js old mode 100644 new mode 100755 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