grandi 1.3.1 → 2.0.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.
package/dist/index.d.mts CHANGED
@@ -3,7 +3,7 @@ declare enum FrameType {
3
3
  Interlaced = 0,
4
4
  Progressive = 1,
5
5
  Field0 = 2,
6
- Field1 = 3,
6
+ Field1 = 3
7
7
  }
8
8
  declare enum ColorFormat {
9
9
  BGRX_BGRA = 0,
@@ -12,18 +12,18 @@ declare enum ColorFormat {
12
12
  UYVY_RGBA = 3,
13
13
  Fastest = 100,
14
14
  Best = 101,
15
- BGRX_BGRA_FLIPPED = 1000,
15
+ BGRX_BGRA_FLIPPED = 1000
16
16
  }
17
17
  declare enum AudioFormat {
18
18
  Float32Separate = 0,
19
19
  Float32Interleaved = 1,
20
- Int16Interleaved = 2,
20
+ Int16Interleaved = 2
21
21
  }
22
22
  declare enum Bandwidth {
23
23
  MetadataOnly = -10,
24
24
  AudioOnly = 10,
25
25
  Lowest = 0,
26
- Highest = 100,
26
+ Highest = 100
27
27
  }
28
28
  declare enum FourCC {
29
29
  UYVY = 1498831189,
@@ -37,10 +37,17 @@ declare enum FourCC {
37
37
  BGRX = 1481787202,
38
38
  RGBA = 1094862674,
39
39
  RGBX = 1480738642,
40
- FLTp = 1884572742,
40
+ FLTp = 1884572742
41
41
  }
42
- type PtpTimestamp = [number, number];
43
- type Timecode = bigint | number | PtpTimestamp;
42
+ type VideoFourCC = FourCC.UYVY | FourCC.UYVA | FourCC.P216 | FourCC.PA16 | FourCC.YV12 | FourCC.I420 | FourCC.NV12 | FourCC.BGRA | FourCC.BGRX | FourCC.RGBA | FourCC.RGBX;
43
+ type AudioFourCC = FourCC.FLTp;
44
+ /**
45
+ * NDI sentinel that asks the SDK to generate synthesized timecode.
46
+ *
47
+ * @see [Synthesized timecode in the NDI SDK documentation](https://docs.ndi.video/all/getting-started/white-paper/time-timecode-and-sync-for-ndi#synthesized-timecode)
48
+ */
49
+ declare const TIMECODE_SYNTHESIZE = 9223372036854775807n;
50
+ type Timecode = bigint;
44
51
  interface Source {
45
52
  name: string;
46
53
  urlAddress?: string;
@@ -52,40 +59,45 @@ interface VideoFrame {
52
59
  frameRateN: number;
53
60
  frameRateD: number;
54
61
  pictureAspectRatio: number;
55
- fourCC: FourCC;
62
+ fourCC: VideoFourCC;
56
63
  frameFormatType: FrameType;
57
64
  lineStrideBytes: number;
58
65
  data: Buffer;
59
66
  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
67
  metadata?: string;
66
68
  }
67
69
  interface ReceivedVideoFrame extends VideoFrame {
68
70
  type: "video";
69
- timecode: PtpTimestamp;
70
- timestamp: PtpTimestamp;
71
+ timecode: bigint;
72
+ /** Omitted when the NDI SDK reports that the receive timestamp is unavailable. */
73
+ timestamp?: bigint;
71
74
  metadata?: string;
72
75
  }
73
- interface AudioFrame {
76
+ type AudioFrame = {
74
77
  type?: "audio";
75
78
  sampleRate: number;
76
- noChannels: number;
77
- noSamples: number;
78
79
  channelStrideBytes: number;
79
80
  data: Buffer;
80
- fourCC: FourCC;
81
+ fourCC: AudioFourCC;
81
82
  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
83
  metadata?: string;
88
- }
84
+ } & ({
85
+ channels: number;
86
+ /** @deprecated Use `channels` instead. */
87
+ noChannels?: number;
88
+ } | {
89
+ channels?: number;
90
+ /** @deprecated Use `channels` instead. */
91
+ noChannels: number;
92
+ }) & ({
93
+ samples: number;
94
+ /** @deprecated Use `samples` instead. */
95
+ noSamples?: number;
96
+ } | {
97
+ samples?: number;
98
+ /** @deprecated Use `samples` instead. */
99
+ noSamples: number;
100
+ });
89
101
  interface ReceivedAudioFrame {
90
102
  type: "audio";
91
103
  audioFormat: AudioFormat;
@@ -95,15 +107,15 @@ interface ReceivedAudioFrame {
95
107
  samples: number;
96
108
  channelStrideInBytes: number;
97
109
  data: Buffer;
98
- timecode: PtpTimestamp;
99
- timestamp: PtpTimestamp;
110
+ timecode: bigint;
111
+ /** Omitted when the NDI SDK reports that the receive timestamp is unavailable. */
112
+ timestamp?: bigint;
100
113
  metadata?: string;
101
114
  }
102
115
  interface ReceivedMetadataFrame {
103
116
  type: "metadata";
104
117
  length: number;
105
- timecode: PtpTimestamp;
106
- timestamp: PtpTimestamp;
118
+ timecode: bigint;
107
119
  data: string;
108
120
  }
109
121
  interface SourceChangeEvent {
@@ -120,8 +132,23 @@ interface AudioReceiveOptions {
120
132
  audioFormat?: AudioFormat;
121
133
  referenceLevel?: number;
122
134
  }
135
+ interface ReceiverPerformance {
136
+ total: {
137
+ videoFrames: number;
138
+ audioFrames: number;
139
+ metadataFrames: number;
140
+ };
141
+ dropped: {
142
+ videoFrames: number;
143
+ audioFrames: number;
144
+ metadataFrames: number;
145
+ };
146
+ }
147
+ interface ReceiverQueue {
148
+ videoFrames: number;
149
+ audioFrames: number;
150
+ }
123
151
  interface Receiver {
124
- embedded: unknown;
125
152
  source: Source;
126
153
  colorFormat: ColorFormat;
127
154
  bandwidth: Bandwidth;
@@ -135,6 +162,9 @@ interface Receiver {
135
162
  data(options: AudioReceiveOptions, timeoutMs?: number): Promise<ReceiverDataFrame>;
136
163
  tally(state: ReceiverTallyState): boolean;
137
164
  destroy(): boolean;
165
+ performance(): ReceiverPerformance;
166
+ queue(): ReceiverQueue;
167
+ connections(): number;
138
168
  }
139
169
  interface ReceiverTallyState {
140
170
  onProgram?: boolean;
@@ -142,11 +172,14 @@ interface ReceiverTallyState {
142
172
  }
143
173
  interface SenderTally {
144
174
  changed: boolean;
175
+ onProgram: boolean;
176
+ onPreview: boolean;
177
+ /** @deprecated Use `onProgram` instead. */
145
178
  on_program: boolean;
179
+ /** @deprecated Use `onPreview` instead. */
146
180
  on_preview: boolean;
147
181
  }
148
182
  interface Sender {
149
- embedded: unknown;
150
183
  name: string;
151
184
  groups?: string;
152
185
  clockVideo: boolean;
@@ -156,26 +189,42 @@ interface Sender {
156
189
  connections(): number;
157
190
  metadata(data: string): boolean;
158
191
  tally(): SenderTally;
192
+ sourceName(): string;
193
+ /** @deprecated Use `sourceName` instead. */
159
194
  sourcename(): string;
160
195
  destroy(): boolean;
161
196
  }
162
197
  interface Routing {
163
- embedded: unknown;
164
198
  name?: string;
165
199
  groups?: string;
166
200
  destroy(): boolean;
167
- change(source: Source): boolean;
201
+ change(source: Source | null | undefined): boolean;
168
202
  clear(): boolean;
169
203
  connections(): number;
204
+ sourceName(): string;
205
+ /** @deprecated Use `sourceName` instead. */
170
206
  sourcename(): string;
171
207
  }
172
- interface FrameSyncAudioOptions {
208
+ interface FrameSyncAudioOptionsBase {
173
209
  sampleRate?: number;
210
+ channels?: number;
211
+ /** @deprecated Use `channels` instead. */
174
212
  noChannels?: number;
213
+ }
214
+ type FrameSyncAudioOptions = (FrameSyncAudioOptionsBase & {
215
+ samples: number;
216
+ /** @deprecated Use `samples` instead. */
175
217
  noSamples?: number;
218
+ }) | (FrameSyncAudioOptionsBase & {
219
+ samples?: never;
220
+ /** @deprecated Use `samples` instead. */
221
+ noSamples: number;
222
+ });
223
+ interface FrameSyncAudioFormat {
224
+ sampleRate: number;
225
+ channels: number;
176
226
  }
177
227
  interface FrameSync {
178
- embedded: unknown;
179
228
  /**
180
229
  * Captures a video frame using NDI frame-synchronization (time base correction).
181
230
  * Always returns immediately.
@@ -186,8 +235,14 @@ interface FrameSync {
186
235
  /**
187
236
  * Captures audio using NDI frame-synchronization (resampled to match your calls).
188
237
  * Always returns immediately and may insert silence if no audio is present.
238
+ * `samples` must be greater than zero.
239
+ */
240
+ audio(options: FrameSyncAudioOptions): Promise<ReceivedAudioFrame>;
241
+ /**
242
+ * Returns the current incoming audio format, or `undefined` when no audio
243
+ * format has been received yet.
189
244
  */
190
- audio(options?: FrameSyncAudioOptions): Promise<ReceivedAudioFrame>;
245
+ audioFormat(): FrameSyncAudioFormat | undefined;
191
246
  /**
192
247
  * Returns an approximate depth of the internal audio queue in samples.
193
248
  */
@@ -196,12 +251,14 @@ interface FrameSync {
196
251
  }
197
252
  interface Finder {
198
253
  sources(): Source[];
199
- wait(timeoutMs?: number): boolean;
254
+ wait(timeoutMs?: number): Promise<boolean>;
200
255
  destroy(): boolean;
201
256
  }
202
257
  interface FindOptions {
203
258
  showLocalSources?: boolean;
204
259
  groups?: string;
260
+ /** @deprecated Use `extraIPs` instead. */
261
+ extraIps?: string;
205
262
  extraIPs?: string;
206
263
  }
207
264
  interface ReceiveOptions {
@@ -245,9 +302,10 @@ interface Grandi {
245
302
  */
246
303
  isSupportedCPU(): boolean;
247
304
  /**
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.
305
+ * Optionally initializes the process-global NDI library.
306
+ * The SDK does not require this call, but eager initialization is recommended
307
+ * when the application explicitly manages startup and shutdown.
308
+ * @returns `true` if initialization succeeded and the CPU is supported.
251
309
  *
252
310
  * @example
253
311
  * ```js
@@ -257,9 +315,9 @@ interface Grandi {
257
315
  */
258
316
  initialize(): boolean;
259
317
  /**
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.
318
+ * Optionally shuts down the process-global NDI library.
319
+ * When managing the lifecycle explicitly, destroy all native objects first.
320
+ * @returns `true` after requesting shutdown.
263
321
  *
264
322
  * @example
265
323
  * ```js
@@ -293,7 +351,7 @@ interface Grandi {
293
351
  * import grandi from "grandi";
294
352
  * grandi.initialize();
295
353
  * const finder = await grandi.find({ showLocalSources: true });
296
- * finder.wait(1000);
354
+ * await finder.wait(1000);
297
355
  * const source = finder.sources()[0];
298
356
  * finder.destroy();
299
357
  * const receiver = await grandi.receive({ source });
@@ -304,11 +362,12 @@ interface Grandi {
304
362
  receive(params: ReceiveOptions): Promise<Receiver>;
305
363
  /**
306
364
  * 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.
365
+ * While it exists, direct `video`, `audio`, and `data` captures on that
366
+ * receiver are unavailable; metadata and control methods such as `tally` remain usable.
367
+ * Destroy the frame-sync before the receiver. Direct capture becomes available
368
+ * again after the frame-sync is destroyed.
310
369
  */
311
- framesync(receiver: Receiver): Promise<FrameSync>;
370
+ frameSync(receiver: Receiver): Promise<FrameSync>;
312
371
  /**
313
372
  * Creates an NDI router for switching between different NDI sources.
314
373
  * @param params Router options.
@@ -339,7 +398,7 @@ interface Grandi {
339
398
  * import grandi from "grandi";
340
399
  * grandi.initialize();
341
400
  * const finder = await grandi.find({ showLocalSources: true });
342
- * finder.wait(1000);
401
+ * await finder.wait(1000);
343
402
  * console.log(finder.sources());
344
403
  * finder.destroy();
345
404
  * ```
@@ -349,145 +408,92 @@ interface Grandi {
349
408
  * Enum: receiver video color formats.
350
409
  */
351
410
  ColorFormat: typeof ColorFormat;
411
+ /** @deprecated Use `ColorFormat.BGRX_BGRA` instead. */
412
+ COLOR_FORMAT_BGRX_BGRA: ColorFormat.BGRX_BGRA;
413
+ /** @deprecated Use `ColorFormat.UYVY_BGRA` instead. */
414
+ COLOR_FORMAT_UYVY_BGRA: ColorFormat.UYVY_BGRA;
415
+ /** @deprecated Use `ColorFormat.RGBX_RGBA` instead. */
416
+ COLOR_FORMAT_RGBX_RGBA: ColorFormat.RGBX_RGBA;
417
+ /** @deprecated Use `ColorFormat.UYVY_RGBA` instead. */
418
+ COLOR_FORMAT_UYVY_RGBA: ColorFormat.UYVY_RGBA;
419
+ /** @deprecated Use `ColorFormat.Fastest` instead. */
420
+ COLOR_FORMAT_FASTEST: ColorFormat.Fastest;
421
+ /** @deprecated Use `ColorFormat.Best` instead. */
422
+ COLOR_FORMAT_BEST: ColorFormat.Best;
423
+ /** @deprecated Use `ColorFormat.BGRX_BGRA_FLIPPED` instead. */
424
+ COLOR_FORMAT_BGRX_BGRA_FLIPPED: ColorFormat.BGRX_BGRA_FLIPPED;
352
425
  /**
353
426
  * Enum: supported raw audio formats for helpers/receive conversions.
354
427
  */
355
428
  AudioFormat: typeof AudioFormat;
429
+ /** @deprecated Use `AudioFormat.Float32Separate` instead. */
430
+ AUDIO_FORMAT_FLOAT_32_SEPARATE: AudioFormat.Float32Separate;
431
+ /** @deprecated Use `AudioFormat.Float32Interleaved` instead. */
432
+ AUDIO_FORMAT_FLOAT_32_INTERLEAVED: AudioFormat.Float32Interleaved;
433
+ /** @deprecated Use `AudioFormat.Int16Interleaved` instead. */
434
+ AUDIO_FORMAT_INT_16_INTERLEAVED: AudioFormat.Int16Interleaved;
356
435
  /**
357
436
  * Enum: receiver bandwidth modes.
358
437
  */
359
438
  Bandwidth: typeof Bandwidth;
439
+ /** @deprecated Use `Bandwidth.MetadataOnly` instead. */
440
+ BANDWIDTH_METADATA_ONLY: Bandwidth.MetadataOnly;
441
+ /** @deprecated Use `Bandwidth.AudioOnly` instead. */
442
+ BANDWIDTH_AUDIO_ONLY: Bandwidth.AudioOnly;
443
+ /** @deprecated Use `Bandwidth.Lowest` instead. */
444
+ BANDWIDTH_LOWEST: Bandwidth.Lowest;
445
+ /** @deprecated Use `Bandwidth.Highest` instead. */
446
+ BANDWIDTH_HIGHEST: Bandwidth.Highest;
360
447
  /**
361
448
  * Enum: video frame format types (progressive/interlaced/fields).
362
449
  */
363
450
  FrameType: typeof FrameType;
451
+ /** @deprecated Use `FrameType.Progressive` instead. */
452
+ FORMAT_TYPE_PROGRESSIVE: FrameType.Progressive;
453
+ /** @deprecated Use `FrameType.Interlaced` instead. */
454
+ FORMAT_TYPE_INTERLACED: FrameType.Interlaced;
455
+ /** @deprecated Use `FrameType.Field0` instead. */
456
+ FORMAT_TYPE_FIELD_0: FrameType.Field0;
457
+ /** @deprecated Use `FrameType.Field1` instead. */
458
+ FORMAT_TYPE_FIELD_1: FrameType.Field1;
364
459
  /**
365
460
  * Enum: FourCC pixel/audio formats used in frames.
366
461
  */
367
462
  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.Best`.
390
- */
391
- COLOR_FORMAT_BEST: ColorFormat;
392
- /**
393
- * Alias of `ColorFormat.BGRX_BGRA_FLIPPED` (Windows-only).
394
- */
395
- COLOR_FORMAT_BGRX_BGRA_FLIPPED: ColorFormat;
396
- /**
397
- * Alias of `Bandwidth.MetadataOnly`.
398
- */
399
- BANDWIDTH_METADATA_ONLY: Bandwidth;
400
- /**
401
- * Alias of `Bandwidth.AudioOnly`.
402
- */
403
- BANDWIDTH_AUDIO_ONLY: Bandwidth;
404
- /**
405
- * Alias of `Bandwidth.Lowest`.
406
- */
407
- BANDWIDTH_LOWEST: Bandwidth;
408
- /**
409
- * Alias of `Bandwidth.Highest`.
410
- */
411
- BANDWIDTH_HIGHEST: Bandwidth;
412
- /**
413
- * Alias of `FrameType.Progressive`.
414
- */
415
- FORMAT_TYPE_PROGRESSIVE: FrameType;
416
- /**
417
- * Alias of `FrameType.Interlaced`.
418
- */
419
- FORMAT_TYPE_INTERLACED: FrameType;
420
- /**
421
- * Alias of `FrameType.Field0`.
422
- */
423
- FORMAT_TYPE_FIELD_0: FrameType;
424
- /**
425
- * Alias of `FrameType.Field1`.
426
- */
427
- FORMAT_TYPE_FIELD_1: FrameType;
428
- /**
429
- * Alias of `AudioFormat.Float32Separate`.
430
- */
431
- AUDIO_FORMAT_FLOAT_32_SEPARATE: AudioFormat;
432
- /**
433
- * Alias of `AudioFormat.Float32Interleaved`.
434
- */
435
- AUDIO_FORMAT_FLOAT_32_INTERLEAVED: AudioFormat;
436
- /**
437
- * Alias of `AudioFormat.Int16Interleaved`.
438
- */
439
- AUDIO_FORMAT_INT_16_INTERLEAVED: AudioFormat;
440
- /**
441
- * Alias of `FourCC.UYVY`.
442
- */
443
- FOURCC_UYVY: FourCC;
444
- /**
445
- * Alias of `FourCC.UYVA`.
446
- */
447
- FOURCC_UYVA: FourCC;
448
- /**
449
- * Alias of `FourCC.P216`.
450
- */
451
- FOURCC_P216: FourCC;
452
- /**
453
- * Alias of `FourCC.PA16`.
454
- */
455
- FOURCC_PA16: FourCC;
456
- /**
457
- * Alias of `FourCC.YV12`.
458
- */
459
- FOURCC_YV12: FourCC;
460
- /**
461
- * Alias of `FourCC.I420`.
462
- */
463
- FOURCC_I420: FourCC;
464
- /**
465
- * Alias of `FourCC.NV12`.
466
- */
467
- FOURCC_NV12: FourCC;
468
- /**
469
- * Alias of `FourCC.BGRA`.
470
- */
471
- FOURCC_BGRA: FourCC;
472
- /**
473
- * Alias of `FourCC.BGRX`.
474
- */
475
- FOURCC_BGRX: FourCC;
476
- /**
477
- * Alias of `FourCC.RGBA`.
478
- */
479
- FOURCC_RGBA: FourCC;
480
- /**
481
- * Alias of `FourCC.RGBX`.
482
- */
483
- FOURCC_RGBX: FourCC;
484
- /**
485
- * Alias of `FourCC.FLTp`.
463
+ /** @deprecated Use `FourCC.UYVY` instead. */
464
+ FOURCC_UYVY: FourCC.UYVY;
465
+ /** @deprecated Use `FourCC.UYVA` instead. */
466
+ FOURCC_UYVA: FourCC.UYVA;
467
+ /** @deprecated Use `FourCC.P216` instead. */
468
+ FOURCC_P216: FourCC.P216;
469
+ /** @deprecated Use `FourCC.PA16` instead. */
470
+ FOURCC_PA16: FourCC.PA16;
471
+ /** @deprecated Use `FourCC.YV12` instead. */
472
+ FOURCC_YV12: FourCC.YV12;
473
+ /** @deprecated Use `FourCC.I420` instead. */
474
+ FOURCC_I420: FourCC.I420;
475
+ /** @deprecated Use `FourCC.NV12` instead. */
476
+ FOURCC_NV12: FourCC.NV12;
477
+ /** @deprecated Use `FourCC.BGRA` instead. */
478
+ FOURCC_BGRA: FourCC.BGRA;
479
+ /** @deprecated Use `FourCC.BGRX` instead. */
480
+ FOURCC_BGRX: FourCC.BGRX;
481
+ /** @deprecated Use `FourCC.RGBA` instead. */
482
+ FOURCC_RGBA: FourCC.RGBA;
483
+ /** @deprecated Use `FourCC.RGBX` instead. */
484
+ FOURCC_RGBX: FourCC.RGBX;
485
+ /** @deprecated Use `FourCC.FLTp` instead. */
486
+ FOURCC_FLTp: FourCC.FLTp;
487
+ /**
488
+ * NDI sentinel that asks the SDK to synthesize the timecode.
489
+ *
490
+ * @see [Synthesized timecode in the NDI SDK documentation](https://docs.ndi.video/all/getting-started/white-paper/time-timecode-and-sync-for-ndi#synthesized-timecode)
486
491
  */
487
- FOURCC_FLTp: FourCC;
492
+ TIMECODE_SYNTHESIZE: bigint;
488
493
  }
489
494
  //#endregion
490
495
  //#region src/index.d.ts
496
+ /** @internal Native addon contract used by the JavaScript wrapper. */
491
497
  interface GrandiAddon {
492
498
  version(): string;
493
499
  isSupportedCPU(): boolean;
@@ -504,7 +510,7 @@ interface GrandiAddon {
504
510
  }
505
511
  /**
506
512
  * Creates a finder to discover NDI sources on the network.
507
- * @param {FindOptions} [params={}] - Options for finding sources.
513
+ * @param {FindOptions} params - Options for finding sources.
508
514
  * @param {boolean} [params.showLocalSources] - Whether to show local sources.
509
515
  * @param {string} [params.groups] - Multicast groups to search in.
510
516
  * @param {string} [params.extraIPs] - Additional IP addresses to search.
@@ -516,7 +522,7 @@ interface GrandiAddon {
516
522
  * import { find, initialize } from "grandi";
517
523
  * initialize();
518
524
  * const finder = await find({ showLocalSources: true });
519
- * finder.wait(1000);
525
+ * await finder.wait(1000);
520
526
  * console.log(finder.sources());
521
527
  * finder.destroy();
522
528
  * ```
@@ -533,8 +539,9 @@ declare const version: () => string;
533
539
  */
534
540
  declare const isSupportedCPU: () => boolean;
535
541
  /**
536
- * Initializes the NDI library. Must be called before using any other NDI functions.
537
- * @returns {boolean} True if initialization was successful, false otherwise.
542
+ * Optionally initializes the process-global NDI library. The SDK does not require
543
+ * this call, but eager initialization is recommended for explicit lifecycle management.
544
+ * @returns {boolean} True if initialization was successful and the CPU is supported.
538
545
  *
539
546
  * @example
540
547
  * ```js
@@ -544,9 +551,9 @@ declare const isSupportedCPU: () => boolean;
544
551
  */
545
552
  declare const initialize: () => boolean;
546
553
  /**
547
- * Destroys the NDI library instance and cleans up resources.
548
- * Should be called when done using NDI to free resources.
549
- * @returns {boolean} True if destruction was successful, false otherwise.
554
+ * Optionally shuts down the process-global NDI library.
555
+ * When managing the lifecycle explicitly, destroy all native objects before calling this.
556
+ * @returns {boolean} True after requesting shutdown.
550
557
  *
551
558
  * @example
552
559
  * ```js
@@ -574,7 +581,7 @@ declare const destroy: () => boolean;
574
581
  * sender.destroy();
575
582
  * ```
576
583
  */
577
- declare const send: (params: SendOptions) => Promise<Sender>;
584
+ declare function send(params: SendOptions): Promise<Sender>;
578
585
  /**
579
586
  * Creates an NDI receiver for receiving video and audio from an NDI source.
580
587
  * @param {ReceiveOptions} params - Options for creating the receiver.
@@ -591,7 +598,7 @@ declare const send: (params: SendOptions) => Promise<Sender>;
591
598
  * import { find, initialize, receive } from "grandi";
592
599
  * initialize();
593
600
  * const finder = await find({ showLocalSources: true });
594
- * finder.wait(1000);
601
+ * await finder.wait(1000);
595
602
  * const source = finder.sources()[0];
596
603
  * finder.destroy();
597
604
  * const receiver = await receive({ source });
@@ -600,49 +607,14 @@ declare const send: (params: SendOptions) => Promise<Sender>;
600
607
  * ```
601
608
  */
602
609
  declare const receive: (params: ReceiveOptions) => Promise<Receiver>;
603
- /**
604
- * Creates an NDI frame-synchronizer (time base corrector) backed by an existing receiver.
605
- * Use this when you want smooth playback clocked to your own render/audio loop.
606
- *
607
- * Note: destroy the frame-sync before destroying the receiver.
608
- * @param {Receiver} receiver - The receiver instance to frame-sync.
609
- * @returns {Promise<FrameSync>} A promise that resolves to a FrameSync instance.
610
- * @throws {Error} Promise rejects on unsupported platform/CPU or if framesync creation fails.
611
- *
612
- * @example
613
- * ```js
614
- * import grandi from "grandi";
615
- * grandi.initialize();
616
- * const receiver = await grandi.receive({ source });
617
- * const fs = await grandi.framesync(receiver);
618
- * const frame = await fs.video(grandi.FrameType.Progressive);
619
- * fs.destroy();
620
- * receiver.destroy();
621
- * ```
622
- */
610
+ declare const frameSync: (receiver: Receiver) => Promise<FrameSync>;
611
+ /** @deprecated Use `frameSync` instead. */
623
612
  declare const framesync: (receiver: Receiver) => Promise<FrameSync>;
624
- /**
625
- * Creates an NDI router for switching between different NDI sources.
626
- * @param {Object} params - Options for creating the router.
627
- * @param {string} [params.name] - The name for the router.
628
- * @param {string} [params.groups] - Multicast groups for the router.
629
- * @returns {Promise<Routing>} A promise that resolves to a Routing instance for source switching.
630
- * @throws {Error} Promise rejects on unsupported platform/CPU or if routing creation fails.
631
- *
632
- * @example
633
- * ```js
634
- * import { initialize, routing } from "grandi";
635
- * initialize();
636
- * const router = await routing({ name: "My Router" });
637
- * // router.change(source)
638
- * router.destroy();
639
- * ```
640
- */
641
- declare const routing: (params: {
613
+ declare function routing(params: {
642
614
  name?: string;
643
615
  groups?: string;
644
- }) => Promise<Routing>;
616
+ }): Promise<Routing>;
645
617
  declare const grandi: Grandi;
646
618
  //#endregion
647
- 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 };
619
+ export { AudioFormat, type AudioFourCC, type AudioFrame, type AudioReceiveOptions, Bandwidth, ColorFormat, type FindOptions, type Finder, FourCC, type FrameSync, type FrameSyncAudioFormat, type FrameSyncAudioOptions, type FrameSyncAudioOptionsBase, FrameType, type Grandi, GrandiAddon, type ReceiveOptions, type ReceivedAudioFrame, type ReceivedMetadataFrame, type ReceivedVideoFrame, type Receiver, type ReceiverDataFrame, type ReceiverPerformance, type ReceiverQueue, type ReceiverTallyState, type Routing, type SendOptions, type Sender, type SenderTally, type Source, type SourceChangeEvent, type StatusChangeEvent, TIMECODE_SYNTHESIZE, type Timecode, type TimeoutEvent, type VideoFourCC, type VideoFrame, grandi as default, destroy, find, frameSync, framesync, initialize, isSupportedCPU, receive, routing, send, version };
648
620
  //# sourceMappingURL=index.d.mts.map