+}
+
+var SyncSampleAtom = function(buffer, offset) {
+ Object.getPrototypeOf(SyncSampleAtom.prototype).constructor.call(this, buffer, offset);
+}
+
+SyncSampleAtom.prototype = Object.create(Atom.prototype);
+
+SyncSampleAtom.prototype.setDefaults = function() {
+ Object.getPrototypeOf(SyncSampleAtom.prototype).setDefaults.call(this);
+
+ this.version = 0;
+ this.flags = 0;
+ this.entries = 0;
+ this.syncSamples = [];
+}
+
+SyncSampleAtom.prototype.parse = function(buffer, offset) {
+ var headerOffset = Object.getPrototypeOf(SyncSampleAtom.prototype).parse.call(this, buffer, offset);
+ if (!headerOffset)
+ return 0;
+
+ var view = new DataView(buffer, offset);
+
+ this.version = view.getUint8(headerOffset);
+ headerOffset += 1;
+
+ // 'flags' is a 3-byte field, so retrieve from one extra byte and concatenate
+ this.flags = (view.getUint8(headerOffset) << 8) + view.getUint16(headerOffset + 1);
+ headerOffset += 3;
+
+ this.entries = view.getUint32(headerOffset);
+ headerOffset += 4;
+
+ while (headerOffset < this.size) {
+ var sampleNumber = view.getUint32(headerOffset);
+ headerOffset += 4;
+ this.syncSamples.push(sampleNumber);
+ }
+}
+
+var TimeToSampleAtom = function(buffer, offset) {
+ Object.getPrototypeOf(TimeToSampleAtom.prototype).constructor.call(this, buffer, offset);
+}
+
+TimeToSampleAtom.prototype = Object.create(VersionFlagsAtom.prototype);
+
+TimeToSampleAtom.prototype.setDefaults = function() {
+ Object.getPrototypeOf(TimeToSampleAtom.prototype).setDefaults.call(this);
+
+ this.entries = 0;
+
+ Object.defineProperty(this, "timeToSamples", {
+ value: [],
+ writable: true,
+ enumerable: false,
+ configurable: true,
+ });
+}
+
+TimeToSampleAtom.prototype.parse = function(buffer, offset) {
+ var headerOffset = Object.getPrototypeOf(TimeToSampleAtom.prototype).parse.call(this, buffer, offset);
+ if (!headerOffset)
+ return 0;
+
+ var view = new DataView(buffer, offset);
+
+ this.entries = view.getUint32(headerOffset);
+ headerOffset += 4;
+
+ while (headerOffset < this.size) {
+ var sampleCount = view.getUint32(headerOffset);
+ headerOffset += 4;
+
+ var sampleDuration = view.getUint32(headerOffset);
+ headerOffset += 4;
+
+ this.timeToSamples.push([sampleCount, sampleDuration]);
+ }