@breakside/jskit 2023.35.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.
Files changed (66) hide show
  1. package/Frameworks/DOM.jsframework/Info.json +2 -2
  2. package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
  3. package/Frameworks/FontKit.jsframework/Info.json +2 -2
  4. package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
  5. package/Frameworks/Foundation.jsframework/Info.json +2 -2
  6. package/Frameworks/Foundation.jsframework/JS/JSHTMLHTTPClient.js +1 -1
  7. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  8. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  9. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  10. package/Info.json +2 -2
  11. package/Node/io.breakside.jskit-bundle.js +2 -2
  12. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  13. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  14. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  15. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  16. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  17. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  18. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  19. package/Root/Frameworks/DOM/Info.yaml +1 -1
  20. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  21. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  22. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  23. package/Root/Frameworks/Foundation/JSHTMLHTTPClient.js +1 -1
  24. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  25. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  26. package/Root/Frameworks/MediaKit/MKAsset+HTML.js +80 -0
  27. package/Root/Frameworks/MediaKit/MKAsset.js +12 -0
  28. package/Root/Frameworks/MediaKit/MKRemoteAsset.js +39 -0
  29. package/Root/Frameworks/MediaKit/MediaKit+HTML.js +2 -1
  30. package/Root/Frameworks/MediaKit/MediaKit.js +17 -1
  31. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTime.js +216 -0
  32. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeAtom.js +157 -0
  33. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeFileType.js +45 -0
  34. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMedia.js +127 -0
  35. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMediaHandler.js +68 -0
  36. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMediaHeader.js +50 -0
  37. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMediaInformation.js +67 -0
  38. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMeta.js +19 -0
  39. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMovie.js +78 -0
  40. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMovieHeader.js +62 -0
  41. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeSampleDescription.js +72 -0
  42. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeSampleTable.js +84 -0
  43. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeTimeToSample.js +57 -0
  44. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeTrack.js +133 -0
  45. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeTrackHeader.js +82 -0
  46. package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeUserData.js +19 -0
  47. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  48. package/Root/Frameworks/MediaKitUI/MKVideoView+HTML.js +77 -0
  49. package/Root/Frameworks/MediaKitUI/MKVideoView.js +19 -1
  50. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  51. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  52. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  53. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  54. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  55. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  56. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  57. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  58. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  59. package/Root/Frameworks/UIKit/UIButton.js +29 -10
  60. package/Root/Frameworks/UIKit/UIListView.js +3 -3
  61. package/Root/Frameworks/UIKit/UIMenuView.js +6 -0
  62. package/Root/Frameworks/UIKit/UIPopupButton.js +22 -3
  63. package/Root/Frameworks/UIKit/UISlider.js +4 -2
  64. package/Root/Frameworks/UIKit/UIStackView.js +43 -0
  65. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  66. package/package.json +1 -1
