@geastack/apple 0.2.27 → 0.2.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/apple",
3
- "version": "0.2.27",
3
+ "version": "0.2.28",
4
4
  "description": "Generated Apple SDK bindings plus the macOS, iOS and tvOS native build targets for Gea apps.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -116,7 +116,7 @@
116
116
  },
117
117
  "dependencies": {
118
118
  "@geastack/compiler": "^1.0.34",
119
- "@geastack/core": "^0.1.52",
119
+ "@geastack/core": "^0.1.57",
120
120
  "@geastack/elements": "^0.1.7",
121
121
  "@geastack/engine": "^0.1.23",
122
122
  "@geastack/geaos": "^0.1.3",
@@ -2000,6 +2000,13 @@ while IFS= read -r library; do [[ -z "$library" ]] || LINK_FRAMEWORKS+=("-l$libr
2000
2000
  node "$GEA_CLI" apps sync-native-resources "$APP_ID" --target macos --output "$RES_DIR" > "$BUILD_DIR/native-resources.json"
2001
2001
  if [[ "$(node -e 'process.stdout.write(String(JSON.parse(require("fs").readFileSync(process.argv[1],"utf8")).changed))' "$BUILD_DIR/native-resources.json")" == "true" ]]; then BUNDLE_CONTENT_CHANGED=1; fi
2002
2002
 
2003
+ # These weak program hooks are emitted only for programs with cycle-collectable
2004
+ # values. ld64 requires named exceptions for unresolved executable symbols.
2005
+ MACOS_LINK_FLAGS=(
2006
+ -Wl,-no_deduplicate
2007
+ -Wl,-U,_gea_cycle_collection_defer_begin
2008
+ -Wl,-U,_gea_cycle_collection_defer_end
2009
+ )
2003
2010
  LINK_OUTPUT="$MACOS_DIR/$APP_EXEC"
2004
2011
  LINK_OUTPUT_TMP="$LINK_OUTPUT.tmp.$$"
2005
2012
  LINK_SIGNATURE_FILE="$BUILD_DIR/link.sig"
@@ -2008,7 +2015,7 @@ LINK_SIGNATURE_TMP="$LINK_SIGNATURE_FILE.tmp.$$"
2008
2015
  printf 'compiler=%s\n' "$MACOS_COMPILER_VERSION"
2009
2016
  printf 'opt=%s\n' "$GEA_MACOS_OPT_LEVEL"
2010
2017
  printf 'debug=%s\n' "${GEA_MACOS_DEBUG_INFO:-}"
2011
- printf 'link=%s\n' -Wl,-no_deduplicate
2018
+ printf 'link=%s\n' "${MACOS_LINK_FLAGS[@]}"
2012
2019
  printf 'framework=%s\n' "${LINK_FRAMEWORKS[@]}"
2013
2020
  printf 'object=%s\n' "${OBJ_FILES[@]}"
2014
2021
  for library in ${APP_NATIVE_LIBRARIES[@]+"${APP_NATIVE_LIBRARIES[@]}"}; do shasum -a 256 "$library"; done
@@ -2035,7 +2042,7 @@ if (( LINK_NEEDED != 0 )); then
2035
2042
  # entry address (CallableObject::callWithReceiver finds a method's receiver
2036
2043
  # check by it), so a folded method template ran its twin's check.
2037
2044
  macos_run_tracked_child clang++ -std=c++20 -ObjC++ -fobjc-arc "$GEA_MACOS_OPT_LEVEL" ${GEA_MACOS_DEBUG_INFO} \
2038
- -Wl,-no_deduplicate \
2045
+ "${MACOS_LINK_FLAGS[@]}" \
2039
2046
  "${LINK_FRAMEWORKS[@]}" \
2040
2047
  "${OBJ_FILES[@]}" \
2041
2048
  ${APP_NATIVE_LIBRARIES[@]+"${APP_NATIVE_LIBRARIES[@]}"} \
@@ -12,6 +12,7 @@
12
12
  #include <memory>
13
13
  #include <mutex>
14
14
  #include <string>
15
+ #include <sys/stat.h>
15
16
  #include <unordered_map>
16
17
  #include <utility>
17
18
  #include <vector>
@@ -73,10 +74,21 @@ NSString *familyForId(int id)
73
74
  // the process lifetime: the rasterizer keeps stbtt_fontinfo pointers into
74
75
  // them across atlas rebuilds. Construct-on-first-use for the same dyld-
75
76
  // initializer-ordering reason as FamilyRegistry above.
77
+ using FontBytes = std::shared_ptr<const std::vector<std::uint8_t>>;
78
+ using FontNames = std::unordered_map<std::string, FontBytes>;
79
+
80
+ struct FontFile {
81
+ struct stat stamp;
82
+ FontBytes bytes;
83
+ };
84
+
76
85
  struct TtfByteRegistry {
77
86
  std::mutex lock;
78
- std::unordered_map<std::string, std::shared_ptr<const std::vector<std::uint8_t>>> byFamily;
79
- std::unordered_map<std::string, std::shared_ptr<const std::vector<std::uint8_t>>> byAlias;
87
+ FontNames byFamily;
88
+ FontNames byAlias;
89
+ FontNames documentFonts;
90
+ FontNames pendingFonts;
91
+ std::unordered_map<std::string, FontFile> files;
80
92
  };
81
93
 
82
94
  TtfByteRegistry &ttfByteRegistry()
@@ -94,19 +106,19 @@ std::string lowercased(const std::string &value)
94
106
 
95
107
  bool softwareTextMeasurement = false;
96
108
 
97
- void registerTtfBytesForFamily(NSString *path, NSArray<NSString *> *aliases)
109
+ bool registerTtfBytesForFamily(NSString *path, NSArray<NSString *> *aliases)
98
110
  {
99
111
  NSData *data = [NSData dataWithContentsOfFile:path];
100
- if (data.length == 0) return;
112
+ if (data.length == 0) return false;
101
113
  CTFontDescriptorRef desc = CTFontManagerCreateFontDescriptorFromData((__bridge CFDataRef)data);
102
- if (!desc) return;
114
+ if (!desc) return false;
103
115
  CFStringRef family = (CFStringRef)CTFontDescriptorCopyAttribute(desc, kCTFontFamilyNameAttribute);
104
116
  CFRelease(desc);
105
- if (!family) return;
117
+ if (!family) return false;
106
118
  char buf[256] = {0};
107
119
  const bool ok = CFStringGetCString(family, buf, sizeof(buf), kCFStringEncodingUTF8);
108
120
  CFRelease(family);
109
- if (!ok || !buf[0]) return;
121
+ if (!ok || !buf[0]) return false;
110
122
  const auto *bytes = static_cast<const std::uint8_t *>(data.bytes);
111
123
  TtfByteRegistry &registry = ttfByteRegistry();
112
124
  std::scoped_lock guard(registry.lock);
@@ -115,6 +127,7 @@ void registerTtfBytesForFamily(NSString *path, NSArray<NSString *> *aliases)
115
127
  auto font = std::make_shared<const std::vector<std::uint8_t>>(bytes, bytes + data.length);
116
128
  registry.byFamily.emplace(lowercased(buf), font);
117
129
  for (NSString *alias in aliases) registry.byAlias.emplace(alias.UTF8String, font);
130
+ return true;
118
131
  }
119
132
 
120
133
  } // namespace
@@ -129,9 +142,11 @@ const std::uint8_t *runtimeTtfBytesForFamilyId(int familyId, unsigned long *leng
129
142
  TtfByteRegistry &registry = ttfByteRegistry();
130
143
  std::scoped_lock guard(registry.lock);
131
144
  const auto key = lowercased(family.UTF8String);
145
+ const auto document = registry.documentFonts.find(key);
132
146
  const auto alias = registry.byAlias.find(key);
133
147
  const auto fallback = registry.byFamily.find(key);
134
- const auto *font = alias != registry.byAlias.end() ? alias->second.get()
148
+ const auto *font = document != registry.documentFonts.end() ? document->second.get()
149
+ : alias != registry.byAlias.end() ? alias->second.get()
135
150
  : fallback != registry.byFamily.end() ? fallback->second.get() : nullptr;
136
151
  if (!font) return nullptr;
137
152
  if (length) *length = font->size();
@@ -240,6 +255,58 @@ int registerCustomTtfDirectory(NSString *directoryPath)
240
255
  return count;
241
256
  }
242
257
 
258
+ extern "C" void gea_macos_begin_runtime_fonts()
259
+ {
260
+ auto &registry = ttfByteRegistry();
261
+ std::scoped_lock guard(registry.lock);
262
+ registry.pendingFonts.clear();
263
+ }
264
+
265
+ extern "C" bool gea_macos_register_runtime_font(const char *path, const char *family)
266
+ {
267
+ struct stat stamp{};
268
+ if (!family || !*family || stat(path, &stamp) != 0 || !S_ISREG(stamp.st_mode) ||
269
+ stamp.st_size <= 0 || stamp.st_size > 16 * 1024 * 1024) return false;
270
+ auto &registry = ttfByteRegistry();
271
+ std::scoped_lock guard(registry.lock);
272
+ const auto existing = registry.files.find(path);
273
+ FontBytes bytes;
274
+ if (existing != registry.files.end()) {
275
+ const auto &old = existing->second.stamp;
276
+ if (old.st_dev == stamp.st_dev && old.st_ino == stamp.st_ino &&
277
+ old.st_size == stamp.st_size && old.st_ctimespec.tv_sec == stamp.st_ctimespec.tv_sec &&
278
+ old.st_ctimespec.tv_nsec == stamp.st_ctimespec.tv_nsec) {
279
+ bytes = existing->second.bytes;
280
+ }
281
+ }
282
+ if (!bytes) {
283
+ NSString *filename = [NSString stringWithUTF8String:path];
284
+ NSData *data = filename ? [NSData dataWithContentsOfFile:filename] : nil;
285
+ if (data.length != static_cast<NSUInteger>(stamp.st_size)) return false;
286
+ CTFontDescriptorRef descriptor = CTFontManagerCreateFontDescriptorFromData((__bridge CFDataRef)data);
287
+ if (!descriptor) return false;
288
+ CFRelease(descriptor);
289
+ const auto *begin = static_cast<const std::uint8_t *>(data.bytes);
290
+ bytes = std::make_shared<const std::vector<std::uint8_t>>(begin, begin + data.length);
291
+ if (registry.files.size() >= 32) registry.files.clear();
292
+ registry.files.insert_or_assign(path, FontFile{stamp, bytes});
293
+ }
294
+ registry.pendingFonts.emplace(lowercased(family), bytes);
295
+ return true;
296
+ }
297
+
298
+ extern "C" void gea_macos_commit_runtime_fonts()
299
+ {
300
+ auto &registry = ttfByteRegistry();
301
+ std::scoped_lock guard(registry.lock);
302
+ if (registry.documentFonts != registry.pendingFonts) {
303
+ // The old tree is gone. Release glyph slots before dropping their byte buffers.
304
+ gea::framework::graphics::FontRegistry::invalidateRuntimeFonts();
305
+ registry.documentFonts.swap(registry.pendingFonts);
306
+ }
307
+ registry.pendingFonts.clear();
308
+ }
309
+
243
310
  } // namespace gea::macos
