@breakside/jskit 2025.2.1 → 2025.8.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/IKHTMLCanvasBitmapContext.js +28 -7
- package/Root/Frameworks/ImageKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTime.js +4 -2
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeAtom.js +1 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeMedia.js +39 -4
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeSampleSize.js +52 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeSampleTable.js +8 -0
- package/Root/Frameworks/MediaKit/QuickTime/MKQuickTimeTrack.js +10 -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/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.DOM",
|
|
4
|
-
"JSBundleVersion": "2025.
|
|
4
|
+
"JSBundleVersion": "2025.8.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "DOM+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "aec659a08a7eca75fa8b7eb838ad334bfe67b37f"
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.DOM'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.DOM",
|
|
6
|
-
"JSBundleVersion": "2025.
|
|
6
|
+
"JSBundleVersion": "2025.8.0",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.DOM'] = {
|
|
|
11
11
|
"node": "DOM+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "aec659a08a7eca75fa8b7eb838ad334bfe67b37f"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [],
|
|
17
17
|
"ResourceLookup": {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.FontKit",
|
|
4
|
-
"JSBundleVersion": "2025.
|
|
4
|
+
"JSBundleVersion": "2025.8.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
8
8
|
"html": "FontKit+HTML.js"
|
|
9
9
|
},
|
|
10
10
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
11
|
-
"GitRevision": "
|
|
11
|
+
"GitRevision": "aec659a08a7eca75fa8b7eb838ad334bfe67b37f"
|
|
12
12
|
}
|
|
@@ -3,14 +3,14 @@ JSBundle.bundles['io.breakside.JSKit.FontKit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.FontKit",
|
|
6
|
-
"JSBundleVersion": "2025.
|
|
6
|
+
"JSBundleVersion": "2025.8.0",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
10
10
|
"html": "FontKit+HTML.js"
|
|
11
11
|
},
|
|
12
12
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
13
|
-
"GitRevision": "
|
|
13
|
+
"GitRevision": "aec659a08a7eca75fa8b7eb838ad334bfe67b37f"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [],
|
|
16
16
|
"ResourceLookup": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.Foundation",
|
|
4
|
-
"JSBundleVersion": "2025.
|
|
4
|
+
"JSBundleVersion": "2025.8.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "Foundation+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "aec659a08a7eca75fa8b7eb838ad334bfe67b37f"
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.Foundation'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.Foundation",
|
|
6
|
-
"JSBundleVersion": "2025.
|
|
6
|
+
"JSBundleVersion": "2025.8.0",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.Foundation'] = {
|
|
|
11
11
|
"node": "Foundation+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "aec659a08a7eca75fa8b7eb838ad334bfe67b37f"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [
|
|
17
17
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "framework",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.JSKit.SecurityKit",
|
|
4
|
-
"JSBundleVersion": "2025.
|
|
4
|
+
"JSBundleVersion": "2025.8.0",
|
|
5
5
|
"JSDevelopmentLanguage": "en",
|
|
6
6
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
7
7
|
"JSBundleEnvironments": {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"node": "SecurityKit+Node.js"
|
|
10
10
|
},
|
|
11
11
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
12
|
-
"GitRevision": "
|
|
12
|
+
"GitRevision": "aec659a08a7eca75fa8b7eb838ad334bfe67b37f"
|
|
13
13
|
}
|
|
@@ -3,7 +3,7 @@ JSBundle.bundles['io.breakside.JSKit.SecurityKit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "framework",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.JSKit.SecurityKit",
|
|
6
|
-
"JSBundleVersion": "2025.
|
|
6
|
+
"JSBundleVersion": "2025.8.0",
|
|
7
7
|
"JSDevelopmentLanguage": "en",
|
|
8
8
|
"JSCopyright": "Copyright © 2020 Breakside Inc.",
|
|
9
9
|
"JSBundleEnvironments": {
|
|
@@ -11,7 +11,7 @@ JSBundle.bundles['io.breakside.JSKit.SecurityKit'] = {
|
|
|
11
11
|
"node": "SecurityKit+Node.js"
|
|
12
12
|
},
|
|
13
13
|
"JSLicenseNotice": "Licensed under the Breakside Public License, Version 1.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nIf a copy of the License was not distributed with this file, you may\nobtain a copy at\n\n http://breakside.io/licenses/LICENSE-1.0.txt\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
14
|
-
"GitRevision": "
|
|
14
|
+
"GitRevision": "aec659a08a7eca75fa8b7eb838ad334bfe67b37f"
|
|
15
15
|
},
|
|
16
16
|
"Resources": [],
|
|
17
17
|
"ResourceLookup": {
|
package/Info.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"JSBundleType": "node",
|
|
3
3
|
"JSBundleIdentifier": "io.breakside.jskit",
|
|
4
|
-
"JSBundleVersion": "2025.
|
|
4
|
+
"JSBundleVersion": "2025.8.0",
|
|
5
5
|
"JSExecutableName": "jskit",
|
|
6
6
|
"NPMOrganization": "breakside",
|
|
7
7
|
"JSResources": [
|
|
8
8
|
"Tests/HTMLTestRunner.js",
|
|
9
9
|
"Tests/NodeTestRunner.js"
|
|
10
10
|
],
|
|
11
|
-
"GitRevision": "
|
|
11
|
+
"GitRevision": "aec659a08a7eca75fa8b7eb838ad334bfe67b37f"
|
|
12
12
|
}
|
|
@@ -3,14 +3,14 @@ JSBundle.bundles['io.breakside.jskit'] = {
|
|
|
3
3
|
"Info": {
|
|
4
4
|
"JSBundleType": "node",
|
|
5
5
|
"JSBundleIdentifier": "io.breakside.jskit",
|
|
6
|
-
"JSBundleVersion": "2025.
|
|
6
|
+
"JSBundleVersion": "2025.8.0",
|
|
7
7
|
"JSExecutableName": "jskit",
|
|
8
8
|
"NPMOrganization": "breakside",
|
|
9
9
|
"JSResources": [
|
|
10
10
|
"Tests/HTMLTestRunner.js",
|
|
11
11
|
"Tests/NodeTestRunner.js"
|
|
12
12
|
],
|
|
13
|
-
"GitRevision": "
|
|
13
|
+
"GitRevision": "aec659a08a7eca75fa8b7eb838ad334bfe67b37f"
|
|
14
14
|
},
|
|
15
15
|
"Resources": [
|
|
16
16
|
{
|
|
@@ -208,6 +208,10 @@ JSClass("IKHTMLCanvasBitmapContext", IKBitmapContext, {
|
|
|
208
208
|
fillMaskedRect: function(rect, maskImage){
|
|
209
209
|
this.enqueueOperation(function(state, completion, target){
|
|
210
210
|
drawableElementForImage(maskImage, this.canvasContext.canvas.ownerDocument, function(imgElement){
|
|
211
|
+
if (imgElement === null){
|
|
212
|
+
completion.call(target);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
211
215
|
var scale = Math.ceil(Math.max(state.transform.a, state.transform.b));
|
|
212
216
|
var maskCanvas = this.canvasContext.canvas.ownerDocument.createElement("canvas");
|
|
213
217
|
maskCanvas.width = maskImage.size.width * scale;
|
|
@@ -228,6 +232,10 @@ JSClass("IKHTMLCanvasBitmapContext", IKBitmapContext, {
|
|
|
228
232
|
drawImage: function(image, rect){
|
|
229
233
|
this.enqueueOperation(function(state, completion, target){
|
|
230
234
|
drawableElementForImage(image, this.canvasContext.canvas.ownerDocument, function(imgElement){
|
|
235
|
+
if (imgElement === null){
|
|
236
|
+
completion.call(target);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
231
239
|
var scale = Math.ceil(Math.max(state.transform.a, state.transform.b));
|
|
232
240
|
this.canvasContext.drawImage(imgElement, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
|
|
233
241
|
completion.call(target);
|
|
@@ -452,21 +460,34 @@ var drawableElementForImage = function(image, domDocument, completion, target){
|
|
|
452
460
|
var imgElement = domDocument.createElement("img");
|
|
453
461
|
imgElement.setAttribute("crossorigin", "anonymous");
|
|
454
462
|
imgElement.src = image.htmlURLString();
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
463
|
+
// Chrome sometimes throws an EncodingError for perfectly valid images,
|
|
464
|
+
// because it apparently has limited memory for .decode().
|
|
465
|
+
// The workaround is to stop using .decode() and just use the old events
|
|
466
|
+
// if (imgElement.decode){
|
|
467
|
+
// imgElement.decode().then(function(){
|
|
468
|
+
// completion.call(target, imgElement);
|
|
469
|
+
// }, function(e){
|
|
470
|
+
// logger.debug("image: %{public} %dx%d @ %{public}", image.$class.className, image.size.width, image.size.height, imgElement.src);
|
|
471
|
+
// logger.error("failed to decode image: %{error}", e);
|
|
472
|
+
// completion.call(target, null);
|
|
473
|
+
// });
|
|
474
|
+
// }else{
|
|
460
475
|
var listener = {
|
|
461
476
|
handleEvent: function(event){
|
|
462
477
|
imgElement.removeEventListener("load", listener);
|
|
463
478
|
imgElement.removeEventListener("error", listener);
|
|
464
|
-
|
|
479
|
+
if (event.type === "error"){
|
|
480
|
+
logger.debug("image: %{public} %dx%d @ %{public}", image.$class.className, image.size.width, image.size.height, imgElement.src);
|
|
481
|
+
logger.error("failed to load image, will skip drawing");
|
|
482
|
+
completion.call(target, null);
|
|
483
|
+
}else{
|
|
484
|
+
completion.call(target, imgElement);
|
|
485
|
+
}
|
|
465
486
|
}
|
|
466
487
|
};
|
|
467
488
|
imgElement.addEventListener("load", listener);
|
|
468
489
|
imgElement.addEventListener("error", listener);
|
|
469
|
-
}
|
|
490
|
+
// }
|
|
470
491
|
};
|
|
471
492
|
|
|
472
493
|
IKBitmapContext.definePropertiesFromExtensions({
|
|
@@ -194,14 +194,16 @@ JSClass("MKQuickTime", MKQuickTimeAtom, {
|
|
|
194
194
|
height: track.videoResolution.height,
|
|
195
195
|
formats: MKQuickTimeAtom.stringsForTypes(track.sampleFormats),
|
|
196
196
|
frameRates: track.videoFrameRates,
|
|
197
|
-
averageFrameRate: track.averageVideoFrameRate
|
|
197
|
+
averageFrameRate: track.averageVideoFrameRate,
|
|
198
|
+
bitrate: track.bitrate
|
|
198
199
|
});
|
|
199
200
|
metadata.video = true;
|
|
200
201
|
}else if (track.isAudio){
|
|
201
202
|
metadata.tracks.push({
|
|
202
203
|
type: "audio",
|
|
203
204
|
formats: MKQuickTimeAtom.stringsForTypes(track.sampleFormats),
|
|
204
|
-
sampleRates: track.audioSampleRates
|
|
205
|
+
sampleRates: track.audioSampleRates,
|
|
206
|
+
bitrate: track.bitrate
|
|
205
207
|
});
|
|
206
208
|
metadata.audio = true;
|
|
207
209
|
}
|
|
@@ -70,18 +70,18 @@ JSClass("MKQuickTimeMedia", MKQuickTimeAtom, {
|
|
|
70
70
|
getAverageVideoFrameRate: function(){
|
|
71
71
|
var handler = this.mediaHandler;
|
|
72
72
|
if (handler === null){
|
|
73
|
-
return
|
|
73
|
+
return null;
|
|
74
74
|
}
|
|
75
75
|
if (handler.componentSubtype !== MKQuickTimeMediaHandler.ComponentSubtype.vide){
|
|
76
|
-
return
|
|
76
|
+
return null;
|
|
77
77
|
}
|
|
78
78
|
var info = this.mediaInformation;
|
|
79
79
|
if (info === null){
|
|
80
|
-
return
|
|
80
|
+
return null;
|
|
81
81
|
}
|
|
82
82
|
var header = this.mediaHeader;
|
|
83
83
|
if (header === null){
|
|
84
|
-
return
|
|
84
|
+
return null;
|
|
85
85
|
}
|
|
86
86
|
var counts = info.sampleCounts;
|
|
87
87
|
var durations = info.sampleDurations;
|
|
@@ -120,6 +120,41 @@ JSClass("MKQuickTimeMedia", MKQuickTimeAtom, {
|
|
|
120
120
|
return [];
|
|
121
121
|
}
|
|
122
122
|
return info.sampleFormats;
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
bitrate: JSReadOnlyProperty(),
|
|
126
|
+
|
|
127
|
+
getBitrate: function(){
|
|
128
|
+
var info = this.mediaInformation;
|
|
129
|
+
if (info === null){
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
var header = this.mediaHeader;
|
|
133
|
+
if (header === null){
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
var sampleTable = info.sampleTable;
|
|
137
|
+
if (sampleTable === null){
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
var sizeTable = sampleTable.sampleSize;
|
|
141
|
+
if (sizeTable === null){
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
var counts = info.sampleCounts;
|
|
145
|
+
var durations = info.sampleDurations;
|
|
146
|
+
var totalSeconds = 0;
|
|
147
|
+
var totalBytes = 0;
|
|
148
|
+
var i, l;
|
|
149
|
+
var j;
|
|
150
|
+
var s = 0;
|
|
151
|
+
for (i = 0, l = durations.length; i < l; ++i){
|
|
152
|
+
for (j = 0; j < counts[i]; ++j, ++s){
|
|
153
|
+
totalBytes += sizeTable.sizeAtIndex(s);
|
|
154
|
+
}
|
|
155
|
+
totalSeconds += (durations[i] * counts[i]) / header.timeScale;
|
|
156
|
+
}
|
|
157
|
+
return (totalBytes * 8) / totalSeconds;
|
|
123
158
|
}
|
|
124
159
|
|
|
125
160
|
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// #import "MKQuickTimeAtom.js"
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
(function(){
|
|
5
|
+
|
|
6
|
+
var logger = JSLog("medikit", "quicktime");
|
|
7
|
+
|
|
8
|
+
JSClass("MKQuickTimeSampleSize", MKQuickTimeAtom, {
|
|
9
|
+
|
|
10
|
+
type: MKQuickTimeAtom.Type.stsz,
|
|
11
|
+
version: JSReadOnlyProperty(),
|
|
12
|
+
flags: JSReadOnlyProperty(),
|
|
13
|
+
sampleSize: JSReadOnlyProperty(),
|
|
14
|
+
numberOfEntries: 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
|
+
initWithData: function(data){
|
|
25
|
+
MKQuickTimeSampleSize.$super.initWithData.call(this, data);
|
|
26
|
+
if (data.length < 20){
|
|
27
|
+
throw new Error("expecting at least 20 bytes for st atom");
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
getSampleSize: function(){
|
|
32
|
+
return this.dataView.getUint32(12);
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
getNumberOfEntries: function(){
|
|
36
|
+
return this.dataView.getUint32(16);
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
sizeAtIndex: function(index){
|
|
40
|
+
if (this.sampleSize !== 0){
|
|
41
|
+
return this.sampleSize;
|
|
42
|
+
}
|
|
43
|
+
var i = 20 + index * 4;
|
|
44
|
+
if (i >= 20 && i < this.data.length){
|
|
45
|
+
return this.dataView.getUint32(i);
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
})();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// #import "MKQuickTimeAtom.js"
|
|
2
2
|
// #import "MKQuickTimeTimeToSample.js"
|
|
3
3
|
// #import "MKQuickTimeSampleDescription.js"
|
|
4
|
+
// #import "MKQuickTimeSampleSize.js"
|
|
4
5
|
"use strict";
|
|
5
6
|
|
|
6
7
|
(function(){
|
|
@@ -16,6 +17,7 @@ JSClass("MKQuickTimeSampleTable", MKQuickTimeAtom, {
|
|
|
16
17
|
MKQuickTimeSampleTable.$super.initWithData.call(this, data);
|
|
17
18
|
this.registerAtomClass(MKQuickTimeTimeToSample);
|
|
18
19
|
this.registerAtomClass(MKQuickTimeSampleDescription);
|
|
20
|
+
this.registerAtomClass(MKQuickTimeSampleSize);
|
|
19
21
|
this.readAtoms(8);
|
|
20
22
|
},
|
|
21
23
|
|
|
@@ -31,6 +33,12 @@ JSClass("MKQuickTimeSampleTable", MKQuickTimeAtom, {
|
|
|
31
33
|
return this.atomOfType(MKQuickTimeAtom.Type.stsd);
|
|
32
34
|
},
|
|
33
35
|
|
|
36
|
+
sampleSize: JSReadOnlyProperty(),
|
|
37
|
+
|
|
38
|
+
getSampleSize: function(){
|
|
39
|
+
return this.atomOfType(MKQuickTimeAtom.Type.stsz);
|
|
40
|
+
},
|
|
41
|
+
|
|
34
42
|
sampleDurations: JSReadOnlyProperty(),
|
|
35
43
|
|
|
36
44
|
getSampleDurations: function(){
|
|
@@ -126,6 +126,16 @@ JSClass("MKQuickTimeTrack", MKQuickTimeAtom, {
|
|
|
126
126
|
return [];
|
|
127
127
|
}
|
|
128
128
|
return media.sampleFormats;
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
bitrate: JSReadOnlyProperty(),
|
|
132
|
+
|
|
133
|
+
getBitrate: function(){
|
|
134
|
+
var media = this.media;
|
|
135
|
+
if (media === null){
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
return media.bitrate;
|
|
129
139
|
}
|
|
130
140
|
|
|
131
141
|
});
|