grandi 1.1.0 → 1.2.1

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.
@@ -0,0 +1,644 @@
1
+ //#region src/types.d.ts
2
+ declare enum FrameType {
3
+ Interlaced = 0,
4
+ Progressive = 1,
5
+ Field0 = 2,
6
+ Field1 = 3,
7
+ }
8
+ declare enum ColorFormat {
9
+ BGRX_BGRA = 0,
10
+ UYVY_BGRA = 1,
11
+ RGBX_RGBA = 2,
12
+ UYVY_RGBA = 3,
13
+ Fastest = 100,
14
+ Best = 101,
15
+ BGRX_BGRA_FLIPPED = 1000,
16
+ }
17
+ declare enum AudioFormat {
18
+ Float32Separate = 0,
19
+ Float32Interleaved = 1,
20
+ Int16Interleaved = 2,
21
+ }
22
+ declare enum Bandwidth {
23
+ MetadataOnly = -10,
24
+ AudioOnly = 10,
25
+ Lowest = 0,
26
+ Highest = 100,
27
+ }
28
+ declare enum FourCC {
29
+ UYVY = 1498831189,
30
+ UYVA = 1096178005,
31
+ P216 = 909193808,
32
+ PA16 = 909197648,
33
+ YV12 = 842094169,
34
+ I420 = 808596553,
35
+ NV12 = 842094158,
36
+ BGRA = 1095911234,
37
+ BGRX = 1481787202,
38
+ RGBA = 1094862674,
39
+ RGBX = 1480738642,
40
+ FLTp = 1884572742,
41
+ }
42
+ type PtpTimestamp = [number, number];
43
+ type Timecode = bigint | number | PtpTimestamp;
44
+ interface Source {
45
+ name: string;
46
+ urlAddress?: string;
47
+ }
48
+ interface VideoFrame {
49
+ type?: "video";
50
+ xres: number;
51
+ yres: number;
52
+ frameRateN: number;
53
+ frameRateD: number;
54
+ pictureAspectRatio: number;
55
+ fourCC: FourCC;
56
+ frameFormatType: FrameType;
57
+ lineStrideBytes: number;
58
+ data: Buffer;
59
+ timecode?: Timecode;
60
+ /**
61
+ * Receive-only timestamp filled by the NDI SDK (UTC time, 100ns units under the hood).
62
+ * NDI ignores this field when sending.
63
+ */
64
+ timestamp?: PtpTimestamp;
65
+ metadata?: string;
66
+ }
67
+ interface ReceivedVideoFrame extends VideoFrame {
68
+ type: "video";
69
+ timecode: PtpTimestamp;
70
+ timestamp: PtpTimestamp;
71
+ metadata?: string;
72
+ }
73
+ interface AudioFrame {
74
+ type?: "audio";
75
+ sampleRate: number;
76
+ noChannels: number;
77
+ noSamples: number;
78
+ channelStrideBytes: number;
79
+ data: Buffer;
80
+ fourCC: FourCC;
81
+ timecode?: Timecode;
82
+ /**
83
+ * Receive-only timestamp filled by the NDI SDK (UTC time, 100ns units under the hood).
84
+ * NDI ignores this field when sending.
85
+ */
86
+ timestamp?: PtpTimestamp;
87
+ metadata?: string;
88
+ }
89
+ interface ReceivedAudioFrame {
90
+ type: "audio";
91
+ audioFormat: AudioFormat;
92
+ referenceLevel?: number;
93
+ sampleRate: number;
94
+ channels: number;
95
+ samples: number;
96
+ channelStrideInBytes: number;
97
+ data: Buffer;
98
+ timecode: PtpTimestamp;
99
+ timestamp: PtpTimestamp;
100
+ metadata?: string;
101
+ }
102
+ interface ReceivedMetadataFrame {
103
+ type: "metadata";
104
+ length: number;
105
+ timecode: PtpTimestamp;
106
+ timestamp: PtpTimestamp;
107
+ data: string;
108
+ }
109
+ interface SourceChangeEvent {
110
+ type: "sourceChange";
111
+ }
112
+ interface StatusChangeEvent {
113
+ type: "statusChange";
114
+ }
115
+ interface TimeoutEvent {
116
+ type: "timeout";
117
+ }
118
+ type ReceiverDataFrame = ReceivedVideoFrame | ReceivedAudioFrame | ReceivedMetadataFrame | SourceChangeEvent | StatusChangeEvent | TimeoutEvent;
119
+ interface AudioReceiveOptions {
120
+ audioFormat?: AudioFormat;
121
+ referenceLevel?: number;
122
+ }
123
+ interface Receiver {
124
+ embedded: unknown;
125
+ source: Source;
126
+ colorFormat: ColorFormat;
127
+ bandwidth: Bandwidth;
128
+ allowVideoFields: boolean;
129
+ name?: string;
130
+ video(timeoutMs?: number): Promise<ReceivedVideoFrame>;
131
+ audio(timeoutMs?: number): Promise<ReceivedAudioFrame>;
132
+ audio(options: AudioReceiveOptions, timeoutMs?: number): Promise<ReceivedAudioFrame>;
133
+ metadata(timeoutMs?: number): Promise<ReceivedMetadataFrame>;
134
+ data(timeoutMs?: number): Promise<ReceiverDataFrame>;
135
+ data(options: AudioReceiveOptions, timeoutMs?: number): Promise<ReceiverDataFrame>;
136
+ tally(state: ReceiverTallyState): boolean;
137
+ destroy(): boolean;
138
+ }
139
+ interface ReceiverTallyState {
140
+ onProgram?: boolean;
141
+ onPreview?: boolean;
142
+ }
143
+ interface SenderTally {
144
+ changed: boolean;
145
+ on_program: boolean;
146
+ on_preview: boolean;
147
+ }
148
+ interface Sender {
149
+ embedded: unknown;
150
+ name: string;
151
+ groups?: string;
152
+ clockVideo: boolean;
153
+ clockAudio: boolean;
154
+ video(frame: VideoFrame): Promise<void>;
155
+ audio(frame: AudioFrame): Promise<void>;
156
+ connections(): number;
157
+ metadata(data: string): boolean;
158
+ tally(): SenderTally;
159
+ sourcename(): string;
160
+ destroy(): boolean;
161
+ }
162
+ interface Routing {
163
+ embedded: unknown;
164
+ name?: string;
165
+ groups?: string;
166
+ destroy(): boolean;
167
+ change(source: Source): boolean;
168
+ clear(): boolean;
169
+ connections(): number;
170
+ sourcename(): string;
171
+ }
172
+ interface FrameSyncAudioOptions {
173
+ sampleRate?: number;
174
+ noChannels?: number;
175
+ noSamples?: number;
176
+ }
177
+ interface FrameSync {
178
+ embedded: unknown;
179
+ /**
180
+ * Captures a video frame using NDI frame-synchronization (time base correction).
181
+ * Always returns immediately.
182
+ *
183
+ * If no video has ever been received, resolves with `{ type: "timeout" }`.
184
+ */
185
+ video(fieldType?: FrameType): Promise<ReceivedVideoFrame | TimeoutEvent>;
186
+ /**
187
+ * Captures audio using NDI frame-synchronization (resampled to match your calls).
188
+ * Always returns immediately and may insert silence if no audio is present.
189
+ */
190
+ audio(options?: FrameSyncAudioOptions): Promise<ReceivedAudioFrame>;
191
+ /**
192
+ * Returns an approximate depth of the internal audio queue in samples.
193
+ */
194
+ audioQueueDepth(): number;
195
+ destroy(): boolean;
196
+ }
197
+ interface Finder {
198
+ sources(): Source[];
199
+ wait(timeoutMs?: number): boolean;
200
+ destroy(): boolean;
201
+ }
202
+ interface FindOptions {
203
+ showLocalSources?: boolean;
204
+ groups?: string;
205
+ extraIPs?: string;
206
+ }
207
+ interface ReceiveOptions {
208
+ source: Source;
209
+ colorFormat?: ColorFormat;
210
+ bandwidth?: Bandwidth;
211
+ /**
212
+ * If `colorFormat` is `ColorFormat.Fastest` or `ColorFormat.Best`, the NDI SDK
213
+ * implicitly enables video fields and this option is forced to `true`.
214
+ */
215
+ allowVideoFields?: boolean;
216
+ name?: string;
217
+ }
218
+ interface SendOptions {
219
+ name: string;
220
+ groups?: string;
221
+ clockVideo?: boolean;
222
+ clockAudio?: boolean;
223
+ }
224
+ interface Grandi {
225
+ /**
226
+ * Gets the NDI SDK version string (e.g. `"NDI SDK 6.0.0.0"`).
227
+ * @returns The NDI SDK version string.
228
+ *
229
+ * @example
230
+ * ```js
231
+ * import grandi from "grandi";
232
+ * console.log(grandi.version());
233
+ * ```
234
+ */
235
+ version(): string;
236
+ /**
237
+ * Checks if the current CPU architecture is supported by NDI.
238
+ * @returns `true` when NDI is supported on this CPU/platform.
239
+ *
240
+ * @example
241
+ * ```js
242
+ * import grandi from "grandi";
243
+ * if (!grandi.isSupportedCPU()) throw new Error("NDI unsupported here");
244
+ * ```
245
+ */
246
+ isSupportedCPU(): boolean;
247
+ /**
248
+ * Initializes the NDI library. Must be called before using any other NDI functions.
249
+ * Call this once per process, before creating senders/receivers/finders.
250
+ * @returns `true` if initialization was successful.
251
+ *
252
+ * @example
253
+ * ```js
254
+ * import grandi from "grandi";
255
+ * if (!grandi.initialize()) throw new Error("NDI init failed");
256
+ * ```
257
+ */
258
+ initialize(): boolean;
259
+ /**
260
+ * Destroys the NDI library instance and cleans up resources.
261
+ * Should be called when done using NDI to free resources.
262
+ * @returns `true` if destruction was successful.
263
+ *
264
+ * @example
265
+ * ```js
266
+ * import grandi from "grandi";
267
+ * grandi.destroy();
268
+ * ```
269
+ */
270
+ destroy(): boolean;
271
+ /**
272
+ * Creates an NDI sender for transmitting video and audio over the network.
273
+ * @param params Sender options.
274
+ * @returns A promise that resolves to a Sender instance.
275
+ * @throws {Error} Promise rejects on unsupported platform/CPU or if sender creation fails.
276
+ *
277
+ * @example
278
+ * ```js
279
+ * import grandi from "grandi";
280
+ * grandi.initialize();
281
+ * const sender = await grandi.send({ name: "My Source" });
282
+ * ```
283
+ */
284
+ send(params: SendOptions): Promise<Sender>;
285
+ /**
286
+ * Creates an NDI receiver for receiving video and audio from an NDI source.
287
+ * @param params Receiver options.
288
+ * @returns A promise that resolves to a Receiver instance.
289
+ * @throws {Error} Promise rejects on unsupported platform/CPU or if receiver creation fails.
290
+ *
291
+ * @example
292
+ * ```js
293
+ * import grandi from "grandi";
294
+ * grandi.initialize();
295
+ * const finder = await grandi.find({ showLocalSources: true });
296
+ * finder.wait(1000);
297
+ * const source = finder.sources()[0];
298
+ * finder.destroy();
299
+ * const receiver = await grandi.receive({ source });
300
+ * const frame = await receiver.video(1000);
301
+ * receiver.destroy();
302
+ * ```
303
+ */
304
+ receive(params: ReceiveOptions): Promise<Receiver>;
305
+ /**
306
+ * Creates an NDI frame-synchronizer (time base corrector) backed by an existing receiver.
307
+ * Use this when you want smooth playback clocked to your own render/audio loop.
308
+ *
309
+ * Note: destroy the frame-sync before destroying the receiver.
310
+ */
311
+ framesync(receiver: Receiver): Promise<FrameSync>;
312
+ /**
313
+ * Creates an NDI router for switching between different NDI sources.
314
+ * @param params Router options.
315
+ * @returns A promise that resolves to a Routing instance.
316
+ * @throws {Error} Promise rejects on unsupported platform/CPU or if routing creation fails.
317
+ *
318
+ * @example
319
+ * ```js
320
+ * import grandi from "grandi";
321
+ * grandi.initialize();
322
+ * const router = await grandi.routing({ name: "My Router" });
323
+ * // router.change(source) to route a discovered source
324
+ * router.destroy();
325
+ * ```
326
+ */
327
+ routing(params: {
328
+ name?: string;
329
+ groups?: string;
330
+ }): Promise<Routing>;
331
+ /**
332
+ * Creates a finder to discover NDI sources on the network.
333
+ * @param params Discovery options.
334
+ * @returns A promise that resolves to a Finder instance.
335
+ * @throws {Error} Promise rejects on unsupported platform/CPU or if the finder cannot be created.
336
+ *
337
+ * @example
338
+ * ```js
339
+ * import grandi from "grandi";
340
+ * grandi.initialize();
341
+ * const finder = await grandi.find({ showLocalSources: true });
342
+ * finder.wait(1000);
343
+ * console.log(finder.sources());
344
+ * finder.destroy();
345
+ * ```
346
+ */
347
+ find(params?: FindOptions): Promise<Finder>;
348
+ /**
349
+ * Enum: receiver video color formats.
350
+ */
351
+ ColorFormat: typeof ColorFormat;
352
+ /**
353
+ * Enum: supported raw audio formats for helpers/receive conversions.
354
+ */
355
+ AudioFormat: typeof AudioFormat;
356
+ /**
357
+ * Enum: receiver bandwidth modes.
358
+ */
359
+ Bandwidth: typeof Bandwidth;
360
+ /**
361
+ * Enum: video frame format types (progressive/interlaced/fields).
362
+ */
363
+ FrameType: typeof FrameType;
364
+ /**
365
+ * Enum: FourCC pixel/audio formats used in frames.
366
+ */
367
+ FourCC: typeof FourCC;
368
+ /**
369
+ * Alias of `ColorFormat.BGRX_BGRA`.
370
+ */
371
+ COLOR_FORMAT_BGRX_BGRA: ColorFormat;
372
+ /**
373
+ * Alias of `ColorFormat.UYVY_BGRA`.
374
+ */
375
+ COLOR_FORMAT_UYVY_BGRA: ColorFormat;
376
+ /**
377
+ * Alias of `ColorFormat.RGBX_RGBA`.
378
+ */
379
+ COLOR_FORMAT_RGBX_RGBA: ColorFormat;
380
+ /**
381
+ * Alias of `ColorFormat.UYVY_RGBA`.
382
+ */
383
+ COLOR_FORMAT_UYVY_RGBA: ColorFormat;
384
+ /**
385
+ * Alias of `ColorFormat.Fastest`.
386
+ */
387
+ COLOR_FORMAT_FASTEST: ColorFormat;
388
+ /**
389
+ * Alias of `ColorFormat.BGRX_BGRA_FLIPPED` (Windows-only).
390
+ */
391
+ COLOR_FORMAT_BGRX_BGRA_FLIPPED: ColorFormat;
392
+ /**
393
+ * Alias of `Bandwidth.MetadataOnly`.
394
+ */
395
+ BANDWIDTH_METADATA_ONLY: Bandwidth;
396
+ /**
397
+ * Alias of `Bandwidth.AudioOnly`.
398
+ */
399
+ BANDWIDTH_AUDIO_ONLY: Bandwidth;
400
+ /**
401
+ * Alias of `Bandwidth.Lowest`.
402
+ */
403
+ BANDWIDTH_LOWEST: Bandwidth;
404
+ /**
405
+ * Alias of `Bandwidth.Highest`.
406
+ */
407
+ BANDWIDTH_HIGHEST: Bandwidth;
408
+ /**
409
+ * Alias of `FrameType.Progressive`.
410
+ */
411
+ FORMAT_TYPE_PROGRESSIVE: FrameType;
412
+ /**
413
+ * Alias of `FrameType.Interlaced`.
414
+ */
415
+ FORMAT_TYPE_INTERLACED: FrameType;
416
+ /**
417
+ * Alias of `FrameType.Field0`.
418
+ */
419
+ FORMAT_TYPE_FIELD_0: FrameType;
420
+ /**
421
+ * Alias of `FrameType.Field1`.
422
+ */
423
+ FORMAT_TYPE_FIELD_1: FrameType;
424
+ /**
425
+ * Alias of `AudioFormat.Float32Separate`.
426
+ */
427
+ AUDIO_FORMAT_FLOAT_32_SEPARATE: AudioFormat;
428
+ /**
429
+ * Alias of `AudioFormat.Float32Interleaved`.
430
+ */
431
+ AUDIO_FORMAT_FLOAT_32_INTERLEAVED: AudioFormat;
432
+ /**
433
+ * Alias of `AudioFormat.Int16Interleaved`.
434
+ */
435
+ AUDIO_FORMAT_INT_16_INTERLEAVED: AudioFormat;
436
+ /**
437
+ * Alias of `FourCC.UYVY`.
438
+ */
439
+ FOURCC_UYVY: FourCC;
440
+ /**
441
+ * Alias of `FourCC.UYVA`.
442
+ */
443
+ FOURCC_UYVA: FourCC;
444
+ /**
445
+ * Alias of `FourCC.P216`.
446
+ */
447
+ FOURCC_P216: FourCC;
448
+ /**
449
+ * Alias of `FourCC.PA16`.
450
+ */
451
+ FOURCC_PA16: FourCC;
452
+ /**
453
+ * Alias of `FourCC.YV12`.
454
+ */
455
+ FOURCC_YV12: FourCC;
456
+ /**
457
+ * Alias of `FourCC.I420`.
458
+ */
459
+ FOURCC_I420: FourCC;
460
+ /**
461
+ * Alias of `FourCC.NV12`.
462
+ */
463
+ FOURCC_NV12: FourCC;
464
+ /**
465
+ * Alias of `FourCC.BGRA`.
466
+ */
467
+ FOURCC_BGRA: FourCC;
468
+ /**
469
+ * Alias of `FourCC.BGRX`.
470
+ */
471
+ FOURCC_BGRX: FourCC;
472
+ /**
473
+ * Alias of `FourCC.RGBA`.
474
+ */
475
+ FOURCC_RGBA: FourCC;
476
+ /**
477
+ * Alias of `FourCC.RGBX`.
478
+ */
479
+ FOURCC_RGBX: FourCC;
480
+ /**
481
+ * Alias of `FourCC.FLTp`.
482
+ */
483
+ FOURCC_FLTp: FourCC;
484
+ }
485
+ //#endregion
486
+ //#region src/index.d.ts
487
+ interface GrandiAddon {
488
+ version(): string;
489
+ isSupportedCPU(): boolean;
490
+ initialize(): boolean;
491
+ destroy(): boolean;
492
+ find(params?: FindOptions): Promise<Finder>;
493
+ receive(params: ReceiveOptions): Promise<Receiver>;
494
+ framesync(receiver: Receiver): Promise<FrameSync>;
495
+ send(params: SendOptions): Promise<Sender>;
496
+ routing(params: {
497
+ name?: string;
498
+ groups?: string;
499
+ }): Promise<Routing>;
500
+ }
501
+ /**
502
+ * Creates a finder to discover NDI sources on the network.
503
+ * @param {FindOptions} [params={}] - Options for finding sources.
504
+ * @param {boolean} [params.showLocalSources] - Whether to show local sources.
505
+ * @param {string} [params.groups] - Multicast groups to search in.
506
+ * @param {string} [params.extraIPs] - Additional IP addresses to search.
507
+ * @returns {Promise<Finder>} A promise that resolves to a Finder instance for discovering sources.
508
+ * @throws {Error} Promise rejects on unsupported platform/CPU or if the finder cannot be created.
509
+ *
510
+ * @example
511
+ * ```js
512
+ * import { find, initialize } from "grandi";
513
+ * initialize();
514
+ * const finder = await find({ showLocalSources: true });
515
+ * finder.wait(1000);
516
+ * console.log(finder.sources());
517
+ * finder.destroy();
518
+ * ```
519
+ */
520
+ declare function find(params?: FindOptions): Promise<Finder>;
521
+ /**
522
+ * Gets the version of the NDI SDK.
523
+ * @returns {string} The NDI SDK version string.
524
+ */
525
+ declare const version: () => string;
526
+ /**
527
+ * Checks if the current CPU architecture is supported by NDI.
528
+ * @returns {boolean} True if the CPU is supported, false otherwise.
529
+ */
530
+ declare const isSupportedCPU: () => boolean;
531
+ /**
532
+ * Initializes the NDI library. Must be called before using any other NDI functions.
533
+ * @returns {boolean} True if initialization was successful, false otherwise.
534
+ *
535
+ * @example
536
+ * ```js
537
+ * import { initialize } from "grandi";
538
+ * if (!initialize()) throw new Error("NDI init failed");
539
+ * ```
540
+ */
541
+ declare const initialize: () => boolean;
542
+ /**
543
+ * Destroys the NDI library instance and cleans up resources.
544
+ * Should be called when done using NDI to free resources.
545
+ * @returns {boolean} True if destruction was successful, false otherwise.
546
+ *
547
+ * @example
548
+ * ```js
549
+ * import { destroy } from "grandi";
550
+ * destroy();
551
+ * ```
552
+ */
553
+ declare const destroy: () => boolean;
554
+ /**
555
+ * Creates an NDI sender for transmitting video and audio over the network.
556
+ * @param {SendOptions} params - Options for creating the sender.
557
+ * @param {string} params.name - The name of the NDI source.
558
+ * @param {string} [params.groups] - Multicast groups to send to.
559
+ * @param {boolean} [params.clockVideo] - Whether to clock video frames.
560
+ * @param {boolean} [params.clockAudio] - Whether to clock audio frames.
561
+ * @returns {Promise<Sender>} A promise that resolves to a Sender instance for transmitting data.
562
+ * @throws {Error} Promise rejects on unsupported platform/CPU or if sender creation fails.
563
+ *
564
+ * @example
565
+ * ```js
566
+ * import { initialize, send } from "grandi";
567
+ * initialize();
568
+ * const sender = await send({ name: "My Source" });
569
+ * // sender.video(...) / sender.audio(...)
570
+ * sender.destroy();
571
+ * ```
572
+ */
573
+ declare const send: (params: SendOptions) => Promise<Sender>;
574
+ /**
575
+ * Creates an NDI receiver for receiving video and audio from an NDI source.
576
+ * @param {ReceiveOptions} params - Options for creating the receiver.
577
+ * @param {ReceiveOptions["source"]} params.source - The NDI source to connect to.
578
+ * @param {ReceiveOptions["colorFormat"]} [params.colorFormat] - The color format for received video.
579
+ * @param {ReceiveOptions["bandwidth"]} [params.bandwidth] - The bandwidth limitation for the connection.
580
+ * @param {boolean} [params.allowVideoFields] - Whether to allow video fields.
581
+ * @param {string} [params.name] - The name for the receiver.
582
+ * @returns {Promise<Receiver>} A promise that resolves to a Receiver instance for receiving data.
583
+ * @throws {Error} Promise rejects on unsupported platform/CPU or if receiver creation fails.
584
+ *
585
+ * @example
586
+ * ```js
587
+ * import { find, initialize, receive } from "grandi";
588
+ * initialize();
589
+ * const finder = await find({ showLocalSources: true });
590
+ * finder.wait(1000);
591
+ * const source = finder.sources()[0];
592
+ * finder.destroy();
593
+ * const receiver = await receive({ source });
594
+ * const frame = await receiver.video(1000);
595
+ * receiver.destroy();
596
+ * ```
597
+ */
598
+ declare const receive: (params: ReceiveOptions) => Promise<Receiver>;
599
+ /**
600
+ * Creates an NDI frame-synchronizer (time base corrector) backed by an existing receiver.
601
+ * Use this when you want smooth playback clocked to your own render/audio loop.
602
+ *
603
+ * Note: destroy the frame-sync before destroying the receiver.
604
+ * @param {Receiver} receiver - The receiver instance to frame-sync.
605
+ * @returns {Promise<FrameSync>} A promise that resolves to a FrameSync instance.
606
+ * @throws {Error} Promise rejects on unsupported platform/CPU or if framesync creation fails.
607
+ *
608
+ * @example
609
+ * ```js
610
+ * import grandi from "grandi";
611
+ * grandi.initialize();
612
+ * const receiver = await grandi.receive({ source });
613
+ * const fs = await grandi.framesync(receiver);
614
+ * const frame = await fs.video(grandi.FrameType.Progressive);
615
+ * fs.destroy();
616
+ * receiver.destroy();
617
+ * ```
618
+ */
619
+ declare const framesync: (receiver: Receiver) => Promise<FrameSync>;
620
+ /**
621
+ * Creates an NDI router for switching between different NDI sources.
622
+ * @param {Object} params - Options for creating the router.
623
+ * @param {string} [params.name] - The name for the router.
624
+ * @param {string} [params.groups] - Multicast groups for the router.
625
+ * @returns {Promise<Routing>} A promise that resolves to a Routing instance for source switching.
626
+ * @throws {Error} Promise rejects on unsupported platform/CPU or if routing creation fails.
627
+ *
628
+ * @example
629
+ * ```js
630
+ * import { initialize, routing } from "grandi";
631
+ * initialize();
632
+ * const router = await routing({ name: "My Router" });
633
+ * // router.change(source)
634
+ * router.destroy();
635
+ * ```
636
+ */
637
+ declare const routing: (params: {
638
+ name?: string;
639
+ groups?: string;
640
+ }) => Promise<Routing>;
641
+ declare const grandi: Grandi;
642
+ //#endregion
643
+ export { AudioFormat, type AudioFrame, type AudioReceiveOptions, Bandwidth, ColorFormat, type FindOptions, type Finder, FourCC, type FrameSync, type FrameSyncAudioOptions, FrameType, type Grandi, GrandiAddon, type PtpTimestamp, type ReceiveOptions, type ReceivedAudioFrame, type ReceivedMetadataFrame, type ReceivedVideoFrame, type ReceiverDataFrame, type ReceiverTallyState, type Routing, type Sender, type SenderTally, type Source, type SourceChangeEvent, type StatusChangeEvent, type Timecode, type TimeoutEvent, type VideoFrame, grandi as default, destroy, find, framesync, initialize, isSupportedCPU, receive, routing, send, version };
644
+ //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs ADDED
@@ -0,0 +1,332 @@
1
+ import { createRequire } from "node:module";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import nodeGypBuild from "node-gyp-build";
5
+
6
+ //#region rolldown:runtime
7
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
8
+
9
+ //#endregion
10
+ //#region node_modules/tsdown/esm-shims.js
11
+ const getFilename = () => fileURLToPath(import.meta.url);
12
+ const getDirname = () => path.dirname(getFilename());
13
+ const __dirname = /* @__PURE__ */ getDirname();
14
+
15
+ //#endregion
16
+ //#region src/types.ts
17
+ let FrameType = /* @__PURE__ */ function(FrameType$1) {
18
+ FrameType$1[FrameType$1["Interlaced"] = 0] = "Interlaced";
19
+ FrameType$1[FrameType$1["Progressive"] = 1] = "Progressive";
20
+ FrameType$1[FrameType$1["Field0"] = 2] = "Field0";
21
+ FrameType$1[FrameType$1["Field1"] = 3] = "Field1";
22
+ return FrameType$1;
23
+ }({});
24
+ let ColorFormat = /* @__PURE__ */ function(ColorFormat$1) {
25
+ ColorFormat$1[ColorFormat$1["BGRX_BGRA"] = 0] = "BGRX_BGRA";
26
+ ColorFormat$1[ColorFormat$1["UYVY_BGRA"] = 1] = "UYVY_BGRA";
27
+ ColorFormat$1[ColorFormat$1["RGBX_RGBA"] = 2] = "RGBX_RGBA";
28
+ ColorFormat$1[ColorFormat$1["UYVY_RGBA"] = 3] = "UYVY_RGBA";
29
+ ColorFormat$1[ColorFormat$1["Fastest"] = 100] = "Fastest";
30
+ ColorFormat$1[ColorFormat$1["Best"] = 101] = "Best";
31
+ ColorFormat$1[ColorFormat$1["BGRX_BGRA_FLIPPED"] = 1e3] = "BGRX_BGRA_FLIPPED";
32
+ return ColorFormat$1;
33
+ }({});
34
+ let AudioFormat = /* @__PURE__ */ function(AudioFormat$1) {
35
+ AudioFormat$1[AudioFormat$1["Float32Separate"] = 0] = "Float32Separate";
36
+ AudioFormat$1[AudioFormat$1["Float32Interleaved"] = 1] = "Float32Interleaved";
37
+ AudioFormat$1[AudioFormat$1["Int16Interleaved"] = 2] = "Int16Interleaved";
38
+ return AudioFormat$1;
39
+ }({});
40
+ let Bandwidth = /* @__PURE__ */ function(Bandwidth$1) {
41
+ Bandwidth$1[Bandwidth$1["MetadataOnly"] = -10] = "MetadataOnly";
42
+ Bandwidth$1[Bandwidth$1["AudioOnly"] = 10] = "AudioOnly";
43
+ Bandwidth$1[Bandwidth$1["Lowest"] = 0] = "Lowest";
44
+ Bandwidth$1[Bandwidth$1["Highest"] = 100] = "Highest";
45
+ return Bandwidth$1;
46
+ }({});
47
+ let FourCC = /* @__PURE__ */ function(FourCC$1) {
48
+ FourCC$1[FourCC$1["UYVY"] = 1498831189] = "UYVY";
49
+ FourCC$1[FourCC$1["UYVA"] = 1096178005] = "UYVA";
50
+ FourCC$1[FourCC$1["P216"] = 909193808] = "P216";
51
+ FourCC$1[FourCC$1["PA16"] = 909197648] = "PA16";
52
+ FourCC$1[FourCC$1["YV12"] = 842094169] = "YV12";
53
+ FourCC$1[FourCC$1["I420"] = 808596553] = "I420";
54
+ FourCC$1[FourCC$1["NV12"] = 842094158] = "NV12";
55
+ FourCC$1[FourCC$1["BGRA"] = 1095911234] = "BGRA";
56
+ FourCC$1[FourCC$1["BGRX"] = 1481787202] = "BGRX";
57
+ FourCC$1[FourCC$1["RGBA"] = 1094862674] = "RGBA";
58
+ FourCC$1[FourCC$1["RGBX"] = 1480738642] = "RGBX";
59
+ FourCC$1[FourCC$1["FLTp"] = 1884572742] = "FLTp";
60
+ return FourCC$1;
61
+ }({});
62
+
63
+ //#endregion
64
+ //#region src/index.ts
65
+ /**
66
+ * Checks if the current platform and architecture are supported by NDI.
67
+ * @returns {boolean} True if the platform is supported (darwin, linux, or win32 with ia32/x64), false otherwise.
68
+ */
69
+ function isSupportedPlatform() {
70
+ return process.platform === "darwin" || process.platform === "linux" || process.platform === "win32" && ["ia32", "x64"].includes(process.arch);
71
+ }
72
+ function tryRequireArchPackage() {
73
+ const archKey = `${process.platform}-${process.arch}`;
74
+ const pkg = {
75
+ "linux-x64": "@grandi/linux-x64",
76
+ "linux-arm64": "@grandi/linux-arm64",
77
+ "linux-arm": "@grandi/linux-armv7l",
78
+ "win32-x64": "@grandi/win32-x64",
79
+ "win32-ia32": "@grandi/win32-ia32",
80
+ "darwin-x64": "@grandi/darwin-universal",
81
+ "darwin-arm64": "@grandi/darwin-universal"
82
+ }[archKey];
83
+ if (!pkg) throw new Error(`Unsupported platform or architecture: ${archKey}`);
84
+ try {
85
+ return __require(pkg);
86
+ } catch {
87
+ throw new Error(`Failed to find prebuilt package for ${archKey}. Please ensure that the package "${pkg}" is installed`);
88
+ }
89
+ }
90
+ function loadAddon() {
91
+ const loadErrors = [];
92
+ if (!isSupportedPlatform()) {
93
+ console.error(`Unsupported platform or architecture: ${process.platform}-${process.arch}`);
94
+ return noopAddon;
95
+ }
96
+ try {
97
+ const localBinding = nodeGypBuild(path.join(__dirname, ".."));
98
+ if (localBinding) return localBinding;
99
+ } catch (err) {
100
+ loadErrors.push(err);
101
+ }
102
+ try {
103
+ const archAddon = tryRequireArchPackage();
104
+ if (archAddon) return archAddon;
105
+ } catch (err) {
106
+ loadErrors.push(err);
107
+ }
108
+ if (loadErrors.length > 0) {
109
+ const aggregateError = /* @__PURE__ */ new Error("Failed to load native addon:\n" + loadErrors.map((e, i) => ` [${i + 1}] ${e.message}`).join("\n"));
110
+ console.error(aggregateError);
111
+ }
112
+ return noopAddon;
113
+ }
114
+ const noopAddon = {
115
+ version() {
116
+ return "";
117
+ },
118
+ isSupportedCPU() {
119
+ return false;
120
+ },
121
+ initialize() {
122
+ return false;
123
+ },
124
+ destroy() {
125
+ return false;
126
+ },
127
+ send(_params) {
128
+ return Promise.reject(/* @__PURE__ */ new Error("Unsupported platform or CPU"));
129
+ },
130
+ receive(_params) {
131
+ return Promise.reject(/* @__PURE__ */ new Error("Unsupported platform or CPU"));
132
+ },
133
+ framesync(_receiver) {
134
+ return Promise.reject(/* @__PURE__ */ new Error("Unsupported platform or CPU"));
135
+ },
136
+ routing() {
137
+ return Promise.reject(/* @__PURE__ */ new Error("Unsupported platform or CPU"));
138
+ },
139
+ find(_params) {
140
+ return Promise.reject(/* @__PURE__ */ new Error("Unsupported platform or CPU"));
141
+ }
142
+ };
143
+ const addon = loadAddon();
144
+ /**
145
+ * Creates a finder to discover NDI sources on the network.
146
+ * @param {FindOptions} [params={}] - Options for finding sources.
147
+ * @param {boolean} [params.showLocalSources] - Whether to show local sources.
148
+ * @param {string} [params.groups] - Multicast groups to search in.
149
+ * @param {string} [params.extraIPs] - Additional IP addresses to search.
150
+ * @returns {Promise<Finder>} A promise that resolves to a Finder instance for discovering sources.
151
+ * @throws {Error} Promise rejects on unsupported platform/CPU or if the finder cannot be created.
152
+ *
153
+ * @example
154
+ * ```js
155
+ * import { find, initialize } from "grandi";
156
+ * initialize();
157
+ * const finder = await find({ showLocalSources: true });
158
+ * finder.wait(1000);
159
+ * console.log(finder.sources());
160
+ * finder.destroy();
161
+ * ```
162
+ */
163
+ function find(params = {}) {
164
+ return addon.find(params);
165
+ }
166
+ /**
167
+ * Gets the version of the NDI SDK.
168
+ * @returns {string} The NDI SDK version string.
169
+ */
170
+ const version = addon.version;
171
+ /**
172
+ * Checks if the current CPU architecture is supported by NDI.
173
+ * @returns {boolean} True if the CPU is supported, false otherwise.
174
+ */
175
+ const isSupportedCPU = addon.isSupportedCPU;
176
+ /**
177
+ * Initializes the NDI library. Must be called before using any other NDI functions.
178
+ * @returns {boolean} True if initialization was successful, false otherwise.
179
+ *
180
+ * @example
181
+ * ```js
182
+ * import { initialize } from "grandi";
183
+ * if (!initialize()) throw new Error("NDI init failed");
184
+ * ```
185
+ */
186
+ const initialize = addon.initialize;
187
+ /**
188
+ * Destroys the NDI library instance and cleans up resources.
189
+ * Should be called when done using NDI to free resources.
190
+ * @returns {boolean} True if destruction was successful, false otherwise.
191
+ *
192
+ * @example
193
+ * ```js
194
+ * import { destroy } from "grandi";
195
+ * destroy();
196
+ * ```
197
+ */
198
+ const destroy = addon.destroy;
199
+ /**
200
+ * Creates an NDI sender for transmitting video and audio over the network.
201
+ * @param {SendOptions} params - Options for creating the sender.
202
+ * @param {string} params.name - The name of the NDI source.
203
+ * @param {string} [params.groups] - Multicast groups to send to.
204
+ * @param {boolean} [params.clockVideo] - Whether to clock video frames.
205
+ * @param {boolean} [params.clockAudio] - Whether to clock audio frames.
206
+ * @returns {Promise<Sender>} A promise that resolves to a Sender instance for transmitting data.
207
+ * @throws {Error} Promise rejects on unsupported platform/CPU or if sender creation fails.
208
+ *
209
+ * @example
210
+ * ```js
211
+ * import { initialize, send } from "grandi";
212
+ * initialize();
213
+ * const sender = await send({ name: "My Source" });
214
+ * // sender.video(...) / sender.audio(...)
215
+ * sender.destroy();
216
+ * ```
217
+ */
218
+ const send = addon.send;
219
+ /**
220
+ * Creates an NDI receiver for receiving video and audio from an NDI source.
221
+ * @param {ReceiveOptions} params - Options for creating the receiver.
222
+ * @param {ReceiveOptions["source"]} params.source - The NDI source to connect to.
223
+ * @param {ReceiveOptions["colorFormat"]} [params.colorFormat] - The color format for received video.
224
+ * @param {ReceiveOptions["bandwidth"]} [params.bandwidth] - The bandwidth limitation for the connection.
225
+ * @param {boolean} [params.allowVideoFields] - Whether to allow video fields.
226
+ * @param {string} [params.name] - The name for the receiver.
227
+ * @returns {Promise<Receiver>} A promise that resolves to a Receiver instance for receiving data.
228
+ * @throws {Error} Promise rejects on unsupported platform/CPU or if receiver creation fails.
229
+ *
230
+ * @example
231
+ * ```js
232
+ * import { find, initialize, receive } from "grandi";
233
+ * initialize();
234
+ * const finder = await find({ showLocalSources: true });
235
+ * finder.wait(1000);
236
+ * const source = finder.sources()[0];
237
+ * finder.destroy();
238
+ * const receiver = await receive({ source });
239
+ * const frame = await receiver.video(1000);
240
+ * receiver.destroy();
241
+ * ```
242
+ */
243
+ const receive = addon.receive;
244
+ /**
245
+ * Creates an NDI frame-synchronizer (time base corrector) backed by an existing receiver.
246
+ * Use this when you want smooth playback clocked to your own render/audio loop.
247
+ *
248
+ * Note: destroy the frame-sync before destroying the receiver.
249
+ * @param {Receiver} receiver - The receiver instance to frame-sync.
250
+ * @returns {Promise<FrameSync>} A promise that resolves to a FrameSync instance.
251
+ * @throws {Error} Promise rejects on unsupported platform/CPU or if framesync creation fails.
252
+ *
253
+ * @example
254
+ * ```js
255
+ * import grandi from "grandi";
256
+ * grandi.initialize();
257
+ * const receiver = await grandi.receive({ source });
258
+ * const fs = await grandi.framesync(receiver);
259
+ * const frame = await fs.video(grandi.FrameType.Progressive);
260
+ * fs.destroy();
261
+ * receiver.destroy();
262
+ * ```
263
+ */
264
+ const framesync = addon.framesync;
265
+ /**
266
+ * Creates an NDI router for switching between different NDI sources.
267
+ * @param {Object} params - Options for creating the router.
268
+ * @param {string} [params.name] - The name for the router.
269
+ * @param {string} [params.groups] - Multicast groups for the router.
270
+ * @returns {Promise<Routing>} A promise that resolves to a Routing instance for source switching.
271
+ * @throws {Error} Promise rejects on unsupported platform/CPU or if routing creation fails.
272
+ *
273
+ * @example
274
+ * ```js
275
+ * import { initialize, routing } from "grandi";
276
+ * initialize();
277
+ * const router = await routing({ name: "My Router" });
278
+ * // router.change(source)
279
+ * router.destroy();
280
+ * ```
281
+ */
282
+ const routing = addon.routing;
283
+ const grandi = {
284
+ version,
285
+ isSupportedCPU,
286
+ initialize,
287
+ destroy,
288
+ send,
289
+ receive,
290
+ framesync,
291
+ routing,
292
+ find,
293
+ ColorFormat,
294
+ AudioFormat,
295
+ Bandwidth,
296
+ FrameType,
297
+ FourCC,
298
+ COLOR_FORMAT_BGRX_BGRA: ColorFormat.BGRX_BGRA,
299
+ COLOR_FORMAT_UYVY_BGRA: ColorFormat.UYVY_BGRA,
300
+ COLOR_FORMAT_RGBX_RGBA: ColorFormat.RGBX_RGBA,
301
+ COLOR_FORMAT_UYVY_RGBA: ColorFormat.UYVY_RGBA,
302
+ COLOR_FORMAT_FASTEST: ColorFormat.Fastest,
303
+ COLOR_FORMAT_BGRX_BGRA_FLIPPED: ColorFormat.BGRX_BGRA_FLIPPED,
304
+ BANDWIDTH_METADATA_ONLY: Bandwidth.MetadataOnly,
305
+ BANDWIDTH_AUDIO_ONLY: Bandwidth.AudioOnly,
306
+ BANDWIDTH_LOWEST: Bandwidth.Lowest,
307
+ BANDWIDTH_HIGHEST: Bandwidth.Highest,
308
+ FORMAT_TYPE_PROGRESSIVE: FrameType.Progressive,
309
+ FORMAT_TYPE_INTERLACED: FrameType.Interlaced,
310
+ FORMAT_TYPE_FIELD_0: FrameType.Field0,
311
+ FORMAT_TYPE_FIELD_1: FrameType.Field1,
312
+ AUDIO_FORMAT_FLOAT_32_SEPARATE: AudioFormat.Float32Separate,
313
+ AUDIO_FORMAT_FLOAT_32_INTERLEAVED: AudioFormat.Float32Interleaved,
314
+ AUDIO_FORMAT_INT_16_INTERLEAVED: AudioFormat.Int16Interleaved,
315
+ FOURCC_UYVY: FourCC.UYVY,
316
+ FOURCC_UYVA: FourCC.UYVA,
317
+ FOURCC_P216: FourCC.P216,
318
+ FOURCC_PA16: FourCC.PA16,
319
+ FOURCC_YV12: FourCC.YV12,
320
+ FOURCC_I420: FourCC.I420,
321
+ FOURCC_NV12: FourCC.NV12,
322
+ FOURCC_BGRA: FourCC.BGRA,
323
+ FOURCC_BGRX: FourCC.BGRX,
324
+ FOURCC_RGBA: FourCC.RGBA,
325
+ FOURCC_RGBX: FourCC.RGBX,
326
+ FOURCC_FLTp: FourCC.FLTp
327
+ };
328
+ var src_default = grandi;
329
+
330
+ //#endregion
331
+ export { AudioFormat, Bandwidth, ColorFormat, FourCC, FrameType, src_default as default, destroy, find, framesync, initialize, isSupportedCPU, receive, routing, send, version };
332
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["loadErrors: Error[]","noopAddon: GrandiAddon","addon: GrandiAddon","grandi: Grandi"],"sources":["../node_modules/tsdown/esm-shims.js","../src/types.ts","../src/index.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","export enum FrameType {\n\tInterlaced = 0,\n\tProgressive = 1,\n\tField0 = 2,\n\tField1 = 3,\n}\n\nexport enum ColorFormat {\n\tBGRX_BGRA = 0,\n\tUYVY_BGRA = 1,\n\tRGBX_RGBA = 2,\n\tUYVY_RGBA = 3,\n\tFastest = 100,\n\tBest = 101,\n\t// Windows-only NDI SDK extension: 1000 + BGRX_BGRA.\n\tBGRX_BGRA_FLIPPED = 1000,\n}\n\nexport enum AudioFormat {\n\tFloat32Separate = 0,\n\tFloat32Interleaved = 1,\n\tInt16Interleaved = 2,\n}\n\nexport enum Bandwidth {\n\tMetadataOnly = -10,\n\tAudioOnly = 10,\n\tLowest = 0,\n\tHighest = 100,\n}\n\nexport enum FourCC {\n\tUYVY = 1498831189,\n\tUYVA = 1096178005,\n\tP216 = 909193808,\n\tPA16 = 909197648,\n\tYV12 = 842094169,\n\tI420 = 808596553,\n\tNV12 = 842094158,\n\tBGRA = 1095911234,\n\tBGRX = 1481787202,\n\tRGBA = 1094862674,\n\tRGBX = 1480738642,\n\tFLTp = 1884572742,\n}\n\nexport type PtpTimestamp = [number, number]; // [seconds, nanoseconds]\nexport type Timecode = bigint | number | PtpTimestamp;\n\nexport interface Source {\n\tname: string;\n\turlAddress?: string;\n}\n\nexport interface VideoFrame {\n\ttype?: \"video\";\n\txres: number;\n\tyres: number;\n\tframeRateN: number;\n\tframeRateD: number;\n\tpictureAspectRatio: number;\n\tfourCC: FourCC;\n\tframeFormatType: FrameType;\n\tlineStrideBytes: number;\n\tdata: Buffer;\n\ttimecode?: Timecode;\n\t/**\n\t * Receive-only timestamp filled by the NDI SDK (UTC time, 100ns units under the hood).\n\t * NDI ignores this field when sending.\n\t */\n\ttimestamp?: PtpTimestamp;\n\tmetadata?: string;\n}\n\nexport interface ReceivedVideoFrame extends VideoFrame {\n\ttype: \"video\";\n\ttimecode: PtpTimestamp;\n\ttimestamp: PtpTimestamp;\n\tmetadata?: string;\n}\n\nexport interface AudioFrame {\n\ttype?: \"audio\";\n\tsampleRate: number;\n\tnoChannels: number;\n\tnoSamples: number;\n\tchannelStrideBytes: number;\n\tdata: Buffer;\n\tfourCC: FourCC;\n\ttimecode?: Timecode;\n\t/**\n\t * Receive-only timestamp filled by the NDI SDK (UTC time, 100ns units under the hood).\n\t * NDI ignores this field when sending.\n\t */\n\ttimestamp?: PtpTimestamp;\n\tmetadata?: string;\n}\n\nexport interface ReceivedAudioFrame {\n\ttype: \"audio\";\n\taudioFormat: AudioFormat;\n\treferenceLevel?: number;\n\tsampleRate: number;\n\tchannels: number;\n\tsamples: number;\n\tchannelStrideInBytes: number;\n\tdata: Buffer;\n\ttimecode: PtpTimestamp;\n\ttimestamp: PtpTimestamp;\n\tmetadata?: string;\n}\n\nexport interface ReceivedMetadataFrame {\n\ttype: \"metadata\";\n\tlength: number;\n\ttimecode: PtpTimestamp;\n\ttimestamp: PtpTimestamp;\n\tdata: string;\n}\n\nexport interface SourceChangeEvent {\n\ttype: \"sourceChange\";\n}\n\nexport interface StatusChangeEvent {\n\ttype: \"statusChange\";\n}\n\nexport interface TimeoutEvent {\n\ttype: \"timeout\";\n}\n\nexport type ReceiverDataFrame =\n\t| ReceivedVideoFrame\n\t| ReceivedAudioFrame\n\t| ReceivedMetadataFrame\n\t| SourceChangeEvent\n\t| StatusChangeEvent\n\t| TimeoutEvent;\n\nexport interface AudioReceiveOptions {\n\taudioFormat?: AudioFormat;\n\treferenceLevel?: number;\n}\n\nexport interface Receiver {\n\tembedded: unknown;\n\tsource: Source;\n\tcolorFormat: ColorFormat;\n\tbandwidth: Bandwidth;\n\tallowVideoFields: boolean;\n\tname?: string;\n\tvideo(timeoutMs?: number): Promise<ReceivedVideoFrame>;\n\taudio(timeoutMs?: number): Promise<ReceivedAudioFrame>;\n\taudio(\n\t\toptions: AudioReceiveOptions,\n\t\ttimeoutMs?: number,\n\t): Promise<ReceivedAudioFrame>;\n\tmetadata(timeoutMs?: number): Promise<ReceivedMetadataFrame>;\n\tdata(timeoutMs?: number): Promise<ReceiverDataFrame>;\n\tdata(\n\t\toptions: AudioReceiveOptions,\n\t\ttimeoutMs?: number,\n\t): Promise<ReceiverDataFrame>;\n\ttally(state: ReceiverTallyState): boolean;\n\tdestroy(): boolean;\n}\n\nexport interface ReceiverTallyState {\n\tonProgram?: boolean;\n\tonPreview?: boolean;\n}\n\nexport interface SenderTally {\n\tchanged: boolean;\n\ton_program: boolean;\n\ton_preview: boolean;\n}\n\nexport interface Sender {\n\tembedded: unknown;\n\tname: string;\n\tgroups?: string;\n\tclockVideo: boolean;\n\tclockAudio: boolean;\n\tvideo(frame: VideoFrame): Promise<void>;\n\taudio(frame: AudioFrame): Promise<void>;\n\tconnections(): number;\n\tmetadata(data: string): boolean;\n\ttally(): SenderTally;\n\tsourcename(): string;\n\tdestroy(): boolean;\n}\n\nexport interface Routing {\n\tembedded: unknown;\n\tname?: string;\n\tgroups?: string;\n\tdestroy(): boolean;\n\tchange(source: Source): boolean;\n\tclear(): boolean;\n\tconnections(): number;\n\tsourcename(): string;\n}\n\nexport interface FrameSyncAudioOptions {\n\tsampleRate?: number;\n\tnoChannels?: number;\n\tnoSamples?: number;\n}\n\nexport interface FrameSync {\n\tembedded: unknown;\n\t/**\n\t * Captures a video frame using NDI frame-synchronization (time base correction).\n\t * Always returns immediately.\n\t *\n\t * If no video has ever been received, resolves with `{ type: \"timeout\" }`.\n\t */\n\tvideo(fieldType?: FrameType): Promise<ReceivedVideoFrame | TimeoutEvent>;\n\t/**\n\t * Captures audio using NDI frame-synchronization (resampled to match your calls).\n\t * Always returns immediately and may insert silence if no audio is present.\n\t */\n\taudio(options?: FrameSyncAudioOptions): Promise<ReceivedAudioFrame>;\n\t/**\n\t * Returns an approximate depth of the internal audio queue in samples.\n\t */\n\taudioQueueDepth(): number;\n\tdestroy(): boolean;\n}\n\nexport interface Finder {\n\tsources(): Source[];\n\twait(timeoutMs?: number): boolean;\n\tdestroy(): boolean;\n}\n\nexport interface FindOptions {\n\tshowLocalSources?: boolean;\n\tgroups?: string;\n\textraIPs?: string;\n}\n\nexport interface ReceiveOptions {\n\tsource: Source;\n\tcolorFormat?: ColorFormat;\n\tbandwidth?: Bandwidth;\n\t/**\n\t * If `colorFormat` is `ColorFormat.Fastest` or `ColorFormat.Best`, the NDI SDK\n\t * implicitly enables video fields and this option is forced to `true`.\n\t */\n\tallowVideoFields?: boolean;\n\tname?: string;\n}\n\nexport interface SendOptions {\n\tname: string;\n\tgroups?: string;\n\tclockVideo?: boolean;\n\tclockAudio?: boolean;\n}\n\nexport interface Grandi {\n\t/**\n\t * Gets the NDI SDK version string (e.g. `\"NDI SDK 6.0.0.0\"`).\n\t * @returns The NDI SDK version string.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * console.log(grandi.version());\n\t * ```\n\t */\n\tversion(): string;\n\t/**\n\t * Checks if the current CPU architecture is supported by NDI.\n\t * @returns `true` when NDI is supported on this CPU/platform.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * if (!grandi.isSupportedCPU()) throw new Error(\"NDI unsupported here\");\n\t * ```\n\t */\n\tisSupportedCPU(): boolean;\n\t/**\n\t * Initializes the NDI library. Must be called before using any other NDI functions.\n\t * Call this once per process, before creating senders/receivers/finders.\n\t * @returns `true` if initialization was successful.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * if (!grandi.initialize()) throw new Error(\"NDI init failed\");\n\t * ```\n\t */\n\tinitialize(): boolean;\n\t/**\n\t * Destroys the NDI library instance and cleans up resources.\n\t * Should be called when done using NDI to free resources.\n\t * @returns `true` if destruction was successful.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.destroy();\n\t * ```\n\t */\n\tdestroy(): boolean;\n\t/**\n\t * Creates an NDI sender for transmitting video and audio over the network.\n\t * @param params Sender options.\n\t * @returns A promise that resolves to a Sender instance.\n\t * @throws {Error} Promise rejects on unsupported platform/CPU or if sender creation fails.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.initialize();\n\t * const sender = await grandi.send({ name: \"My Source\" });\n\t * ```\n\t */\n\tsend(params: SendOptions): Promise<Sender>;\n\t/**\n\t * Creates an NDI receiver for receiving video and audio from an NDI source.\n\t * @param params Receiver options.\n\t * @returns A promise that resolves to a Receiver instance.\n\t * @throws {Error} Promise rejects on unsupported platform/CPU or if receiver creation fails.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.initialize();\n\t * const finder = await grandi.find({ showLocalSources: true });\n\t * finder.wait(1000);\n\t * const source = finder.sources()[0];\n\t * finder.destroy();\n\t * const receiver = await grandi.receive({ source });\n\t * const frame = await receiver.video(1000);\n\t * receiver.destroy();\n\t * ```\n\t */\n\treceive(params: ReceiveOptions): Promise<Receiver>;\n\t/**\n\t * Creates an NDI frame-synchronizer (time base corrector) backed by an existing receiver.\n\t * Use this when you want smooth playback clocked to your own render/audio loop.\n\t *\n\t * Note: destroy the frame-sync before destroying the receiver.\n\t */\n\tframesync(receiver: Receiver): Promise<FrameSync>;\n\t/**\n\t * Creates an NDI router for switching between different NDI sources.\n\t * @param params Router options.\n\t * @returns A promise that resolves to a Routing instance.\n\t * @throws {Error} Promise rejects on unsupported platform/CPU or if routing creation fails.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.initialize();\n\t * const router = await grandi.routing({ name: \"My Router\" });\n\t * // router.change(source) to route a discovered source\n\t * router.destroy();\n\t * ```\n\t */\n\trouting(params: { name?: string; groups?: string }): Promise<Routing>;\n\t/**\n\t * Creates a finder to discover NDI sources on the network.\n\t * @param params Discovery options.\n\t * @returns A promise that resolves to a Finder instance.\n\t * @throws {Error} Promise rejects on unsupported platform/CPU or if the finder cannot be created.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.initialize();\n\t * const finder = await grandi.find({ showLocalSources: true });\n\t * finder.wait(1000);\n\t * console.log(finder.sources());\n\t * finder.destroy();\n\t * ```\n\t */\n\tfind(params?: FindOptions): Promise<Finder>;\n\n\t/**\n\t * Enum: receiver video color formats.\n\t */\n\tColorFormat: typeof ColorFormat;\n\t/**\n\t * Enum: supported raw audio formats for helpers/receive conversions.\n\t */\n\tAudioFormat: typeof AudioFormat;\n\t/**\n\t * Enum: receiver bandwidth modes.\n\t */\n\tBandwidth: typeof Bandwidth;\n\t/**\n\t * Enum: video frame format types (progressive/interlaced/fields).\n\t */\n\tFrameType: typeof FrameType;\n\t/**\n\t * Enum: FourCC pixel/audio formats used in frames.\n\t */\n\tFourCC: typeof FourCC;\n\n\t// Constant aliases for backwards compatibility / convenience.\n\t/**\n\t * Alias of `ColorFormat.BGRX_BGRA`.\n\t */\n\tCOLOR_FORMAT_BGRX_BGRA: ColorFormat;\n\t/**\n\t * Alias of `ColorFormat.UYVY_BGRA`.\n\t */\n\tCOLOR_FORMAT_UYVY_BGRA: ColorFormat;\n\t/**\n\t * Alias of `ColorFormat.RGBX_RGBA`.\n\t */\n\tCOLOR_FORMAT_RGBX_RGBA: ColorFormat;\n\t/**\n\t * Alias of `ColorFormat.UYVY_RGBA`.\n\t */\n\tCOLOR_FORMAT_UYVY_RGBA: ColorFormat;\n\t/**\n\t * Alias of `ColorFormat.Fastest`.\n\t */\n\tCOLOR_FORMAT_FASTEST: ColorFormat;\n\t/**\n\t * Alias of `ColorFormat.BGRX_BGRA_FLIPPED` (Windows-only).\n\t */\n\tCOLOR_FORMAT_BGRX_BGRA_FLIPPED: ColorFormat;\n\n\t/**\n\t * Alias of `Bandwidth.MetadataOnly`.\n\t */\n\tBANDWIDTH_METADATA_ONLY: Bandwidth;\n\t/**\n\t * Alias of `Bandwidth.AudioOnly`.\n\t */\n\tBANDWIDTH_AUDIO_ONLY: Bandwidth;\n\t/**\n\t * Alias of `Bandwidth.Lowest`.\n\t */\n\tBANDWIDTH_LOWEST: Bandwidth;\n\t/**\n\t * Alias of `Bandwidth.Highest`.\n\t */\n\tBANDWIDTH_HIGHEST: Bandwidth;\n\n\t/**\n\t * Alias of `FrameType.Progressive`.\n\t */\n\tFORMAT_TYPE_PROGRESSIVE: FrameType;\n\t/**\n\t * Alias of `FrameType.Interlaced`.\n\t */\n\tFORMAT_TYPE_INTERLACED: FrameType;\n\t/**\n\t * Alias of `FrameType.Field0`.\n\t */\n\tFORMAT_TYPE_FIELD_0: FrameType;\n\t/**\n\t * Alias of `FrameType.Field1`.\n\t */\n\tFORMAT_TYPE_FIELD_1: FrameType;\n\n\t/**\n\t * Alias of `AudioFormat.Float32Separate`.\n\t */\n\tAUDIO_FORMAT_FLOAT_32_SEPARATE: AudioFormat;\n\t/**\n\t * Alias of `AudioFormat.Float32Interleaved`.\n\t */\n\tAUDIO_FORMAT_FLOAT_32_INTERLEAVED: AudioFormat;\n\t/**\n\t * Alias of `AudioFormat.Int16Interleaved`.\n\t */\n\tAUDIO_FORMAT_INT_16_INTERLEAVED: AudioFormat;\n\n\t/**\n\t * Alias of `FourCC.UYVY`.\n\t */\n\tFOURCC_UYVY: FourCC;\n\t/**\n\t * Alias of `FourCC.UYVA`.\n\t */\n\tFOURCC_UYVA: FourCC;\n\t/**\n\t * Alias of `FourCC.P216`.\n\t */\n\tFOURCC_P216: FourCC;\n\t/**\n\t * Alias of `FourCC.PA16`.\n\t */\n\tFOURCC_PA16: FourCC;\n\t/**\n\t * Alias of `FourCC.YV12`.\n\t */\n\tFOURCC_YV12: FourCC;\n\t/**\n\t * Alias of `FourCC.I420`.\n\t */\n\tFOURCC_I420: FourCC;\n\t/**\n\t * Alias of `FourCC.NV12`.\n\t */\n\tFOURCC_NV12: FourCC;\n\t/**\n\t * Alias of `FourCC.BGRA`.\n\t */\n\tFOURCC_BGRA: FourCC;\n\t/**\n\t * Alias of `FourCC.BGRX`.\n\t */\n\tFOURCC_BGRX: FourCC;\n\t/**\n\t * Alias of `FourCC.RGBA`.\n\t */\n\tFOURCC_RGBA: FourCC;\n\t/**\n\t * Alias of `FourCC.RGBX`.\n\t */\n\tFOURCC_RGBX: FourCC;\n\t/**\n\t * Alias of `FourCC.FLTp`.\n\t */\n\tFOURCC_FLTp: FourCC;\n}\n","import path from \"node:path\";\nimport nodeGypBuild from \"node-gyp-build\";\n\nimport type {\n\tFinder,\n\tFindOptions,\n\tFrameSync,\n\tGrandi,\n\tReceiveOptions,\n\tReceiver,\n\tRouting,\n\tSender,\n\tSendOptions,\n} from \"./types\";\nimport {\n\tAudioFormat,\n\tBandwidth,\n\tColorFormat,\n\tFourCC,\n\tFrameType,\n} from \"./types\";\n\n/**\n * Checks if the current platform and architecture are supported by NDI.\n * @returns {boolean} True if the platform is supported (darwin, linux, or win32 with ia32/x64), false otherwise.\n */\nfunction isSupportedPlatform(): boolean {\n\treturn (\n\t\tprocess.platform === \"darwin\" ||\n\t\tprocess.platform === \"linux\" ||\n\t\t(process.platform === \"win32\" && [\"ia32\", \"x64\"].includes(process.arch))\n\t);\n}\n\nfunction tryRequireArchPackage(): GrandiAddon | null {\n\tconst archKey = `${process.platform}-${process.arch}`;\n\tconst map: Record<string, string> = {\n\t\t\"linux-x64\": \"@grandi/linux-x64\",\n\t\t\"linux-arm64\": \"@grandi/linux-arm64\",\n\t\t\"linux-arm\": \"@grandi/linux-armv7l\",\n\t\t\"win32-x64\": \"@grandi/win32-x64\",\n\t\t\"win32-ia32\": \"@grandi/win32-ia32\",\n\t\t\"darwin-x64\": \"@grandi/darwin-universal\",\n\t\t\"darwin-arm64\": \"@grandi/darwin-universal\",\n\t};\n\tconst pkg = map[archKey];\n\tif (!pkg) throw new Error(`Unsupported platform or architecture: ${archKey}`);\n\ttry {\n\t\t// eslint-disable-next-line @typescript-eslint/no-var-requires\n\t\treturn require(pkg) as GrandiAddon;\n\t} catch {\n\t\tthrow new Error(\n\t\t\t`Failed to find prebuilt package for ${archKey}. Please ensure that the package \"${pkg}\" is installed`,\n\t\t);\n\t}\n}\n\nfunction loadAddon(): GrandiAddon {\n\tconst loadErrors: Error[] = [];\n\tif (!isSupportedPlatform()) {\n\t\tconsole.error(\n\t\t\t`Unsupported platform or architecture: ${process.platform}-${process.arch}`,\n\t\t);\n\t\treturn noopAddon;\n\t}\n\ttry {\n\t\tconst localBinding = nodeGypBuild(\n\t\t\tpath.join(__dirname, \"..\"),\n\t\t) as GrandiAddon;\n\t\tif (localBinding) return localBinding;\n\t} catch (err) {\n\t\tloadErrors.push(err as Error);\n\t}\n\ttry {\n\t\tconst archAddon = tryRequireArchPackage();\n\t\tif (archAddon) return archAddon;\n\t} catch (err) {\n\t\tloadErrors.push(err as Error);\n\t}\n\n\tif (loadErrors.length > 0) {\n\t\tconst aggregateError = new Error(\n\t\t\t\"Failed to load native addon:\\n\" +\n\t\t\t\tloadErrors.map((e, i) => ` [${i + 1}] ${e.message}`).join(\"\\n\"),\n\t\t);\n\t\tconsole.error(aggregateError);\n\t}\n\treturn noopAddon;\n}\n\nexport interface GrandiAddon {\n\tversion(): string;\n\tisSupportedCPU(): boolean;\n\tinitialize(): boolean;\n\tdestroy(): boolean;\n\tfind(params?: FindOptions): Promise<Finder>;\n\treceive(params: ReceiveOptions): Promise<Receiver>;\n\tframesync(receiver: Receiver): Promise<FrameSync>;\n\tsend(params: SendOptions): Promise<Sender>;\n\trouting(params: { name?: string; groups?: string }): Promise<Routing>;\n}\n\nconst noopAddon: GrandiAddon = {\n\tversion() {\n\t\treturn \"\";\n\t},\n\tisSupportedCPU() {\n\t\treturn false;\n\t},\n\tinitialize() {\n\t\treturn false;\n\t},\n\tdestroy() {\n\t\treturn false;\n\t},\n\tsend(_params) {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n\treceive(_params) {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n\tframesync(_receiver) {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n\trouting() {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n\tfind(_params) {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n};\n\nconst addon: GrandiAddon = loadAddon();\n/**\n * Creates a finder to discover NDI sources on the network.\n * @param {FindOptions} [params={}] - Options for finding sources.\n * @param {boolean} [params.showLocalSources] - Whether to show local sources.\n * @param {string} [params.groups] - Multicast groups to search in.\n * @param {string} [params.extraIPs] - Additional IP addresses to search.\n * @returns {Promise<Finder>} A promise that resolves to a Finder instance for discovering sources.\n * @throws {Error} Promise rejects on unsupported platform/CPU or if the finder cannot be created.\n *\n * @example\n * ```js\n * import { find, initialize } from \"grandi\";\n * initialize();\n * const finder = await find({ showLocalSources: true });\n * finder.wait(1000);\n * console.log(finder.sources());\n * finder.destroy();\n * ```\n */\nexport function find(params: FindOptions = {}): Promise<Finder> {\n\treturn addon.find(params);\n}\n// Named runtime exports\n/**\n * Gets the version of the NDI SDK.\n * @returns {string} The NDI SDK version string.\n */\nexport const version = addon.version;\n/**\n * Checks if the current CPU architecture is supported by NDI.\n * @returns {boolean} True if the CPU is supported, false otherwise.\n */\nexport const isSupportedCPU = addon.isSupportedCPU;\n/**\n * Initializes the NDI library. Must be called before using any other NDI functions.\n * @returns {boolean} True if initialization was successful, false otherwise.\n *\n * @example\n * ```js\n * import { initialize } from \"grandi\";\n * if (!initialize()) throw new Error(\"NDI init failed\");\n * ```\n */\nexport const initialize = addon.initialize;\n/**\n * Destroys the NDI library instance and cleans up resources.\n * Should be called when done using NDI to free resources.\n * @returns {boolean} True if destruction was successful, false otherwise.\n *\n * @example\n * ```js\n * import { destroy } from \"grandi\";\n * destroy();\n * ```\n */\nexport const destroy = addon.destroy;\n/**\n * Creates an NDI sender for transmitting video and audio over the network.\n * @param {SendOptions} params - Options for creating the sender.\n * @param {string} params.name - The name of the NDI source.\n * @param {string} [params.groups] - Multicast groups to send to.\n * @param {boolean} [params.clockVideo] - Whether to clock video frames.\n * @param {boolean} [params.clockAudio] - Whether to clock audio frames.\n * @returns {Promise<Sender>} A promise that resolves to a Sender instance for transmitting data.\n * @throws {Error} Promise rejects on unsupported platform/CPU or if sender creation fails.\n *\n * @example\n * ```js\n * import { initialize, send } from \"grandi\";\n * initialize();\n * const sender = await send({ name: \"My Source\" });\n * // sender.video(...) / sender.audio(...)\n * sender.destroy();\n * ```\n */\nexport const send = addon.send;\n/**\n * Creates an NDI receiver for receiving video and audio from an NDI source.\n * @param {ReceiveOptions} params - Options for creating the receiver.\n * @param {ReceiveOptions[\"source\"]} params.source - The NDI source to connect to.\n * @param {ReceiveOptions[\"colorFormat\"]} [params.colorFormat] - The color format for received video.\n * @param {ReceiveOptions[\"bandwidth\"]} [params.bandwidth] - The bandwidth limitation for the connection.\n * @param {boolean} [params.allowVideoFields] - Whether to allow video fields.\n * @param {string} [params.name] - The name for the receiver.\n * @returns {Promise<Receiver>} A promise that resolves to a Receiver instance for receiving data.\n * @throws {Error} Promise rejects on unsupported platform/CPU or if receiver creation fails.\n *\n * @example\n * ```js\n * import { find, initialize, receive } from \"grandi\";\n * initialize();\n * const finder = await find({ showLocalSources: true });\n * finder.wait(1000);\n * const source = finder.sources()[0];\n * finder.destroy();\n * const receiver = await receive({ source });\n * const frame = await receiver.video(1000);\n * receiver.destroy();\n * ```\n */\nexport const receive = addon.receive;\n/**\n * Creates an NDI frame-synchronizer (time base corrector) backed by an existing receiver.\n * Use this when you want smooth playback clocked to your own render/audio loop.\n *\n * Note: destroy the frame-sync before destroying the receiver.\n * @param {Receiver} receiver - The receiver instance to frame-sync.\n * @returns {Promise<FrameSync>} A promise that resolves to a FrameSync instance.\n * @throws {Error} Promise rejects on unsupported platform/CPU or if framesync creation fails.\n *\n * @example\n * ```js\n * import grandi from \"grandi\";\n * grandi.initialize();\n * const receiver = await grandi.receive({ source });\n * const fs = await grandi.framesync(receiver);\n * const frame = await fs.video(grandi.FrameType.Progressive);\n * fs.destroy();\n * receiver.destroy();\n * ```\n */\nexport const framesync = addon.framesync;\n/**\n * Creates an NDI router for switching between different NDI sources.\n * @param {Object} params - Options for creating the router.\n * @param {string} [params.name] - The name for the router.\n * @param {string} [params.groups] - Multicast groups for the router.\n * @returns {Promise<Routing>} A promise that resolves to a Routing instance for source switching.\n * @throws {Error} Promise rejects on unsupported platform/CPU or if routing creation fails.\n *\n * @example\n * ```js\n * import { initialize, routing } from \"grandi\";\n * initialize();\n * const router = await routing({ name: \"My Router\" });\n * // router.change(source)\n * router.destroy();\n * ```\n */\nexport const routing = addon.routing;\n\n// Re-export enums and types for convenient named imports\nexport { ColorFormat, AudioFormat, Bandwidth, FrameType, FourCC };\nexport type {\n\tAudioFrame,\n\tAudioReceiveOptions,\n\tFinder,\n\tFindOptions,\n\tFrameSync,\n\tFrameSyncAudioOptions,\n\tGrandi,\n\tPtpTimestamp,\n\tReceivedAudioFrame,\n\tReceivedMetadataFrame,\n\tReceivedVideoFrame,\n\tReceiveOptions,\n\tReceiverDataFrame,\n\tReceiverTallyState,\n\tRouting,\n\tSender,\n\tSenderTally,\n\tSource,\n\tSourceChangeEvent,\n\tStatusChangeEvent,\n\tTimecode,\n\tTimeoutEvent,\n\tVideoFrame,\n} from \"./types\";\n\nconst grandi: Grandi = {\n\tversion,\n\tisSupportedCPU,\n\tinitialize,\n\tdestroy,\n\tsend,\n\treceive,\n\tframesync,\n\trouting,\n\tfind,\n\tColorFormat,\n\tAudioFormat,\n\tBandwidth,\n\tFrameType,\n\tFourCC,\n\n\t// Constants mapped to enum values\n\tCOLOR_FORMAT_BGRX_BGRA: ColorFormat.BGRX_BGRA,\n\tCOLOR_FORMAT_UYVY_BGRA: ColorFormat.UYVY_BGRA,\n\tCOLOR_FORMAT_RGBX_RGBA: ColorFormat.RGBX_RGBA,\n\tCOLOR_FORMAT_UYVY_RGBA: ColorFormat.UYVY_RGBA,\n\tCOLOR_FORMAT_FASTEST: ColorFormat.Fastest,\n\tCOLOR_FORMAT_BGRX_BGRA_FLIPPED: ColorFormat.BGRX_BGRA_FLIPPED,\n\n\tBANDWIDTH_METADATA_ONLY: Bandwidth.MetadataOnly,\n\tBANDWIDTH_AUDIO_ONLY: Bandwidth.AudioOnly,\n\tBANDWIDTH_LOWEST: Bandwidth.Lowest,\n\tBANDWIDTH_HIGHEST: Bandwidth.Highest,\n\n\tFORMAT_TYPE_PROGRESSIVE: FrameType.Progressive,\n\tFORMAT_TYPE_INTERLACED: FrameType.Interlaced,\n\tFORMAT_TYPE_FIELD_0: FrameType.Field0,\n\tFORMAT_TYPE_FIELD_1: FrameType.Field1,\n\n\tAUDIO_FORMAT_FLOAT_32_SEPARATE: AudioFormat.Float32Separate,\n\tAUDIO_FORMAT_FLOAT_32_INTERLEAVED: AudioFormat.Float32Interleaved,\n\tAUDIO_FORMAT_INT_16_INTERLEAVED: AudioFormat.Int16Interleaved,\n\n\t// FourCC helpers/constants\n\tFOURCC_UYVY: FourCC.UYVY,\n\tFOURCC_UYVA: FourCC.UYVA,\n\tFOURCC_P216: FourCC.P216,\n\tFOURCC_PA16: FourCC.PA16,\n\tFOURCC_YV12: FourCC.YV12,\n\tFOURCC_I420: FourCC.I420,\n\tFOURCC_NV12: FourCC.NV12,\n\tFOURCC_BGRA: FourCC.BGRA,\n\tFOURCC_BGRX: FourCC.BGRX,\n\tFOURCC_RGBA: FourCC.RGBA,\n\tFOURCC_RGBX: FourCC.RGBX,\n\tFOURCC_FLTp: FourCC.FLTp,\n};\n\nexport default grandi;\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;AAIA,MAAM,oBAAoB,cAAc,OAAO,KAAK,IAAI;AACxD,MAAM,mBAAmB,KAAK,QAAQ,aAAa,CAAC;AAEpD,MAAa,YAA4B,4BAAY;;;;ACPrD,IAAY,kDAAL;AACN;AACA;AACA;AACA;;;AAGD,IAAY,sDAAL;AACN;AACA;AACA;AACA;AACA;AACA;AAEA;;;AAGD,IAAY,sDAAL;AACN;AACA;AACA;;;AAGD,IAAY,kDAAL;AACN;AACA;AACA;AACA;;;AAGD,IAAY,4CAAL;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACjBD,SAAS,sBAA+B;AACvC,QACC,QAAQ,aAAa,YACrB,QAAQ,aAAa,WACpB,QAAQ,aAAa,WAAW,CAAC,QAAQ,MAAM,CAAC,SAAS,QAAQ,KAAK;;AAIzE,SAAS,wBAA4C;CACpD,MAAM,UAAU,GAAG,QAAQ,SAAS,GAAG,QAAQ;CAU/C,MAAM,MAT8B;EACnC,aAAa;EACb,eAAe;EACf,aAAa;EACb,aAAa;EACb,cAAc;EACd,cAAc;EACd,gBAAgB;EAChB,CACe;AAChB,KAAI,CAAC,IAAK,OAAM,IAAI,MAAM,yCAAyC,UAAU;AAC7E,KAAI;AAEH,mBAAe,IAAI;SACZ;AACP,QAAM,IAAI,MACT,uCAAuC,QAAQ,oCAAoC,IAAI,gBACvF;;;AAIH,SAAS,YAAyB;CACjC,MAAMA,aAAsB,EAAE;AAC9B,KAAI,CAAC,qBAAqB,EAAE;AAC3B,UAAQ,MACP,yCAAyC,QAAQ,SAAS,GAAG,QAAQ,OACrE;AACD,SAAO;;AAER,KAAI;EACH,MAAM,eAAe,aACpB,KAAK,KAAK,WAAW,KAAK,CAC1B;AACD,MAAI,aAAc,QAAO;UACjB,KAAK;AACb,aAAW,KAAK,IAAa;;AAE9B,KAAI;EACH,MAAM,YAAY,uBAAuB;AACzC,MAAI,UAAW,QAAO;UACd,KAAK;AACb,aAAW,KAAK,IAAa;;AAG9B,KAAI,WAAW,SAAS,GAAG;EAC1B,MAAM,iCAAiB,IAAI,MAC1B,mCACC,WAAW,KAAK,GAAG,MAAM,MAAM,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,KAAK,KAAK,CACjE;AACD,UAAQ,MAAM,eAAe;;AAE9B,QAAO;;AAeR,MAAMC,YAAyB;CAC9B,UAAU;AACT,SAAO;;CAER,iBAAiB;AAChB,SAAO;;CAER,aAAa;AACZ,SAAO;;CAER,UAAU;AACT,SAAO;;CAER,KAAK,SAAS;AACb,SAAO,QAAQ,uBAAO,IAAI,MAAM,8BAA8B,CAAC;;CAEhE,QAAQ,SAAS;AAChB,SAAO,QAAQ,uBAAO,IAAI,MAAM,8BAA8B,CAAC;;CAEhE,UAAU,WAAW;AACpB,SAAO,QAAQ,uBAAO,IAAI,MAAM,8BAA8B,CAAC;;CAEhE,UAAU;AACT,SAAO,QAAQ,uBAAO,IAAI,MAAM,8BAA8B,CAAC;;CAEhE,KAAK,SAAS;AACb,SAAO,QAAQ,uBAAO,IAAI,MAAM,8BAA8B,CAAC;;CAEhE;AAED,MAAMC,QAAqB,WAAW;;;;;;;;;;;;;;;;;;;;AAoBtC,SAAgB,KAAK,SAAsB,EAAE,EAAmB;AAC/D,QAAO,MAAM,KAAK,OAAO;;;;;;AAO1B,MAAa,UAAU,MAAM;;;;;AAK7B,MAAa,iBAAiB,MAAM;;;;;;;;;;;AAWpC,MAAa,aAAa,MAAM;;;;;;;;;;;;AAYhC,MAAa,UAAU,MAAM;;;;;;;;;;;;;;;;;;;;AAoB7B,MAAa,OAAO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;AAyB1B,MAAa,UAAU,MAAM;;;;;;;;;;;;;;;;;;;;;AAqB7B,MAAa,YAAY,MAAM;;;;;;;;;;;;;;;;;;AAkB/B,MAAa,UAAU,MAAM;AA8B7B,MAAMC,SAAiB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA,wBAAwB,YAAY;CACpC,wBAAwB,YAAY;CACpC,wBAAwB,YAAY;CACpC,wBAAwB,YAAY;CACpC,sBAAsB,YAAY;CAClC,gCAAgC,YAAY;CAE5C,yBAAyB,UAAU;CACnC,sBAAsB,UAAU;CAChC,kBAAkB,UAAU;CAC5B,mBAAmB,UAAU;CAE7B,yBAAyB,UAAU;CACnC,wBAAwB,UAAU;CAClC,qBAAqB,UAAU;CAC/B,qBAAqB,UAAU;CAE/B,gCAAgC,YAAY;CAC5C,mCAAmC,YAAY;CAC/C,iCAAiC,YAAY;CAG7C,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB;AAED,kBAAe"}
package/package.json CHANGED
@@ -1,83 +1,86 @@
1
1
  {
2
- "name": "grandi",
3
- "version": "1.1.0",
4
- "description": "Node.JS native bindings to the Newtek NDI SDK.",
5
- "homepage": "https://github.com/tux-tn/grandi#readme",
6
- "keywords": [
7
- "Newtek",
8
- "NDI",
9
- "network",
10
- "device",
11
- "interface"
12
- ],
13
- "author": "Sarhan Aissi <npm@tux.tn>",
14
- "license": "Apache-2.0",
15
- "files": [
16
- "dist",
17
- "LICENSE",
18
- "NOTICE",
19
- "README.md"
20
- ],
21
- "main": "./dist/index.mjs",
22
- "types": "./dist/index.d.mts",
23
- "exports": {
24
- ".": "./dist/index.mjs",
25
- "./package.json": "./package.json"
26
- },
27
- "gypfile": true,
28
- "repository": {
29
- "type": "git",
30
- "url": "https://github.com/tux-tn/grandi.git"
31
- },
32
- "bugs": {
33
- "url": "https://github.com/tux-tn/grandi/issues"
34
- },
35
- "optionalDependencies": {
36
- "@grandi/linux-x64": "^1.0.0",
37
- "@grandi/linux-arm64": "^1.0.0",
38
- "@grandi/linux-armv7l": "^1.0.0",
39
- "@grandi/win32-x64": "^1.0.0",
40
- "@grandi/win32-ia32": "^1.0.0",
41
- "@grandi/darwin-universal": "1.0.0"
42
- },
43
- "dependencies": {
44
- "cross-spawn": "7.0.6",
45
- "cross-zip": "4.0.1",
46
- "execa": "9.6.1",
47
- "got": "14.6.5",
48
- "node-gyp-build": "^4.8.4",
49
- "shelljs": "0.10.0",
50
- "tmp": "0.2.5"
51
- },
52
- "devDependencies": {
53
- "@biomejs/biome": "2.3.9",
54
- "@types/bindings": "^1.5.5",
55
- "@types/cross-zip": "^4.0.2",
56
- "@types/node": "^25.0.2",
57
- "@types/shelljs": "^0.10.0",
58
- "@types/tmp": "^0.2.6",
59
- "@vitest/coverage-v8": "^4.0.15",
60
- "cross-env": "^10.1.0",
61
- "shx": "0.4.0",
62
- "standard-version": "^9.5.0",
63
- "tsdown": "^0.18.0",
64
- "typescript": "^5.9.3",
65
- "vitest": "^4.0.15"
66
- },
67
- "scripts": {
68
- "build": "tsdown",
69
- "test": "vitest run",
70
- "test:watch": "vitest",
71
- "test:unit": "vitest run test/unit",
72
- "test:integration": "vitest run test/integration",
73
- "bench": "node --expose-gc scripts/benchmark.mjs",
74
- "test:coverage": "vitest run --coverage",
75
- "format": "biome format",
76
- "format:cpp": "clang-format -i lib/*.cc lib/*.h",
77
- "lint": "biome lint",
78
- "clean": "shx rm -rf ndi build"
79
- },
80
- "engines": {
81
- "node": ">=20.19.5"
82
- }
2
+ "name": "grandi",
3
+ "version": "1.2.1",
4
+ "description": "Node.JS native bindings to the Newtek NDI SDK.",
5
+ "homepage": "https://github.com/tux-tn/grandi#readme",
6
+ "keywords": [
7
+ "Newtek",
8
+ "NDI",
9
+ "network",
10
+ "device",
11
+ "interface"
12
+ ],
13
+ "author": "Sarhan Aissi <npm@tux.tn>",
14
+ "license": "Apache-2.0",
15
+ "files": [
16
+ "dist",
17
+ "LICENSE",
18
+ "NOTICE",
19
+ "README.md"
20
+ ],
21
+ "main": "./dist/index.mjs",
22
+ "types": "./dist/index.d.mts",
23
+ "exports": {
24
+ ".": "./dist/index.mjs",
25
+ "./package.json": "./package.json"
26
+ },
27
+ "gypfile": true,
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/tux-tn/grandi.git"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/tux-tn/grandi/issues"
34
+ },
35
+ "optionalDependencies": {
36
+ "@grandi/darwin-universal": "1.2.1",
37
+ "@grandi/linux-arm64": "1.2.1",
38
+ "@grandi/linux-armv7l": "1.2.1",
39
+ "@grandi/linux-x64": "1.2.1",
40
+ "@grandi/win32-ia32": "1.2.1",
41
+ "@grandi/win32-x64": "1.2.1"
42
+ },
43
+ "dependencies": {
44
+ "node-gyp-build": "^4.8.4"
45
+ },
46
+ "devDependencies": {
47
+ "@biomejs/biome": "2.3.9",
48
+ "@types/bindings": "^1.5.5",
49
+ "@types/cross-zip": "^4.0.2",
50
+ "@types/node": "^25.0.2",
51
+ "@types/shelljs": "^0.10.0",
52
+ "@types/tmp": "^0.2.6",
53
+ "@vitest/coverage-v8": "^4.0.15",
54
+ "cross-env": "^10.1.0",
55
+ "cross-spawn": "7.0.6",
56
+ "cross-zip": "4.0.1",
57
+ "execa": "9.6.1",
58
+ "got": "14.6.5",
59
+ "node-gyp": "^12.1.0",
60
+ "shelljs": "0.10.0",
61
+ "shx": "0.4.0",
62
+ "standard-version": "^9.5.0",
63
+ "tmp": "0.2.5",
64
+ "tsdown": "^0.18.0",
65
+ "typescript": "^5.9.3",
66
+ "vitest": "^4.0.15"
67
+ },
68
+ "scripts": {
69
+ "bench": "node --expose-gc scripts/benchmark.mjs",
70
+ "build": "tsdown",
71
+ "build:addon": "node scripts/build-addon.mjs",
72
+ "clean": "shx rm -rf ndi build",
73
+ "format": "biome format",
74
+ "format:cpp": "clang-format -i lib/*.cc lib/*.h",
75
+ "install": "exit 0",
76
+ "lint": "biome lint",
77
+ "test": "vitest run",
78
+ "test:coverage": "vitest run --coverage",
79
+ "test:integration": "vitest run test/integration",
80
+ "test:unit": "vitest run test/unit",
81
+ "test:watch": "vitest"
82
+ },
83
+ "engines": {
84
+ "node": ">=20.19.5"
85
+ }
83
86
  }