forked from gpac/mp4box.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ctts.js
23 lines (22 loc) · 767 Bytes
/
ctts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
BoxParser.cttsBox.prototype.parse = function(stream) {
var entry_count;
var i;
this.parseFullHeader(stream);
entry_count = stream.readUint32();
this.sample_counts = [];
this.sample_offsets = [];
if (this.version === 0) {
for(i=0; i<entry_count; i++) {
this.sample_counts.push(stream.readUint32());
/* some files are buggy and declare version=0 while using signed offsets.
The likelyhood of using the most significant bit in a 32-bits time offset is very low,
so using signed value here as well */
this.sample_offsets.push(stream.readInt32());
}
} else if (this.version == 1) {
for(i=0; i<entry_count; i++) {
this.sample_counts.push(stream.readUint32());
this.sample_offsets.push(stream.readInt32()); /* signed */
}
}
}