grandi 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +150 -77
- package/dist/index.d.mts +418 -33
- package/dist/index.mjs +188 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +34 -32
- package/binding.gyp +0 -200
- package/lib/.clang-format +0 -297
- package/lib/grandi.cc +0 -96
- package/lib/grandi_find.cc +0 -365
- package/lib/grandi_find.h +0 -41
- package/lib/grandi_receive.cc +0 -1155
- package/lib/grandi_receive.h +0 -63
- package/lib/grandi_routing.cc +0 -460
- package/lib/grandi_routing.h +0 -37
- package/lib/grandi_send.cc +0 -960
- package/lib/grandi_send.h +0 -45
- package/lib/grandi_util.cc +0 -323
- package/lib/grandi_util.h +0 -137
- package/prebuilds/darwin-arm64/grandi.node +0 -0
- package/prebuilds/darwin-arm64/libndi.dylib +0 -0
- package/prebuilds/darwin-x64/grandi.node +0 -0
- package/prebuilds/darwin-x64/libndi.dylib +0 -0
- package/prebuilds/linux-arm/grandi.node +0 -0
- package/prebuilds/linux-arm/libndi.so.6 +0 -0
- package/prebuilds/linux-arm64/grandi.node +0 -0
- package/prebuilds/linux-arm64/libndi.so.6 +0 -0
- package/prebuilds/linux-ia32/grandi.node +0 -0
- package/prebuilds/linux-ia32/libndi.so.6 +0 -0
- package/prebuilds/linux-x64/grandi.node +0 -0
- package/prebuilds/linux-x64/libndi.so.6 +0 -0
- package/prebuilds/win32-ia32/Processing.NDI.Lib.x86.dll +0 -0
- package/prebuilds/win32-ia32/grandi.node +0 -0
- package/prebuilds/win32-x64/Processing.NDI.Lib.x64.dll +0 -0
- package/prebuilds/win32-x64/grandi.node +0 -0
- package/scripts/preinstall.mjs +0 -429
- package/src/index.ts +0 -141
- package/src/node-gyp-build.d.ts +0 -5
- package/src/types.ts +0 -228
package/dist/index.d.mts
CHANGED
|
@@ -12,7 +12,7 @@ declare enum ColorFormat {
|
|
|
12
12
|
UYVY_RGBA = 3,
|
|
13
13
|
Fastest = 100,
|
|
14
14
|
Best = 101,
|
|
15
|
-
BGRX_BGRA_FLIPPED =
|
|
15
|
+
BGRX_BGRA_FLIPPED = 1000,
|
|
16
16
|
}
|
|
17
17
|
declare enum AudioFormat {
|
|
18
18
|
Float32Separate = 0,
|
|
@@ -57,6 +57,10 @@ interface VideoFrame {
|
|
|
57
57
|
lineStrideBytes: number;
|
|
58
58
|
data: Buffer;
|
|
59
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
|
+
*/
|
|
60
64
|
timestamp?: PtpTimestamp;
|
|
61
65
|
metadata?: string;
|
|
62
66
|
}
|
|
@@ -75,6 +79,10 @@ interface AudioFrame {
|
|
|
75
79
|
data: Buffer;
|
|
76
80
|
fourCC: FourCC;
|
|
77
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
|
+
*/
|
|
78
86
|
timestamp?: PtpTimestamp;
|
|
79
87
|
metadata?: string;
|
|
80
88
|
}
|
|
@@ -104,7 +112,10 @@ interface SourceChangeEvent {
|
|
|
104
112
|
interface StatusChangeEvent {
|
|
105
113
|
type: "statusChange";
|
|
106
114
|
}
|
|
107
|
-
|
|
115
|
+
interface TimeoutEvent {
|
|
116
|
+
type: "timeout";
|
|
117
|
+
}
|
|
118
|
+
type ReceiverDataFrame = ReceivedVideoFrame | ReceivedAudioFrame | ReceivedMetadataFrame | SourceChangeEvent | StatusChangeEvent | TimeoutEvent;
|
|
108
119
|
interface AudioReceiveOptions {
|
|
109
120
|
audioFormat?: AudioFormat;
|
|
110
121
|
referenceLevel?: number;
|
|
@@ -158,6 +169,31 @@ interface Routing {
|
|
|
158
169
|
connections(): number;
|
|
159
170
|
sourcename(): string;
|
|
160
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
|
+
}
|
|
161
197
|
interface Finder {
|
|
162
198
|
sources(): Source[];
|
|
163
199
|
wait(timeoutMs?: number): boolean;
|
|
@@ -172,6 +208,10 @@ interface ReceiveOptions {
|
|
|
172
208
|
source: Source;
|
|
173
209
|
colorFormat?: ColorFormat;
|
|
174
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
|
+
*/
|
|
175
215
|
allowVideoFields?: boolean;
|
|
176
216
|
name?: string;
|
|
177
217
|
}
|
|
@@ -181,79 +221,424 @@ interface SendOptions {
|
|
|
181
221
|
clockVideo?: boolean;
|
|
182
222
|
clockAudio?: boolean;
|
|
183
223
|
}
|
|
184
|
-
interface
|
|
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
|
+
*/
|
|
185
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
|
+
*/
|
|
186
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
|
+
*/
|
|
187
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
|
+
*/
|
|
188
270
|
destroy(): boolean;
|
|
189
|
-
|
|
190
|
-
|
|
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
|
+
*/
|
|
191
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
|
+
*/
|
|
192
327
|
routing(params: {
|
|
193
328
|
name?: string;
|
|
194
329
|
groups?: string;
|
|
195
330
|
}): Promise<Routing>;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
receive: (params: ReceiveOptions) => Promise<Receiver>;
|
|
217
|
-
routing: (params: {
|
|
218
|
-
name?: string;
|
|
219
|
-
groups?: string;
|
|
220
|
-
}) => Promise<Routing>;
|
|
221
|
-
find: typeof find;
|
|
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
|
+
*/
|
|
222
351
|
ColorFormat: typeof ColorFormat;
|
|
352
|
+
/**
|
|
353
|
+
* Enum: supported raw audio formats for helpers/receive conversions.
|
|
354
|
+
*/
|
|
223
355
|
AudioFormat: typeof AudioFormat;
|
|
356
|
+
/**
|
|
357
|
+
* Enum: receiver bandwidth modes.
|
|
358
|
+
*/
|
|
224
359
|
Bandwidth: typeof Bandwidth;
|
|
360
|
+
/**
|
|
361
|
+
* Enum: video frame format types (progressive/interlaced/fields).
|
|
362
|
+
*/
|
|
225
363
|
FrameType: typeof FrameType;
|
|
364
|
+
/**
|
|
365
|
+
* Enum: FourCC pixel/audio formats used in frames.
|
|
366
|
+
*/
|
|
226
367
|
FourCC: typeof FourCC;
|
|
368
|
+
/**
|
|
369
|
+
* Alias of `ColorFormat.BGRX_BGRA`.
|
|
370
|
+
*/
|
|
227
371
|
COLOR_FORMAT_BGRX_BGRA: ColorFormat;
|
|
372
|
+
/**
|
|
373
|
+
* Alias of `ColorFormat.UYVY_BGRA`.
|
|
374
|
+
*/
|
|
228
375
|
COLOR_FORMAT_UYVY_BGRA: ColorFormat;
|
|
376
|
+
/**
|
|
377
|
+
* Alias of `ColorFormat.RGBX_RGBA`.
|
|
378
|
+
*/
|
|
229
379
|
COLOR_FORMAT_RGBX_RGBA: ColorFormat;
|
|
380
|
+
/**
|
|
381
|
+
* Alias of `ColorFormat.UYVY_RGBA`.
|
|
382
|
+
*/
|
|
230
383
|
COLOR_FORMAT_UYVY_RGBA: ColorFormat;
|
|
384
|
+
/**
|
|
385
|
+
* Alias of `ColorFormat.Fastest`.
|
|
386
|
+
*/
|
|
231
387
|
COLOR_FORMAT_FASTEST: ColorFormat;
|
|
388
|
+
/**
|
|
389
|
+
* Alias of `ColorFormat.BGRX_BGRA_FLIPPED` (Windows-only).
|
|
390
|
+
*/
|
|
232
391
|
COLOR_FORMAT_BGRX_BGRA_FLIPPED: ColorFormat;
|
|
392
|
+
/**
|
|
393
|
+
* Alias of `Bandwidth.MetadataOnly`.
|
|
394
|
+
*/
|
|
233
395
|
BANDWIDTH_METADATA_ONLY: Bandwidth;
|
|
396
|
+
/**
|
|
397
|
+
* Alias of `Bandwidth.AudioOnly`.
|
|
398
|
+
*/
|
|
234
399
|
BANDWIDTH_AUDIO_ONLY: Bandwidth;
|
|
400
|
+
/**
|
|
401
|
+
* Alias of `Bandwidth.Lowest`.
|
|
402
|
+
*/
|
|
235
403
|
BANDWIDTH_LOWEST: Bandwidth;
|
|
404
|
+
/**
|
|
405
|
+
* Alias of `Bandwidth.Highest`.
|
|
406
|
+
*/
|
|
236
407
|
BANDWIDTH_HIGHEST: Bandwidth;
|
|
408
|
+
/**
|
|
409
|
+
* Alias of `FrameType.Progressive`.
|
|
410
|
+
*/
|
|
237
411
|
FORMAT_TYPE_PROGRESSIVE: FrameType;
|
|
412
|
+
/**
|
|
413
|
+
* Alias of `FrameType.Interlaced`.
|
|
414
|
+
*/
|
|
238
415
|
FORMAT_TYPE_INTERLACED: FrameType;
|
|
416
|
+
/**
|
|
417
|
+
* Alias of `FrameType.Field0`.
|
|
418
|
+
*/
|
|
239
419
|
FORMAT_TYPE_FIELD_0: FrameType;
|
|
420
|
+
/**
|
|
421
|
+
* Alias of `FrameType.Field1`.
|
|
422
|
+
*/
|
|
240
423
|
FORMAT_TYPE_FIELD_1: FrameType;
|
|
424
|
+
/**
|
|
425
|
+
* Alias of `AudioFormat.Float32Separate`.
|
|
426
|
+
*/
|
|
241
427
|
AUDIO_FORMAT_FLOAT_32_SEPARATE: AudioFormat;
|
|
428
|
+
/**
|
|
429
|
+
* Alias of `AudioFormat.Float32Interleaved`.
|
|
430
|
+
*/
|
|
242
431
|
AUDIO_FORMAT_FLOAT_32_INTERLEAVED: AudioFormat;
|
|
432
|
+
/**
|
|
433
|
+
* Alias of `AudioFormat.Int16Interleaved`.
|
|
434
|
+
*/
|
|
243
435
|
AUDIO_FORMAT_INT_16_INTERLEAVED: AudioFormat;
|
|
436
|
+
/**
|
|
437
|
+
* Alias of `FourCC.UYVY`.
|
|
438
|
+
*/
|
|
244
439
|
FOURCC_UYVY: FourCC;
|
|
440
|
+
/**
|
|
441
|
+
* Alias of `FourCC.UYVA`.
|
|
442
|
+
*/
|
|
245
443
|
FOURCC_UYVA: FourCC;
|
|
444
|
+
/**
|
|
445
|
+
* Alias of `FourCC.P216`.
|
|
446
|
+
*/
|
|
246
447
|
FOURCC_P216: FourCC;
|
|
448
|
+
/**
|
|
449
|
+
* Alias of `FourCC.PA16`.
|
|
450
|
+
*/
|
|
247
451
|
FOURCC_PA16: FourCC;
|
|
452
|
+
/**
|
|
453
|
+
* Alias of `FourCC.YV12`.
|
|
454
|
+
*/
|
|
248
455
|
FOURCC_YV12: FourCC;
|
|
456
|
+
/**
|
|
457
|
+
* Alias of `FourCC.I420`.
|
|
458
|
+
*/
|
|
249
459
|
FOURCC_I420: FourCC;
|
|
460
|
+
/**
|
|
461
|
+
* Alias of `FourCC.NV12`.
|
|
462
|
+
*/
|
|
250
463
|
FOURCC_NV12: FourCC;
|
|
464
|
+
/**
|
|
465
|
+
* Alias of `FourCC.BGRA`.
|
|
466
|
+
*/
|
|
251
467
|
FOURCC_BGRA: FourCC;
|
|
468
|
+
/**
|
|
469
|
+
* Alias of `FourCC.BGRX`.
|
|
470
|
+
*/
|
|
252
471
|
FOURCC_BGRX: FourCC;
|
|
472
|
+
/**
|
|
473
|
+
* Alias of `FourCC.RGBA`.
|
|
474
|
+
*/
|
|
253
475
|
FOURCC_RGBA: FourCC;
|
|
476
|
+
/**
|
|
477
|
+
* Alias of `FourCC.RGBX`.
|
|
478
|
+
*/
|
|
254
479
|
FOURCC_RGBX: FourCC;
|
|
480
|
+
/**
|
|
481
|
+
* Alias of `FourCC.FLTp`.
|
|
482
|
+
*/
|
|
255
483
|
FOURCC_FLTp: FourCC;
|
|
256
|
-
}
|
|
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;
|
|
257
642
|
//#endregion
|
|
258
|
-
export { AudioFormat, type AudioFrame, type AudioReceiveOptions, Bandwidth, ColorFormat, type FindOptions, type Finder, FourCC, FrameType, type 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 VideoFrame, grandi as default, destroy, find, initialize, isSupportedCPU, receive, routing, send, version };
|
|
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 };
|
|
259
644
|
//# sourceMappingURL=index.d.mts.map
|