-
Notifications
You must be signed in to change notification settings - Fork 344
/
Copy pathbox-print.js
73 lines (67 loc) · 2.41 KB
/
box-print.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
64
65
66
67
68
69
70
71
72
73
/*
* Copyright (c) Telecom ParisTech/TSI/MM/GPAC Cyril Concolato
* License: BSD-3-Clause (see LICENSE file)
*/
BoxParser.Box.prototype.printHeader = function(output) {
this.size += 8;
if (this.size > MAX_SIZE) {
this.size += 8;
}
if (this.type === "uuid") {
this.size += 16;
}
output.log(output.indent+"size:"+this.size);
output.log(output.indent+"type:"+this.type);
}
BoxParser.FullBox.prototype.printHeader = function(output) {
this.size += 4;
BoxParser.Box.prototype.printHeader.call(this, output);
output.log(output.indent+"version:"+this.version);
output.log(output.indent+"flags:"+this.flags);
}
BoxParser.Box.prototype.print = function(output) {
this.printHeader(output);
}
BoxParser.ContainerBox.prototype.print = function(output) {
this.printHeader(output);
for (var i=0; i<this.boxes.length; i++) {
if (this.boxes[i]) {
var prev_indent = output.indent;
output.indent += " ";
this.boxes[i].print(output);
output.indent = prev_indent;
}
}
}
ISOFile.prototype.print = function(output) {
output.indent = "";
for (var i=0; i<this.boxes.length; i++) {
if (this.boxes[i]) {
this.boxes[i].print(output);
}
}
}
BoxParser.mvhdBox.prototype.print = function(output) {
BoxParser.FullBox.prototype.printHeader.call(this, output);
output.log(output.indent+"creation_time: "+this.creation_time);
output.log(output.indent+"modification_time: "+this.modification_time);
output.log(output.indent+"timescale: "+this.timescale);
output.log(output.indent+"duration: "+this.duration);
output.log(output.indent+"rate: "+this.rate);
output.log(output.indent+"volume: "+(this.volume>>8));
output.log(output.indent+"matrix: "+this.matrix.join(", "));
output.log(output.indent+"next_track_id: "+this.next_track_id);
}
BoxParser.tkhdBox.prototype.print = function(output) {
BoxParser.FullBox.prototype.printHeader.call(this, output);
output.log(output.indent+"creation_time: "+this.creation_time);
output.log(output.indent+"modification_time: "+this.modification_time);
output.log(output.indent+"track_id: "+this.track_id);
output.log(output.indent+"duration: "+this.duration);
output.log(output.indent+"volume: "+(this.volume>>8));
output.log(output.indent+"matrix: "+this.matrix.join(", "));
output.log(output.indent+"layer: "+this.layer);
output.log(output.indent+"alternate_group: "+this.alternate_group);
output.log(output.indent+"width: "+this.width);
output.log(output.indent+"height: "+this.height);
}