@@ -0,0 +1,216 @@
1
+ // #import "MKQuickTimeAtom.js"
2
+ // #import "MKQuickTimeFileType.js"
3
+ // #import "MKQuickTimeMovie.js"
4
+ "use strict";
5
+
6
+ (function(){
7
+
8
+ var logger = JSLog("medikit", "quicktime");
9
+
10
+ JSClass("MKQuickTime", MKQuickTimeAtom, {
11
+
12
+ initWithData: function(data){
13
+ this.atoms = [];
14
+ this.data = data;
15
+ this.dataView = data.dataView();
16
+ this.registerAtomClass(MKQuickTimeFileType);
17
+ this.registerAtomClass(MKQuickTimeMovie);
18
+ this.readAtoms();
19
+ },
20
+
21
+ duration: JSReadOnlyProperty(),
22
+
23
+ getDuration: function(){
24
+ var movie = this.movie;
25
+ if (movie === null){
26
+ return -1;
27
+ }
28
+ var header = movie.movieHeader;
29
+ if (header === null){
30
+ return -1;
31
+ }
32
+ return header.duration / header.timeScale;
33
+ },
34
+
35
+ posterTime: JSReadOnlyProperty(),
36
+
37
+ getPosterTime: function(){
38
+ var movie = this.movie;
39
+ if (movie === null){
40
+ return 0;
41
+ }
42
+ var header = movie.movieHeader;
43
+ if (header === null){
44
+ return 0;
45
+ }
46
+ return header.posterTime / header.timeScale;
47
+ },
48
+
49
+ fileType: JSReadOnlyProperty(),
50
+
51
+ getFileType: function(){
52
+ return this.atomOfType(MKQuickTimeAtom.Type.ftyp);
53
+ },
54
+
55
+ movie: JSReadOnlyProperty(),
56
+
57
+ getMovie: function(){
58
+ return this.atomOfType(MKQuickTimeAtom.Type.moov);
59
+ },
60
+
61
+ dictionaryRepresentation: function(){
62
+ return {
63
+ };
64
+ },
65
+
66
+ videoResolutions: JSReadOnlyProperty(),
67
+
68
+ getVideoResolutions: function(){
69
+ var resolutions = [];
70
+ var movie = this.movie;
71
+ if (movie !== null){
72
+ var videoTracks = movie.videoTracks;
73
+ var i, l;
74
+ var track;
75
+ var resolution;
76
+ for (i = 0, l = videoTracks.length; i < l; ++i){
77
+ track = videoTracks[i];
78
+ resolution = track.videoResolution;
79
+ if (resolution !== null){
80
+ resolutions.push(resolution);
81
+ }
82
+ }
83
+ }
84
+ return resolutions;
85
+ },
86
+
87
+ videoTracks: JSReadOnlyProperty(),
88
+
89
+ getVideoTracks: function(){
90
+ var movie = this.movie;
91
+ if (movie === null){
92
+ return [];
93
+ }
94
+ return movie.videoTracks;
95
+ },
96
+
97
+ audioTracks: JSReadOnlyProperty(),
98
+
99
+ getAudioTracks: function(){
100
+ var movie = this.movie;
101
+ if (movie === null){
102
+ return [];
103
+ }
104
+ return movie.audioTracks;
105
+ },
106
+
107
+ videoFrameRates: JSReadOnlyProperty(),
108
+
109
+ getVideoFrameRates: function(){
110
+ var movie = this.movie;
111
+ if (movie === null){
112
+ return [];
113
+ }
114
+ var tracks = movie.videoTracks;
115
+ var i, l;
116
+ var rates = [];
117
+ for (i = 0, l = tracks.length; i < l; ++i){
118
+ rates = rates.concat(tracks[i].sampleRates);
119
+ }
120
+ return rates;
121
+ },
122
+
123
+ audioSampleRates: JSReadOnlyProperty(),
124
+
125
+ getAudioSampleRates: function(){
126
+ var movie = this.movie;
127
+ if (movie === null){
128
+ return [];
129
+ }
130
+ var tracks = movie.audioTracks;
131
+ var i, l;
132
+ var rates = [];
133
+ for (i = 0, l = tracks.length; i < l; ++i){
134
+ rates = rates.concat(tracks[i].sampleRates);
135
+ }
136
+ return rates;
137
+ },
138
+
139
+ videoFormats: JSReadOnlyProperty(),
140
+
141
+ getVideoFormats: function(){
142
+ var movie = this.movie;
143
+ if (movie === null){
144
+ return [];
145
+ }
146
+ var tracks = movie.videoTracks;
147
+ var i, l;
148
+ var formats = [];
149
+ for (i = 0, l = tracks.length; i < l; ++i){
150
+ formats = formats.concat(tracks[i].sampleFormats);
151
+ }
152
+ return formats;
153
+ },
154
+
155
+ audioFormats: JSReadOnlyProperty(),
156
+
157
+ getAudioFormats: function(){
158
+ var movie = this.movie;
159
+ if (movie === null){
160
+ return [];
161
+ }
162
+ var tracks = movie.audioTracks;
163
+ var i, l;
164
+ var formats = [];
165
+ for (i = 0, l = tracks.length; i < l; ++i){
166
+ formats = formats.concat(tracks[i].sampleFormats);
167
+ }
168
+ return formats;
169
+ },
170
+
171
+ metadata: JSReadOnlyProperty(),
172
+
173
+ getMetadata: function(){
174
+ var metadata = {
175
+ format: MKQuickTimeAtom.stringForType(this.fileType !== null ? this.fileType.majorBrand : MKQuickTimeFileType.MajorBrand.qt),
176
+ duration: this.duration,
177
+ posterTime: this.posterTime,
178
+ video: false,
179
+ audio: false,
180
+ tracks: []
181
+ };
182
+ var i, l;
183
+ var movie = this.movie;
184
+ if (movie !== null){
185
+ var tracks = movie.tracks;
186
+ var track;
187
+ for (i = 0, l = tracks.length; i < l; ++i){
188
+ track = tracks[i];
189
+ if (track.enabled && track.inMovie){
190
+ if (track.isVideo){
191
+ metadata.tracks.push({
192
+ type: "video",
193
+ width: track.videoResolution.width,
194
+ height: track.videoResolution.height,
195
+ formats: MKQuickTimeAtom.stringsForTypes(track.sampleFormats),
196
+ frameRates: track.videoFrameRates,
197
+ averageFrameRate: track.averageVideoFrameRate
198
+ });
199
+ metadata.video = true;
200
+ }else if (track.isAudio){
201
+ metadata.tracks.push({
202
+ type: "audio",
203
+ formats: MKQuickTimeAtom.stringsForTypes(track.sampleFormats),
204
+ sampleRates: track.audioSampleRates
205
+ });
206
+ metadata.audio = true;
207
+ }
208
+ }
209
+ }
210
+ }
211
+ return metadata;
212
+ },
213
+
214
+ });
215
+
216
+ })();
@@ -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
+ })();