-
Notifications
You must be signed in to change notification settings - Fork 326
/
ctts.js
26 lines (25 loc) · 879 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
23
24
25
BoxParser.createFullBoxCtor("ctts", function(stream) {
var entry_count;
var i;
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 */
var value = stream.readInt32();
if (value < 0) {
Log.warn("BoxParser", "ctts box uses negative values without using version 1");
}
this.sample_offsets.push(value);
}
} 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 */
}
}
});