244
311
 
245
312
  // Strong overrides of the framework's weak font-lookup hooks for the AppKit
@@ -75,11 +75,20 @@ void submit_full_frame()
75
75
 
76
76
  bool gea_macos_prepare_prerender(int width, int height)
77
77
  {
78
- g_canvas_w = width;
79
- g_canvas_h = height;
78
+ if (!g_framebuffer || width != g_canvas_w || height != g_canvas_h) {
79
+ auto *pixels = static_cast<gea::framework::graphics::pixel::native_t *>(
80
+ std::calloc(static_cast<size_t>(width) * height, sizeof(*g_framebuffer)));
81
+ if (!pixels) return false;
82
+ std::free(g_framebuffer);
83
+ g_framebuffer = pixels;
84
+ g_canvas_w = width;
85
+ g_canvas_h = height;
86
+ }
80
87
  g_prerender = true;
81
- ensure_canvas();
82
- return g_framebuffer != nullptr;
88
+ g_canvas.bindPixels(g_framebuffer, width, height);
89
+ g_canvas.setGlobalAlpha(255);
90
+ g_canvas.clear(0);
91
+ return true;
83
92
  }
84
93
 
85
94
  bool gea_macos_write_prerender_png(NSString *path)
@@ -46,6 +46,10 @@ namespace gea::macos { void installWifiDriver(); int nodeIdForView(NSView *view)
46
46
  #include "css/declarative.h"
47
47
  #include "css/engine.h"
48
48
  #include "display.h"
49
+ #if __has_include("platform/prerender_video.h")
50
+ #include "platform/prerender_video.h"
51
+ #define GEA_MACOS_PRERENDER_VIDEO 1
52
+ #endif
49
53
  #include "platform/file_cache.h"
50
54
  #if __has_include("resident_apps.h")
51
55
  #include "resident_apps.h"
@@ -66,6 +70,10 @@ namespace gea::macos { void installWifiDriver(); int nodeIdForView(NSView *view)
66
70
  #include <cstdio>
67
71
  #include <cstdlib>
68
72
  #include <cstring>
73
+ #include <exception>
74
+ #include <iostream>
75
+ #include <string>
76
+ #include <unistd.h>
69
77
  #include "gea_appkit_host.h"
70
78
 
71
79
  extern "C" int gea_embedded_now_ms(void);
@@ -1238,46 +1246,89 @@ void gea::apple::AppKit::setScrollDocumentTopAligned(gea::apple::AppKit::NSScrol
1238
1246
  }
1239
1247
  #endif
1240
1248
 
1241
- static int prerender(int argc, const char *argv[])
1249
+ static bool validPrerenderViewport(int width, int height, double dpr)
1242
1250
  {
1243
- if (argc != 8) return 2;
1244
- const int width = std::atoi(argv[3]);
1245
- const int height = std::atoi(argv[4]);
1246
- const double dpr = std::atof(argv[5]);
1247
- const int fps = std::atoi(argv[6]);
1248
- const int targetMs = std::atoi(argv[7]);
1249
- if (width < 1 || width > 8192 || height < 1 || height > 8192 ||
1250
- !std::isfinite(dpr) || dpr < 0.1 || dpr > 8 ||
1251
- fps < 1 || fps > 1000 || targetMs < 0) return 2;
1252
- if (!gea_macos_prepare_prerender(width, height)) return 1;
1251
+ return width >= 1 && width <= 8192 && height >= 1 && height <= 8192 &&
1252
+ std::isfinite(dpr) && dpr >= 0.1 && dpr <= 8;
1253
+ }
1253
1254
 
1255
+ static void preparePrerenderHost()
1256
+ {
1254
1257
  NSString *fontsDir = [NSBundle.mainBundle.resourcePath stringByAppendingPathComponent:@"Fonts"];
1255
1258
  gea::macos::registerCustomTtfDirectory(fontsDir);
1256
1259
  gea::macos::useSoftwareTextMeasurement();
1257
1260
  gea::platform::storage::setMountProvider(+[]() { return true; });
1261
+ }
1258
1262
 
1263
+ static bool loadPrerenderPage(int width, int height, double dpr)
1264
+ {
1265
+ if (!gea_macos_prepare_prerender(width, height)) return false;
1259
1266
  gea_macos_set_prerender_time(0);
1260
1267
  // Seed the timer scheduler before app initialization schedules any timers.
1268
+ gea::host::resetAnimationFrameCallbacks();
1269
+ gea::host::resetScheduledTimers();
1261
1270
  gea::host::runAnimationFrameCallbacks(0);
1262
1271
  gea::framework::app::Application::init(width, height, dpr);
1263
- auto &tree = gea::embedded::ui::Tree::instance();
1264
- if (tree.mountedRoot() < 0) {
1265
- std::fputs("Gea prerender requires a mounted UI tree\n", stderr);
1266
- return 1;
1267
- }
1272
+ if (gea::embedded::ui::Tree::instance().mountedRoot() < 0) return false;
1268
1273
  gea::css::DeclarativeAnimations::scanAndStart(0);
1274
+ return true;
1275
+ }
1269
1276
 
1277
+ static void paintPrerenderFrame(int timeMs)
1278
+ {
1279
+ @autoreleasepool {
1280
+ gea_macos_set_prerender_time(timeMs);
1281
+ gea::embedded::ui::StyleSheet::instance().startCssAnimations(timeMs);
1282
+ gea::css::AnimationEngine::instance().tick(static_cast<std::uint32_t>(timeMs));
1283
+ gea::framework::app::Application::frame(timeMs);
1284
+ }
1285
+ }
1286
+
1287
+ static void drawPrerenderFrames(int fps, int targetMs)
1288
+ {
1270
1289
  for (std::int64_t frame = 0; ; ++frame) {
1271
1290
  const auto tickMs = (frame * 1000 + fps / 2) / fps;
1272
1291
  const int timeMs = static_cast<int>(std::min<std::int64_t>(tickMs, targetMs));
1273
- @autoreleasepool {
1274
- gea_macos_set_prerender_time(timeMs);
1275
- gea::embedded::ui::StyleSheet::instance().startCssAnimations(timeMs);
1276
- gea::css::AnimationEngine::instance().tick(static_cast<std::uint32_t>(timeMs));
1277
- gea::framework::app::Application::frame(timeMs);
1278
- }
1292
+ paintPrerenderFrame(timeMs);
1279
1293
  if (timeMs == targetMs) break;
1280
1294
  }
1295
+ }
1296
+
1297
+ static int prerender(int argc, const char *argv[])
1298
+ {
1299
+ const bool video = std::strcmp(argv[1], "--gea-prerender-video") == 0;
1300
+ if (argc != (video ? 9 : 8)) return 2;
1301
+ const int width = std::atoi(argv[3]);
1302
+ const int height = std::atoi(argv[4]);
1303
+ const double dpr = std::atof(argv[5]);
1304
+ const int fps = std::atoi(argv[6]);
1305
+ const int targetMs = std::atoi(argv[7]);
1306
+ if (!validPrerenderViewport(width, height, dpr) || fps < 1 || fps > 1000 || targetMs < 0) return 2;
1307
+ try {
1308
+ if (video) {
1309
+ #if defined(GEA_MACOS_PRERENDER_VIDEO)
1310
+ const int endMs = std::atoi(argv[8]);
1311
+ if (endMs <= targetMs) return 2;
1312
+ gea::platform::prerender::VideoFrames stream(width, height);
1313
+ gea::platform::prerender::VideoClock clock(fps);
1314
+ preparePrerenderHost();
1315
+ if (!loadPrerenderPage(width, height, dpr)) throw std::runtime_error("Could not mount the page");
1316
+ gea::platform::prerender::streamVideoFrames(stream, fps, targetMs, endMs, paintPrerenderFrame);
1317
+ return 0;
1318
+ #else
1319
+ throw std::runtime_error("The installed @geastack/core lacks native video export");
1320
+ #endif
1321
+ }
1322
+ preparePrerenderHost();
1323
+ if (!loadPrerenderPage(width, height, dpr)) {
1324
+ std::fputs("Gea prerender could not mount the page\n", stderr);
1325
+ return 1;
1326
+ }
1327
+ drawPrerenderFrames(fps, targetMs);
1328
+ } catch (const std::exception &error) {
1329
+ std::fprintf(stderr, "%s\n", error.what());
1330
+ return 1;
1331
+ }
1281
1332
  if (!gea_macos_write_prerender_png([NSString stringWithUTF8String:argv[2]])) {
1282
1333
  std::fprintf(stderr, "Could not write PNG to %s\n", argv[2]);
1283
1334
  return 1;
@@ -1285,11 +1336,102 @@ static int prerender(int argc, const char *argv[])
1285
1336
  return 0;
1286
1337
  }
1287
1338
 
1339
+ static bool writePrerenderReply(FILE *stream, NSDictionary *reply)
1340
+ {
1341
+ NSData *encoded = [NSJSONSerialization dataWithJSONObject:reply options:0 error:nil];
1342
+ return encoded && std::fwrite(encoded.bytes, 1, encoded.length, stream) == encoded.length &&
1343
+ std::fputc('\n', stream) != EOF && std::fflush(stream) == 0;
1344
+ }
1345
+
1346
+ static int prerenderWorker()
1347
+ {
1348
+ // Reserve stdout for the request protocol. Engine diagnostics use stderr.
1349
+ const int protocolFd = dup(STDOUT_FILENO);
1350
+ if (protocolFd < 0) return 1;
1351
+ FILE *protocol = fdopen(protocolFd, "w");
1352
+ if (!protocol) {
1353
+ close(protocolFd);
1354
+ return 1;
1355
+ }
1356
+ if (dup2(STDERR_FILENO, STDOUT_FILENO) < 0) {
1357
+ std::fclose(protocol);
1358
+ return 1;
1359
+ }
1360
+
1361
+ preparePrerenderHost();
1362
+ std::string mountedInput;
1363
+ int mountedWidth = 0, mountedHeight = 0;
1364
+ double mountedDpr = 0;
1365
+ std::string line;
1366
+ bool connected = true;
1367
+ while (connected && std::getline(std::cin, line)) {
1368
+ @autoreleasepool {
1369
+ NSData *data = [NSData dataWithBytes:line.data() length:line.size()];
1370
+ id decoded = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
1371
+ NSDictionary *request = [decoded isKindOfClass:NSDictionary.class] ? decoded : nil;
1372
+ NSString *input = request[@"input"];
1373
+ NSString *output = request[@"out"];
1374
+ NSNumber *widthNumber = request[@"width"] ?: @480;
1375
+ NSNumber *heightNumber = request[@"height"] ?: @220;
1376
+ NSNumber *dprNumber = request[@"dpr"] ?: @1;
1377
+ NSNumber *reuse = request[@"reusePage"] ?: @NO;
1378
+ if (![input isKindOfClass:NSString.class] || input.length == 0 ||
1379
+ ![output isKindOfClass:NSString.class] || output.length == 0 ||
1380
+ ![widthNumber isKindOfClass:NSNumber.class] ||
1381
+ ![heightNumber isKindOfClass:NSNumber.class] ||
1382
+ ![dprNumber isKindOfClass:NSNumber.class] ||
1383
+ ![reuse isKindOfClass:NSNumber.class] ||
1384
+ widthNumber.doubleValue != widthNumber.intValue ||
1385
+ heightNumber.doubleValue != heightNumber.intValue ||
1386
+ !validPrerenderViewport(widthNumber.intValue, heightNumber.intValue, dprNumber.doubleValue)) {
1387
+ connected = writePrerenderReply(protocol, @{@"ok": @NO, @"error": @"Invalid capture request"});
1388
+ continue;
1389
+ }
1390
+
1391
+ const int width = widthNumber.intValue, height = heightNumber.intValue;
1392
+ const double dpr = dprNumber.doubleValue;
1393
+ const bool reusePage = reuse.boolValue && mountedInput == input.UTF8String &&
1394
+ mountedWidth == width && mountedHeight == height && mountedDpr == dpr;
1395
+ const auto started = std::chrono::steady_clock::now();
1396
+ try {
1397
+ if (!reusePage) {
1398
+ mountedInput.clear();
1399
+ if (setenv("GEA_PRERENDER_INPUT", input.fileSystemRepresentation, 1) != 0 ||
1400
+ !loadPrerenderPage(width, height, dpr)) {
1401
+ connected = writePrerenderReply(protocol, @{@"ok": @NO, @"error": @"Could not mount the page"});
1402
+ continue;
1403
+ }
1404
+ drawPrerenderFrames(60, 0);
1405
+ mountedInput = input.UTF8String;
1406
+ mountedWidth = width;
1407
+ mountedHeight = height;
1408
+ mountedDpr = dpr;
1409
+ }
1410
+ if (!gea_macos_write_prerender_png(output)) {
1411
+ connected = writePrerenderReply(protocol, @{@"ok": @NO, @"error": @"Could not write the PNG"});
1412
+ continue;
1413
+ }
1414
+ const double ms = std::chrono::duration<double, std::milli>(
1415
+ std::chrono::steady_clock::now() - started).count();
1416
+ connected = writePrerenderReply(protocol, @{@"ok": @YES, @"ms": @(ms), @"reusedPage": @(reusePage)});
1417
+ } catch (const std::exception &error) {
1418
+ mountedInput.clear();
1419
+ NSString *message = [NSString stringWithUTF8String:error.what()] ?: @"Capture failed";
1420
+ connected = writePrerenderReply(protocol, @{@"ok": @NO, @"error": message});
1421
+ }
1422
+ }
1423
+ }
1424
+ std::fclose(protocol);
1425
+ return connected ? 0 : 1;
1426
+ }
1427
+
1288
1428
  int main(int argc, const char *argv[])
1289
1429
  {
1290
1430
  GeaNativeTerminationGuard terminationGuard;
1291
1431
  @autoreleasepool {
1292
- if (argc > 1 && std::strcmp(argv[1], "--gea-prerender") == 0) return prerender(argc, argv);
1432
+ if (argc > 1 && (std::strcmp(argv[1], "--gea-prerender") == 0 ||
1433
+ std::strcmp(argv[1], "--gea-prerender-video") == 0)) return prerender(argc, argv);
1434
+ if (argc == 2 && std::strcmp(argv[1], "--gea-prerender-worker") == 0) return prerenderWorker();
1293
1435
  gea_macos_smoke_log("[gea-macos] main entered");
1294
1436
  const bool backgroundTest = gea::macos::background_test::enabled();
1295
1437
  NSApplication *app = [NSApplication sharedApplication];