@windowkit/appkit 0.30.1 → 0.31.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/README.md +98 -0
- package/binding.gyp +6 -2
- package/package.json +2 -2
- package/prebuilds/darwin-arm64/calayers.node +0 -0
- package/prebuilds/darwin-x64/calayers.node +0 -0
- package/src/addon.mm +4 -0
- package/src/backend.mm +16 -0
- package/src/capture.mm +1732 -0
- package/src/player.mm +14 -0
package/src/player.mm
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
|
|
32
32
|
#include <napi.h>
|
|
33
33
|
#import <AVFoundation/AVFoundation.h>
|
|
34
|
+
#import <VideoToolbox/VideoToolbox.h>
|
|
34
35
|
#import <CoreMedia/CoreMedia.h>
|
|
35
36
|
#import <CoreVideo/CoreVideo.h>
|
|
36
37
|
#import <QuartzCore/QuartzCore.h>
|
|
@@ -259,8 +260,21 @@ static void Apply(CALPlayer* p, const PlayerSettings& s) {
|
|
|
259
260
|
}
|
|
260
261
|
}
|
|
261
262
|
|
|
263
|
+
// VP9 is one of VideoToolbox's supplemental decoders, which a process has to
|
|
264
|
+
// ask for before AVFoundation can use one. Without this a `vp09` track in an
|
|
265
|
+
// MP4 opens and comes ready, and reports a picture of no size and hands out
|
|
266
|
+
// no frames, with no error anywhere. Asked once, and of nothing on a Mac that
|
|
267
|
+
// has no such decoder: its VP9 then fails as any format it cannot play does.
|
|
268
|
+
static void RegisterSupplementalDecoders() {
|
|
269
|
+
static dispatch_once_t once;
|
|
270
|
+
dispatch_once(&once, ^{
|
|
271
|
+
VTRegisterSupplementalVideoDecoderIfAvailable(kCMVideoCodecType_VP9);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
262
275
|
static Napi::Value CreatePlayer(const Napi::CallbackInfo& info) {
|
|
263
276
|
Napi::Env env = info.Env();
|
|
277
|
+
RegisterSupplementalDecoders();
|
|
264
278
|
if (!info[0].IsString() || info[0].As<Napi::String>().Utf8Value().empty()) {
|
|
265
279
|
Napi::TypeError::New(env, "createPlayer(url, options): url is a path or a URL string")
|
|
266
280
|
.ThrowAsJavaScriptException();
|