@breakside/jskit 2023.40.0 → 2023.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Frameworks/DOM.jsframework/Info.json +2 -2
- package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
- package/Frameworks/FontKit.jsframework/Info.json +2 -2
- package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/Info.json +2 -2
- package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
- package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
- package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
- package/Info.json +2 -2
- package/Node/io.breakside.jskit-bundle.js +2 -2
- package/Root/Frameworks/APIKit/Info.yaml +1 -1
- package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/AuthKit/Info.yaml +1 -1
- package/Root/Frameworks/CSSOM/Info.yaml +1 -1
- package/Root/Frameworks/ChartKit/Info.yaml +1 -1
- package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
- package/Root/Frameworks/DBKit/Info.yaml +1 -1
- package/Root/Frameworks/DOM/Info.yaml +1 -1
- package/Root/Frameworks/Dispatch/Info.yaml +1 -1
- package/Root/Frameworks/FontKit/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/ImageKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKit/MediaKit.js +16 -1
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTime.js +216 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeAtom.js +157 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeFileType.js +45 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMedia.js +127 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMediaHandler.js +68 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMediaHeader.js +50 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMediaInformation.js +67 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMeta.js +19 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMovie.js +78 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMovieHeader.js +62 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeSampleDescription.js +72 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeSampleTable.js +84 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeTimeToSample.js +57 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeTrack.js +133 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeTrackHeader.js +82 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeUserData.js +19 -0
- package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
- package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
- package/Root/Frameworks/PDFKit/Info.yaml +1 -1
- package/Root/Frameworks/QRKit/Info.yaml +1 -1
- package/Root/Frameworks/SearchKit/Info.yaml +1 -1
- package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/TestKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/UIButton.js +29 -10
- package/Root/Frameworks/UIKit/UIMenuView.js +6 -0
- package/Root/Frameworks/UIKit/UIPopupButton.js +1 -1
- package/Root/Frameworks/UIKit/UIStackView.js +43 -0
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// #import Foundation
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
(function(){
|
|
5
|
+
|
|
6
|
+
var logger = JSLog("medikit", "quicktime");
|
|
7
|
+
|
|
8
|
+
JSClass("MKQuickTimeAtom", JSObject, {
|
|
9
|
+
|
|
10
|
+
type: null,
|
|
11
|
+
atoms: null,
|
|
12
|
+
data: null,
|
|
13
|
+
dataView: null,
|
|
14
|
+
|
|
15
|
+
initWithData: function(data){
|
|
16
|
+
if (data.length < 8){
|
|
17
|
+
throw new Error("Expecting at least 8 bytes for every atom");
|
|
18
|
+
}
|
|
19
|
+
this.atoms = [];
|
|
20
|
+
this.data = data;
|
|
21
|
+
this.dataView = data.dataView();
|
|
22
|
+
this.type = this.dataView.getUint32(4);
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
readAtoms: function(offset){
|
|
26
|
+
if (offset === undefined){
|
|
27
|
+
offset = 0;
|
|
28
|
+
}
|
|
29
|
+
var i = offset;
|
|
30
|
+
var l = this.data.length;
|
|
31
|
+
var size;
|
|
32
|
+
var type;
|
|
33
|
+
var a, b;
|
|
34
|
+
var atomClass, atom;
|
|
35
|
+
while (i < l - 8){
|
|
36
|
+
size = this.dataView.getUint32(i);
|
|
37
|
+
type = this.dataView.getUint32(i + 4);
|
|
38
|
+
if (size === 0x00000001){
|
|
39
|
+
if (i < l - 16){
|
|
40
|
+
a = this.dataView.getUint32(i + 8);
|
|
41
|
+
b = this.dataView.getUint32(i + 12);
|
|
42
|
+
size = Math.pow(2, 32) * a + b;
|
|
43
|
+
if (size > Number.MAX_SAFE_INTEGER){
|
|
44
|
+
throw new Error("cannot retain full precision of 64 bit integer for atom at byte %d".sprintf(i));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}else{
|
|
48
|
+
if (size === 0x00000000){
|
|
49
|
+
size = l - i;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (i + size > l){
|
|
53
|
+
throw new Error("invalid size for atom at byte %d, extends beyond file size".sprintf(i));
|
|
54
|
+
}
|
|
55
|
+
atomClass = this.classForAtomType(type);
|
|
56
|
+
atom = atomClass.initWithData(this.data.subdataInRange(JSRange(i, size)));
|
|
57
|
+
this.atoms.push(atom);
|
|
58
|
+
i += size;
|
|
59
|
+
}
|
|
60
|
+
if (i !== l){
|
|
61
|
+
logger.warn("unused bytes at end of atom");
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
classesByAtomType: JSLazyInitProperty(function(){ return {};}),
|
|
66
|
+
|
|
67
|
+
registerAtomClass: function(atomClass){
|
|
68
|
+
this.classesByAtomType[atomClass.prototype.type] = atomClass;
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
classForAtomType: function(type){
|
|
72
|
+
var atomClass = this.classesByAtomType[type];
|
|
73
|
+
if (atomClass === undefined){
|
|
74
|
+
atomClass = MKQuickTimeAtom;
|
|
75
|
+
}
|
|
76
|
+
return atomClass;
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
atomOfType: function(type){
|
|
80
|
+
var i, l;
|
|
81
|
+
for (i = 0, l = this.atoms.length; i < l; ++i){
|
|
82
|
+
if (this.atoms[i].type === type){
|
|
83
|
+
return this.atoms[i];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
atomsOfType: function(type){
|
|
90
|
+
var i, l;
|
|
91
|
+
var atoms = [];
|
|
92
|
+
for (i = 0, l = this.atoms.length; i < l; ++i){
|
|
93
|
+
if (this.atoms[i].type === type){
|
|
94
|
+
atoms.push(this.atoms[i]);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return atoms;
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
dictionaryRepresentation: function(){
|
|
101
|
+
return {
|
|
102
|
+
type: MKQuickTimeAtom.stringForType(this.type),
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
debugRepresentation: function(){
|
|
107
|
+
var dictionary = this.dictionaryRepresentation();
|
|
108
|
+
if (this.atoms.length > 0){
|
|
109
|
+
dictionary.atoms = [];
|
|
110
|
+
var i, l;
|
|
111
|
+
for (i = 0, l = this.atoms.length; i < l; ++i){
|
|
112
|
+
dictionary.atoms.push(this.atoms[i].debugRepresentation());
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return dictionary;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
MKQuickTimeAtom.Type = {
|
|
121
|
+
ftyp: 0x66747970,
|
|
122
|
+
moov: 0x6d6f6f76,
|
|
123
|
+
mvhd: 0x6d766864,
|
|
124
|
+
trak: 0x7472616b,
|
|
125
|
+
tkhd: 0x746b6864,
|
|
126
|
+
mdia: 0x6d646961,
|
|
127
|
+
mdhd: 0x6d646864,
|
|
128
|
+
hdlr: 0x68646c72,
|
|
129
|
+
minf: 0x6d696e66,
|
|
130
|
+
vmhd: 0x766d6864,
|
|
131
|
+
stbl: 0x7374626c,
|
|
132
|
+
stts: 0x73747473,
|
|
133
|
+
stsd: 0x73747364,
|
|
134
|
+
udta: 0x75647461,
|
|
135
|
+
meta: 0x6d657461
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
MKQuickTimeAtom.stringForType = function(type){
|
|
139
|
+
var bytes = [
|
|
140
|
+
(type & 0xFF000000) >>> 24,
|
|
141
|
+
(type & 0x00FF0000) >>> 16,
|
|
142
|
+
(type & 0x0000FF00) >>> 8,
|
|
143
|
+
(type & 0x000000FF)
|
|
144
|
+
];
|
|
145
|
+
return JSData.initWithArray(bytes).stringByDecodingLatin1();
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
MKQuickTimeAtom.stringsForTypes = function(types){
|
|
149
|
+
var strings = [];
|
|
150
|
+
var i, l;
|
|
151
|
+
for (i = 0, l = types.length; i < l; ++i){
|
|
152
|
+
strings.push(MKQuickTimeAtom.stringForType(types[i]));
|
|
153
|
+
}
|
|
154
|
+
return strings;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
})();
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// #import "MKQuickTimeAtom.js"
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
(function(){
|
|
5
|
+
|
|
6
|
+
var logger = JSLog("medikit", "quicktime");
|
|
7
|
+
|
|
8
|
+
JSClass("MKQuickTimeFileType", MKQuickTimeAtom, {
|
|
9
|
+
|
|
10
|
+
type: MKQuickTimeAtom.Type.ftyp,
|
|
11
|
+
|
|
12
|
+
majorBrand: JSReadOnlyProperty(),
|
|
13
|
+
minorVersion: JSReadOnlyProperty(),
|
|
14
|
+
|
|
15
|
+
getMajorBrand: function(){
|
|
16
|
+
return this.dataView.getUint32(8);
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
getMinorVersion: function(){
|
|
20
|
+
return this.dataView.getUint32(12);
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
initWithData: function(data){
|
|
24
|
+
if (data.length < 16){
|
|
25
|
+
throw new Error("expecting at least 16 bytes for ftyp atom");
|
|
26
|
+
}
|
|
27
|
+
MKQuickTimeFileType.$super.initWithData.call(this, data);
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
dictionaryRepresentation: function(){
|
|
31
|
+
return {
|
|
32
|
+
type: MKQuickTimeAtom.stringForType(this.type),
|
|
33
|
+
majorBrand: MKQuickTimeAtom.stringForType(this.majorBrand),
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
MKQuickTimeFileType.MajorBrand = {
|
|
40
|
+
qt: 0x71742020,
|
|
41
|
+
mp42: 0x6d703432,
|
|
42
|
+
m4v: 0x4d345620
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
})();
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// #import "MKQuickTimeAtom.js"
|
|
2
|
+
// #import "MKQuickTimeMediaHeader.js"
|
|
3
|
+
// #import "MKQuickTimeMediaHandler.js"
|
|
4
|
+
// #import "MKQuickTimeMediaInformation.js"
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
(function(){
|
|
8
|
+
|
|
9
|
+
var logger = JSLog("medikit", "quicktime");
|
|
10
|
+
|
|
11
|
+
JSClass("MKQuickTimeMedia", MKQuickTimeAtom, {
|
|
12
|
+
|
|
13
|
+
type: MKQuickTimeAtom.Type.mdia,
|
|
14
|
+
|
|
15
|
+
initWithData: function(data){
|
|
16
|
+
MKQuickTimeMedia.$super.initWithData.call(this, data);
|
|
17
|
+
this.registerAtomClass(MKQuickTimeMediaHeader);
|
|
18
|
+
this.registerAtomClass(MKQuickTimeMediaHandler);
|
|
19
|
+
this.registerAtomClass(MKQuickTimeMediaInformation);
|
|
20
|
+
this.readAtoms(8);
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
mediaHeader: JSReadOnlyProperty(),
|
|
24
|
+
|
|
25
|
+
getMediaHeader: function(){
|
|
26
|
+
return this.atomOfType(MKQuickTimeAtom.Type.mdhd);
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
mediaInformation: JSReadOnlyProperty(),
|
|
30
|
+
|
|
31
|
+
getMediaInformation: function(){
|
|
32
|
+
return this.atomOfType(MKQuickTimeAtom.Type.minf);
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
mediaHandler: JSReadOnlyProperty(),
|
|
36
|
+
|
|
37
|
+
getMediaHandler: function(){
|
|
38
|
+
return this.atomOfType(MKQuickTimeAtom.Type.hdlr);
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
videoFrameRates: JSReadOnlyProperty(),
|
|
42
|
+
|
|
43
|
+
getVideoFrameRates: function(){
|
|
44
|
+
var handler = this.mediaHandler;
|
|
45
|
+
if (handler === null){
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
if (handler.componentSubtype !== MKQuickTimeMediaHandler.ComponentSubtype.vide){
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
var info = this.mediaInformation;
|
|
52
|
+
if (info === null){
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
var header = this.mediaHeader;
|
|
56
|
+
if (header === null){
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
var rates = [];
|
|
60
|
+
var durations = info.sampleDurations;
|
|
61
|
+
var i, l;
|
|
62
|
+
for (i = 0, l = durations.length; i < l; ++i){
|
|
63
|
+
rates.push(header.timeScale / durations[i]);
|
|
64
|
+
}
|
|
65
|
+
return rates;
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
averageVideoFrameRate: JSReadOnlyProperty(),
|
|
69
|
+
|
|
70
|
+
getAverageVideoFrameRate: function(){
|
|
71
|
+
var handler = this.mediaHandler;
|
|
72
|
+
if (handler === null){
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
if (handler.componentSubtype !== MKQuickTimeMediaHandler.ComponentSubtype.vide){
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
var info = this.mediaInformation;
|
|
79
|
+
if (info === null){
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
var header = this.mediaHeader;
|
|
83
|
+
if (header === null){
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
var counts = info.sampleCounts;
|
|
87
|
+
var durations = info.sampleDurations;
|
|
88
|
+
var totalCount = 0;
|
|
89
|
+
var totalSeconds = 0;
|
|
90
|
+
var i, l;
|
|
91
|
+
for (i = 0, l = durations.length; i < l; ++i){
|
|
92
|
+
totalCount += counts[i];
|
|
93
|
+
totalSeconds += (durations[i] * counts[i]) / header.timeScale;
|
|
94
|
+
}
|
|
95
|
+
return totalCount / totalSeconds;
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
audioSampleRates: JSReadOnlyProperty(),
|
|
99
|
+
|
|
100
|
+
getAudioSampleRates: function(){
|
|
101
|
+
var handler = this.mediaHandler;
|
|
102
|
+
if (handler === null){
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
if (handler.componentSubtype !== MKQuickTimeMediaHandler.ComponentSubtype.soun){
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
var info = this.mediaInformation;
|
|
109
|
+
if (info === null){
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
return info.audioSampleRates;
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
sampleFormats: JSReadOnlyProperty(),
|
|
116
|
+
|
|
117
|
+
getSampleFormats: function(){
|
|
118
|
+
var info = this.mediaInformation;
|
|
119
|
+
if (info === null){
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
return info.sampleFormats;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
})();
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// #import "MKQuickTimeAtom.js"
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
(function(){
|
|
5
|
+
|
|
6
|
+
var logger = JSLog("medikit", "quicktime");
|
|
7
|
+
|
|
8
|
+
JSClass("MKQuickTimeMediaHandler", MKQuickTimeAtom, {
|
|
9
|
+
|
|
10
|
+
type: MKQuickTimeAtom.Type.hdlr,
|
|
11
|
+
version: JSReadOnlyProperty(),
|
|
12
|
+
flags: JSReadOnlyProperty(),
|
|
13
|
+
componentType: JSReadOnlyProperty(),
|
|
14
|
+
componentSubtype: JSReadOnlyProperty(),
|
|
15
|
+
|
|
16
|
+
getVersion: function(){
|
|
17
|
+
return this.data[8];
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
getFlags: function(){
|
|
21
|
+
return this.dataView.getUint32(8) & 0x00FFFFFF;
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
getComponentType: function(){
|
|
25
|
+
return this.dataView.getUint32(12);
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
getComponentSubtype: function(){
|
|
29
|
+
return this.dataView.getUint32(16);
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
initWithData: function(data){
|
|
33
|
+
if (data.length < 20){
|
|
34
|
+
throw new Error("expecting at least 20 bytes for hdlr atom");
|
|
35
|
+
}
|
|
36
|
+
MKQuickTimeMediaHandler.$super.initWithData.call(this, data);
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
dictionaryRepresentation: function(){
|
|
40
|
+
return {
|
|
41
|
+
type: MKQuickTimeAtom.stringForType(this.type),
|
|
42
|
+
version: this.version,
|
|
43
|
+
componentType: MKQuickTimeAtom.stringForType(this.componentType),
|
|
44
|
+
componentSubtype: MKQuickTimeAtom.stringForType(this.componentSubtype)
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
MKQuickTimeMediaHandler.ComponentType = {
|
|
51
|
+
|
|
52
|
+
unspecified: 0x00000000,
|
|
53
|
+
mhlr: 0x6d686c72,
|
|
54
|
+
dhlr: 0x64686c72
|
|
55
|
+
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
MKQuickTimeMediaHandler.ComponentSubtype = {
|
|
60
|
+
|
|
61
|
+
vide: 0x76696465,
|
|
62
|
+
soun: 0x736f756e,
|
|
63
|
+
subt: 0x73756274,
|
|
64
|
+
alis: 0x616c6973
|
|
65
|
+
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
})();
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// #import "MKQuickTimeAtom.js"
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
(function(){
|
|
5
|
+
|
|
6
|
+
var logger = JSLog("medikit", "quicktime");
|
|
7
|
+
|
|
8
|
+
JSClass("MKQuickTimeMediaHeader", MKQuickTimeAtom, {
|
|
9
|
+
|
|
10
|
+
type: MKQuickTimeAtom.Type.mdhd,
|
|
11
|
+
version: JSReadOnlyProperty(),
|
|
12
|
+
flags: JSReadOnlyProperty(),
|
|
13
|
+
timeScale: JSReadOnlyProperty(),
|
|
14
|
+
duration: JSReadOnlyProperty(),
|
|
15
|
+
|
|
16
|
+
getVersion: function(){
|
|
17
|
+
return this.data[8];
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
getFlags: function(){
|
|
21
|
+
return this.dataView.getUint32(8) & 0x00FFFFFF;
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
getTimeScale: function(){
|
|
25
|
+
return this.dataView.getUint32(20);
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
getDuration: function(){
|
|
29
|
+
return this.dataView.getUint32(24);
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
initWithData: function(data){
|
|
33
|
+
if (data.length < 28){
|
|
34
|
+
throw new Error("expecting at least 28 bytes for mdhd atom");
|
|
35
|
+
}
|
|
36
|
+
MKQuickTimeMediaHeader.$super.initWithData.call(this, data);
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
dictionaryRepresentation: function(){
|
|
40
|
+
return {
|
|
41
|
+
type: MKQuickTimeAtom.stringForType(this.type),
|
|
42
|
+
version: this.version,
|
|
43
|
+
timeScale: this.timeScale,
|
|
44
|
+
duration: this.duration
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
})();
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// #import "MKQuickTimeAtom.js"
|
|
2
|
+
// #import "MKQuickTimeSampleTable.js"
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
(function(){
|
|
6
|
+
|
|
7
|
+
var logger = JSLog("medikit", "quicktime");
|
|
8
|
+
|
|
9
|
+
JSClass("MKQuickTimeMediaInformation", MKQuickTimeAtom, {
|
|
10
|
+
|
|
11
|
+
type: MKQuickTimeAtom.Type.minf,
|
|
12
|
+
|
|
13
|
+
initWithData: function(data){
|
|
14
|
+
MKQuickTimeMediaInformation.$super.initWithData.call(this, data);
|
|
15
|
+
this.registerAtomClass(MKQuickTimeSampleTable);
|
|
16
|
+
this.readAtoms(8);
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
sampleTable: JSReadOnlyProperty(),
|
|
20
|
+
|
|
21
|
+
getSampleTable: function(){
|
|
22
|
+
return this.atomOfType(MKQuickTimeAtom.Type.stbl);
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
sampleDurations: JSReadOnlyProperty(),
|
|
26
|
+
|
|
27
|
+
getSampleDurations: function(){
|
|
28
|
+
var sampleTable = this.sampleTable;
|
|
29
|
+
if (sampleTable === null){
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
return sampleTable.sampleDurations;
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
sampleCounts: JSReadOnlyProperty(),
|
|
36
|
+
|
|
37
|
+
getSampleCounts: function(){
|
|
38
|
+
var sampleTable = this.sampleTable;
|
|
39
|
+
if (sampleTable === null){
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
return sampleTable.sampleCounts;
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
audioSampleRates: JSReadOnlyProperty(),
|
|
46
|
+
|
|
47
|
+
getAudioSampleRates: function(){
|
|
48
|
+
var sampleTable = this.sampleTable;
|
|
49
|
+
if (sampleTable === null){
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
return sampleTable.audioSampleRates;
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
sampleFormats: JSReadOnlyProperty(),
|
|
56
|
+
|
|
57
|
+
getSampleFormats: function(){
|
|
58
|
+
var sampleTable = this.sampleTable;
|
|
59
|
+
if (sampleTable === null){
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
return sampleTable.sampleFormats;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
})();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// #import "MKQuickTimeAtom.js"
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
(function(){
|
|
5
|
+
|
|
6
|
+
var logger = JSLog("medikit", "quicktime");
|
|
7
|
+
|
|
8
|
+
JSClass("MKQuickTimeMeta", MKQuickTimeAtom, {
|
|
9
|
+
|
|
10
|
+
type: MKQuickTimeAtom.Type.meta,
|
|
11
|
+
|
|
12
|
+
initWithData: function(data){
|
|
13
|
+
MKQuickTimeMeta.$super.initWithData.call(this, data);
|
|
14
|
+
this.readAtoms(8);
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
})();
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// #import "MKQuickTimeAtom.js"
|
|
2
|
+
// #import "MKQuickTimeMovieHeader.js"
|
|
3
|
+
// #import "MKQuickTimeTrack.js"
|
|
4
|
+
// #import "MKQuickTimeUserData.js"
|
|
5
|
+
// #import "MKQuickTimeMeta.js"
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
(function(){
|
|
9
|
+
|
|
10
|
+
var logger = JSLog("medikit", "quicktime");
|
|
11
|
+
|
|
12
|
+
JSClass("MKQuickTimeMovie", MKQuickTimeAtom, {
|
|
13
|
+
|
|
14
|
+
type: MKQuickTimeAtom.Type.moov,
|
|
15
|
+
|
|
16
|
+
initWithData: function(data){
|
|
17
|
+
MKQuickTimeMovie.$super.initWithData.call(this, data);
|
|
18
|
+
this.registerAtomClass(MKQuickTimeMovieHeader);
|
|
19
|
+
this.registerAtomClass(MKQuickTimeTrack);
|
|
20
|
+
this.registerAtomClass(MKQuickTimeUserData);
|
|
21
|
+
this.registerAtomClass(MKQuickTimeMeta);
|
|
22
|
+
this.readAtoms(8);
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
movieHeader: JSReadOnlyProperty(),
|
|
26
|
+
|
|
27
|
+
getMovieHeader: function(){
|
|
28
|
+
return this.atomOfType(MKQuickTimeAtom.Type.mvhd);
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
tracks: JSReadOnlyProperty(),
|
|
32
|
+
|
|
33
|
+
getTracks: function(){
|
|
34
|
+
return this.atomsOfType(MKQuickTimeAtom.Type.trak);
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
trackForID: function(trackID){
|
|
38
|
+
var i, l;
|
|
39
|
+
var tracks = this.tracks;
|
|
40
|
+
for (i = 0, l = tracks.length; i < l; ++i){
|
|
41
|
+
if (tracks[i].trackID === trackID){
|
|
42
|
+
return tracks[i];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
videoTracks: JSReadOnlyProperty(),
|
|
49
|
+
|
|
50
|
+
getVideoTracks: function(){
|
|
51
|
+
var i, l;
|
|
52
|
+
var tracks = this.tracks;
|
|
53
|
+
var videoTracks = [];
|
|
54
|
+
for (i = 0, l = tracks.length; i < l; ++i){
|
|
55
|
+
if (tracks[i].enabled && tracks[i].inMovie && tracks[i].isVideo){
|
|
56
|
+
videoTracks.push(tracks[i]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return videoTracks;
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
audioTracks: JSReadOnlyProperty(),
|
|
63
|
+
|
|
64
|
+
getAudioTracks: function(){
|
|
65
|
+
var i, l;
|
|
66
|
+
var tracks = this.tracks;
|
|
67
|
+
var videoTracks = [];
|
|
68
|
+
for (i = 0, l = tracks.length; i < l; ++i){
|
|
69
|
+
if (tracks[i].enabled && tracks[i].inMovie && tracks[i].isAudio){
|
|
70
|
+
videoTracks.push(tracks[i]);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return videoTracks;
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
})();
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// #import "MKQuickTimeAtom.js"
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
(function(){
|
|
5
|
+
|
|
6
|
+
var logger = JSLog("medikit", "quicktime");
|
|
7
|
+
|
|
8
|
+
JSClass("MKQuickTimeMovieHeader", MKQuickTimeAtom, {
|
|
9
|
+
|
|
10
|
+
type: MKQuickTimeAtom.Type.mvhd,
|
|
11
|
+
version: JSReadOnlyProperty(),
|
|
12
|
+
flags: JSReadOnlyProperty(),
|
|
13
|
+
timeScale: JSReadOnlyProperty(),
|
|
14
|
+
duration: JSReadOnlyProperty(),
|
|
15
|
+
preferredRate: JSReadOnlyProperty(),
|
|
16
|
+
posterTime: JSReadOnlyProperty(),
|
|
17
|
+
|
|
18
|
+
getVersion: function(){
|
|
19
|
+
return this.data[8];
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
getFlags: function(){
|
|
23
|
+
return this.dataView.getUint32(8) & 0x00FFFFFF;
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
getTimeScale: function(){
|
|
27
|
+
return this.dataView.getUint32(20);
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
getDuration: function(){
|
|
31
|
+
return this.dataView.getUint32(24);
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
getPreferredRate: function(){
|
|
35
|
+
return this.dataView.getUint16(28) + this.dataView.getUint16(30) / 0xFFFF;
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
getPosterTime: function(){
|
|
39
|
+
return this.dataView.getUint32(78);
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
initWithData: function(data){
|
|
43
|
+
if (data.length < 98){
|
|
44
|
+
throw new Error("expecting at least 98 bytes for mvhd atom");
|
|
45
|
+
}
|
|
46
|
+
MKQuickTimeMovieHeader.$super.initWithData.call(this, data);
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
dictionaryRepresentation: function(){
|
|
50
|
+
return {
|
|
51
|
+
type: MKQuickTimeAtom.stringForType(this.type),
|
|
52
|
+
version: this.version,
|
|
53
|
+
timeScale: this.timeScale,
|
|
54
|
+
duration: this.duration,
|
|
55
|
+
preferredRate: this.preferredRate,
|
|
56
|
+
posterTime: this.posterTime
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
})();
|