-
Notifications
You must be signed in to change notification settings - Fork 335
/
box-unpack.js
63 lines (59 loc) · 1.46 KB
/
box-unpack.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* Copyright (c) Telecom ParisTech/TSI/MM/GPAC Cyril Concolato
* License: BSD-3-Clause (see LICENSE file)
*/
BoxParser.cttsBox.prototype.unpack = function(samples) {
var i, j, k;
k = 0;
for (i = 0; i < this.sample_counts.length; i++) {
for (j = 0; j < this.sample_counts[i]; j++) {
samples[k].pts = samples[k].dts + this.sample_offsets[i];
k++;
}
}
}
BoxParser.sttsBox.prototype.unpack = function(samples) {
var i, j, k;
k = 0;
for (i = 0; i < this.sample_counts.length; i++) {
for (j = 0; j < this.sample_counts[i]; j++) {
if (k === 0) {
samples[k].dts = 0;
} else {
samples[k].dts = samples[k-1].dts + this.sample_deltas[i];
}
k++;
}
}
}
BoxParser.stcoBox.prototype.unpack = function(samples) {
var i;
for (i = 0; i < this.chunk_offsets.length; i++) {
samples[i].offset = this.chunk_offsets[i];
}
}
BoxParser.stscBox.prototype.unpack = function(samples) {
var i, j, k, l, m;
l = 0;
m = 0;
for (i = 0; i < this.first_chunk.length; i++) {
for (j = 0; j < (i+1 < this.first_chunk.length ? this.first_chunk[i+1] : Infinity); j++) {
m++;
for (k = 0; k < this.samples_per_chunk[i]; k++) {
if (samples[l]) {
samples[l].description_index = this.sample_description_index[i];
samples[l].chunk_index = m;
} else {
return;
}
l++;
}
}
}
}
BoxParser.stszBox.prototype.unpack = function(samples) {
var i;
for (i = 0; i < this.sample_sizes.length; i++) {
samples[i].size = this.sample_sizes[i];
}
}