grandi 0.1.0 → 1.0.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/dist/index.d.mts +259 -0
- package/dist/index.mjs +147 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/grandi.node +0 -0
- package/prebuilds/darwin-x64/grandi.node +0 -0
- package/prebuilds/linux-x64/grandi.node +0 -0
- package/prebuilds/linux-x64/libndi.so.6 +0 -0
- package/prebuilds/win32-ia32/grandi.node +0 -0
- package/prebuilds/win32-x64/grandi.node +0 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
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 = 200,
|
|
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
|
+
timestamp?: PtpTimestamp;
|
|
61
|
+
metadata?: string;
|
|
62
|
+
}
|
|
63
|
+
interface ReceivedVideoFrame extends VideoFrame {
|
|
64
|
+
type: "video";
|
|
65
|
+
timecode: PtpTimestamp;
|
|
66
|
+
timestamp: PtpTimestamp;
|
|
67
|
+
metadata?: string;
|
|
68
|
+
}
|
|
69
|
+
interface AudioFrame {
|
|
70
|
+
type?: "audio";
|
|
71
|
+
sampleRate: number;
|
|
72
|
+
noChannels: number;
|
|
73
|
+
noSamples: number;
|
|
74
|
+
channelStrideBytes: number;
|
|
75
|
+
data: Buffer;
|
|
76
|
+
fourCC: FourCC;
|
|
77
|
+
timecode?: Timecode;
|
|
78
|
+
timestamp?: PtpTimestamp;
|
|
79
|
+
metadata?: string;
|
|
80
|
+
}
|
|
81
|
+
interface ReceivedAudioFrame {
|
|
82
|
+
type: "audio";
|
|
83
|
+
audioFormat: AudioFormat;
|
|
84
|
+
referenceLevel?: number;
|
|
85
|
+
sampleRate: number;
|
|
86
|
+
channels: number;
|
|
87
|
+
samples: number;
|
|
88
|
+
channelStrideInBytes: number;
|
|
89
|
+
data: Buffer;
|
|
90
|
+
timecode: PtpTimestamp;
|
|
91
|
+
timestamp: PtpTimestamp;
|
|
92
|
+
metadata?: string;
|
|
93
|
+
}
|
|
94
|
+
interface ReceivedMetadataFrame {
|
|
95
|
+
type: "metadata";
|
|
96
|
+
length: number;
|
|
97
|
+
timecode: PtpTimestamp;
|
|
98
|
+
timestamp: PtpTimestamp;
|
|
99
|
+
data: string;
|
|
100
|
+
}
|
|
101
|
+
interface SourceChangeEvent {
|
|
102
|
+
type: "sourceChange";
|
|
103
|
+
}
|
|
104
|
+
interface StatusChangeEvent {
|
|
105
|
+
type: "statusChange";
|
|
106
|
+
}
|
|
107
|
+
type ReceiverDataFrame = ReceivedVideoFrame | ReceivedAudioFrame | ReceivedMetadataFrame | SourceChangeEvent | StatusChangeEvent;
|
|
108
|
+
interface AudioReceiveOptions {
|
|
109
|
+
audioFormat?: AudioFormat;
|
|
110
|
+
referenceLevel?: number;
|
|
111
|
+
}
|
|
112
|
+
interface Receiver {
|
|
113
|
+
embedded: unknown;
|
|
114
|
+
source: Source;
|
|
115
|
+
colorFormat: ColorFormat;
|
|
116
|
+
bandwidth: Bandwidth;
|
|
117
|
+
allowVideoFields: boolean;
|
|
118
|
+
name?: string;
|
|
119
|
+
video(timeoutMs?: number): Promise<ReceivedVideoFrame>;
|
|
120
|
+
audio(timeoutMs?: number): Promise<ReceivedAudioFrame>;
|
|
121
|
+
audio(options: AudioReceiveOptions, timeoutMs?: number): Promise<ReceivedAudioFrame>;
|
|
122
|
+
metadata(timeoutMs?: number): Promise<ReceivedMetadataFrame>;
|
|
123
|
+
data(timeoutMs?: number): Promise<ReceiverDataFrame>;
|
|
124
|
+
data(options: AudioReceiveOptions, timeoutMs?: number): Promise<ReceiverDataFrame>;
|
|
125
|
+
tally(state: ReceiverTallyState): boolean;
|
|
126
|
+
destroy(): boolean;
|
|
127
|
+
}
|
|
128
|
+
interface ReceiverTallyState {
|
|
129
|
+
onProgram?: boolean;
|
|
130
|
+
onPreview?: boolean;
|
|
131
|
+
}
|
|
132
|
+
interface SenderTally {
|
|
133
|
+
changed: boolean;
|
|
134
|
+
on_program: boolean;
|
|
135
|
+
on_preview: boolean;
|
|
136
|
+
}
|
|
137
|
+
interface Sender {
|
|
138
|
+
embedded: unknown;
|
|
139
|
+
name: string;
|
|
140
|
+
groups?: string;
|
|
141
|
+
clockVideo: boolean;
|
|
142
|
+
clockAudio: boolean;
|
|
143
|
+
video(frame: VideoFrame): Promise<void>;
|
|
144
|
+
audio(frame: AudioFrame): Promise<void>;
|
|
145
|
+
connections(): number;
|
|
146
|
+
metadata(data: string): boolean;
|
|
147
|
+
tally(): SenderTally;
|
|
148
|
+
sourcename(): string;
|
|
149
|
+
destroy(): boolean;
|
|
150
|
+
}
|
|
151
|
+
interface Routing {
|
|
152
|
+
embedded: unknown;
|
|
153
|
+
name?: string;
|
|
154
|
+
groups?: string;
|
|
155
|
+
destroy(): boolean;
|
|
156
|
+
change(source: Source): boolean;
|
|
157
|
+
clear(): boolean;
|
|
158
|
+
connections(): number;
|
|
159
|
+
sourcename(): string;
|
|
160
|
+
}
|
|
161
|
+
interface Finder {
|
|
162
|
+
sources(): Source[];
|
|
163
|
+
wait(timeoutMs?: number): boolean;
|
|
164
|
+
destroy(): boolean;
|
|
165
|
+
}
|
|
166
|
+
interface FindOptions {
|
|
167
|
+
showLocalSources?: boolean;
|
|
168
|
+
groups?: string;
|
|
169
|
+
extraIPs?: string;
|
|
170
|
+
}
|
|
171
|
+
interface ReceiveOptions {
|
|
172
|
+
source: Source;
|
|
173
|
+
colorFormat?: ColorFormat;
|
|
174
|
+
bandwidth?: Bandwidth;
|
|
175
|
+
allowVideoFields?: boolean;
|
|
176
|
+
name?: string;
|
|
177
|
+
}
|
|
178
|
+
interface SendOptions {
|
|
179
|
+
name: string;
|
|
180
|
+
groups?: string;
|
|
181
|
+
clockVideo?: boolean;
|
|
182
|
+
clockAudio?: boolean;
|
|
183
|
+
}
|
|
184
|
+
interface GrandiAddon {
|
|
185
|
+
version(): string;
|
|
186
|
+
isSupportedCPU(): boolean;
|
|
187
|
+
initialize(): boolean;
|
|
188
|
+
destroy(): boolean;
|
|
189
|
+
find(params: FindOptions): Promise<Finder>;
|
|
190
|
+
receive(params: ReceiveOptions): Promise<Receiver>;
|
|
191
|
+
send(params: SendOptions): Promise<Sender>;
|
|
192
|
+
routing(params: {
|
|
193
|
+
name?: string;
|
|
194
|
+
groups?: string;
|
|
195
|
+
}): Promise<Routing>;
|
|
196
|
+
}
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/index.d.ts
|
|
199
|
+
declare function find(params?: FindOptions): Promise<Finder>;
|
|
200
|
+
declare const version: () => string;
|
|
201
|
+
declare const isSupportedCPU: () => boolean;
|
|
202
|
+
declare const initialize: () => boolean;
|
|
203
|
+
declare const destroy: () => boolean;
|
|
204
|
+
declare const send: (params: SendOptions) => Promise<Sender>;
|
|
205
|
+
declare const receive: (params: ReceiveOptions) => Promise<Receiver>;
|
|
206
|
+
declare const routing: (params: {
|
|
207
|
+
name?: string;
|
|
208
|
+
groups?: string;
|
|
209
|
+
}) => Promise<Routing>;
|
|
210
|
+
declare const grandi: {
|
|
211
|
+
version: () => string;
|
|
212
|
+
isSupportedCPU: () => boolean;
|
|
213
|
+
initialize: () => boolean;
|
|
214
|
+
destroy: () => boolean;
|
|
215
|
+
send: (params: SendOptions) => Promise<Sender>;
|
|
216
|
+
receive: (params: ReceiveOptions) => Promise<Receiver>;
|
|
217
|
+
routing: (params: {
|
|
218
|
+
name?: string;
|
|
219
|
+
groups?: string;
|
|
220
|
+
}) => Promise<Routing>;
|
|
221
|
+
find: typeof find;
|
|
222
|
+
ColorFormat: typeof ColorFormat;
|
|
223
|
+
AudioFormat: typeof AudioFormat;
|
|
224
|
+
Bandwidth: typeof Bandwidth;
|
|
225
|
+
FrameType: typeof FrameType;
|
|
226
|
+
FourCC: typeof FourCC;
|
|
227
|
+
COLOR_FORMAT_BGRX_BGRA: ColorFormat;
|
|
228
|
+
COLOR_FORMAT_UYVY_BGRA: ColorFormat;
|
|
229
|
+
COLOR_FORMAT_RGBX_RGBA: ColorFormat;
|
|
230
|
+
COLOR_FORMAT_UYVY_RGBA: ColorFormat;
|
|
231
|
+
COLOR_FORMAT_FASTEST: ColorFormat;
|
|
232
|
+
COLOR_FORMAT_BGRX_BGRA_FLIPPED: ColorFormat;
|
|
233
|
+
BANDWIDTH_METADATA_ONLY: Bandwidth;
|
|
234
|
+
BANDWIDTH_AUDIO_ONLY: Bandwidth;
|
|
235
|
+
BANDWIDTH_LOWEST: Bandwidth;
|
|
236
|
+
BANDWIDTH_HIGHEST: Bandwidth;
|
|
237
|
+
FORMAT_TYPE_PROGRESSIVE: FrameType;
|
|
238
|
+
FORMAT_TYPE_INTERLACED: FrameType;
|
|
239
|
+
FORMAT_TYPE_FIELD_0: FrameType;
|
|
240
|
+
FORMAT_TYPE_FIELD_1: FrameType;
|
|
241
|
+
AUDIO_FORMAT_FLOAT_32_SEPARATE: AudioFormat;
|
|
242
|
+
AUDIO_FORMAT_FLOAT_32_INTERLEAVED: AudioFormat;
|
|
243
|
+
AUDIO_FORMAT_INT_16_INTERLEAVED: AudioFormat;
|
|
244
|
+
FOURCC_UYVY: FourCC;
|
|
245
|
+
FOURCC_UYVA: FourCC;
|
|
246
|
+
FOURCC_P216: FourCC;
|
|
247
|
+
FOURCC_PA16: FourCC;
|
|
248
|
+
FOURCC_YV12: FourCC;
|
|
249
|
+
FOURCC_I420: FourCC;
|
|
250
|
+
FOURCC_NV12: FourCC;
|
|
251
|
+
FOURCC_BGRA: FourCC;
|
|
252
|
+
FOURCC_BGRX: FourCC;
|
|
253
|
+
FOURCC_RGBA: FourCC;
|
|
254
|
+
FOURCC_RGBX: FourCC;
|
|
255
|
+
FOURCC_FLTp: FourCC;
|
|
256
|
+
};
|
|
257
|
+
//#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 };
|
|
259
|
+
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import nodeGypBuild from "node-gyp-build";
|
|
4
|
+
|
|
5
|
+
//#region node_modules/tsdown/esm-shims.js
|
|
6
|
+
const getFilename = () => fileURLToPath(import.meta.url);
|
|
7
|
+
const getDirname = () => path.dirname(getFilename());
|
|
8
|
+
const __dirname = /* @__PURE__ */ getDirname();
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/types.ts
|
|
12
|
+
let FrameType = /* @__PURE__ */ function(FrameType$1) {
|
|
13
|
+
FrameType$1[FrameType$1["Interlaced"] = 0] = "Interlaced";
|
|
14
|
+
FrameType$1[FrameType$1["Progressive"] = 1] = "Progressive";
|
|
15
|
+
FrameType$1[FrameType$1["Field0"] = 2] = "Field0";
|
|
16
|
+
FrameType$1[FrameType$1["Field1"] = 3] = "Field1";
|
|
17
|
+
return FrameType$1;
|
|
18
|
+
}({});
|
|
19
|
+
let ColorFormat = /* @__PURE__ */ function(ColorFormat$1) {
|
|
20
|
+
ColorFormat$1[ColorFormat$1["BGRX_BGRA"] = 0] = "BGRX_BGRA";
|
|
21
|
+
ColorFormat$1[ColorFormat$1["UYVY_BGRA"] = 1] = "UYVY_BGRA";
|
|
22
|
+
ColorFormat$1[ColorFormat$1["RGBX_RGBA"] = 2] = "RGBX_RGBA";
|
|
23
|
+
ColorFormat$1[ColorFormat$1["UYVY_RGBA"] = 3] = "UYVY_RGBA";
|
|
24
|
+
ColorFormat$1[ColorFormat$1["Fastest"] = 100] = "Fastest";
|
|
25
|
+
ColorFormat$1[ColorFormat$1["Best"] = 101] = "Best";
|
|
26
|
+
ColorFormat$1[ColorFormat$1["BGRX_BGRA_FLIPPED"] = 200] = "BGRX_BGRA_FLIPPED";
|
|
27
|
+
return ColorFormat$1;
|
|
28
|
+
}({});
|
|
29
|
+
let AudioFormat = /* @__PURE__ */ function(AudioFormat$1) {
|
|
30
|
+
AudioFormat$1[AudioFormat$1["Float32Separate"] = 0] = "Float32Separate";
|
|
31
|
+
AudioFormat$1[AudioFormat$1["Float32Interleaved"] = 1] = "Float32Interleaved";
|
|
32
|
+
AudioFormat$1[AudioFormat$1["Int16Interleaved"] = 2] = "Int16Interleaved";
|
|
33
|
+
return AudioFormat$1;
|
|
34
|
+
}({});
|
|
35
|
+
let Bandwidth = /* @__PURE__ */ function(Bandwidth$1) {
|
|
36
|
+
Bandwidth$1[Bandwidth$1["MetadataOnly"] = -10] = "MetadataOnly";
|
|
37
|
+
Bandwidth$1[Bandwidth$1["AudioOnly"] = 10] = "AudioOnly";
|
|
38
|
+
Bandwidth$1[Bandwidth$1["Lowest"] = 0] = "Lowest";
|
|
39
|
+
Bandwidth$1[Bandwidth$1["Highest"] = 100] = "Highest";
|
|
40
|
+
return Bandwidth$1;
|
|
41
|
+
}({});
|
|
42
|
+
let FourCC = /* @__PURE__ */ function(FourCC$1) {
|
|
43
|
+
FourCC$1[FourCC$1["UYVY"] = 1498831189] = "UYVY";
|
|
44
|
+
FourCC$1[FourCC$1["UYVA"] = 1096178005] = "UYVA";
|
|
45
|
+
FourCC$1[FourCC$1["P216"] = 909193808] = "P216";
|
|
46
|
+
FourCC$1[FourCC$1["PA16"] = 909197648] = "PA16";
|
|
47
|
+
FourCC$1[FourCC$1["YV12"] = 842094169] = "YV12";
|
|
48
|
+
FourCC$1[FourCC$1["I420"] = 808596553] = "I420";
|
|
49
|
+
FourCC$1[FourCC$1["NV12"] = 842094158] = "NV12";
|
|
50
|
+
FourCC$1[FourCC$1["BGRA"] = 1095911234] = "BGRA";
|
|
51
|
+
FourCC$1[FourCC$1["BGRX"] = 1481787202] = "BGRX";
|
|
52
|
+
FourCC$1[FourCC$1["RGBA"] = 1094862674] = "RGBA";
|
|
53
|
+
FourCC$1[FourCC$1["RGBX"] = 1480738642] = "RGBX";
|
|
54
|
+
FourCC$1[FourCC$1["FLTp"] = 1884572742] = "FLTp";
|
|
55
|
+
return FourCC$1;
|
|
56
|
+
}({});
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/index.ts
|
|
60
|
+
function isSupportedPlatform() {
|
|
61
|
+
return process.platform === "darwin" || process.platform === "linux" || process.platform === "win32" && ["ia32", "x64"].includes(process.arch);
|
|
62
|
+
}
|
|
63
|
+
const addon = isSupportedPlatform() ? nodeGypBuild(path.join(__dirname, "..")) : {
|
|
64
|
+
version() {
|
|
65
|
+
return "";
|
|
66
|
+
},
|
|
67
|
+
isSupportedCPU() {
|
|
68
|
+
return false;
|
|
69
|
+
},
|
|
70
|
+
initialize() {
|
|
71
|
+
return false;
|
|
72
|
+
},
|
|
73
|
+
destroy() {
|
|
74
|
+
return false;
|
|
75
|
+
},
|
|
76
|
+
send(_params) {
|
|
77
|
+
return Promise.reject(/* @__PURE__ */ new Error("Unsupported platform or CPU"));
|
|
78
|
+
},
|
|
79
|
+
receive(_params) {
|
|
80
|
+
return Promise.reject(/* @__PURE__ */ new Error("Unsupported platform or CPU"));
|
|
81
|
+
},
|
|
82
|
+
routing() {
|
|
83
|
+
return Promise.reject(/* @__PURE__ */ new Error("Unsupported platform or CPU"));
|
|
84
|
+
},
|
|
85
|
+
find(_params) {
|
|
86
|
+
return Promise.reject(/* @__PURE__ */ new Error("Unsupported platform or CPU"));
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
function find(params = {}) {
|
|
90
|
+
return addon.find(params);
|
|
91
|
+
}
|
|
92
|
+
const version = addon.version;
|
|
93
|
+
const isSupportedCPU = addon.isSupportedCPU;
|
|
94
|
+
const initialize = addon.initialize;
|
|
95
|
+
const destroy = addon.destroy;
|
|
96
|
+
const send = addon.send;
|
|
97
|
+
const receive = addon.receive;
|
|
98
|
+
const routing = addon.routing;
|
|
99
|
+
const grandi = {
|
|
100
|
+
version,
|
|
101
|
+
isSupportedCPU,
|
|
102
|
+
initialize,
|
|
103
|
+
destroy,
|
|
104
|
+
send,
|
|
105
|
+
receive,
|
|
106
|
+
routing,
|
|
107
|
+
find,
|
|
108
|
+
ColorFormat,
|
|
109
|
+
AudioFormat,
|
|
110
|
+
Bandwidth,
|
|
111
|
+
FrameType,
|
|
112
|
+
FourCC,
|
|
113
|
+
COLOR_FORMAT_BGRX_BGRA: ColorFormat.BGRX_BGRA,
|
|
114
|
+
COLOR_FORMAT_UYVY_BGRA: ColorFormat.UYVY_BGRA,
|
|
115
|
+
COLOR_FORMAT_RGBX_RGBA: ColorFormat.RGBX_RGBA,
|
|
116
|
+
COLOR_FORMAT_UYVY_RGBA: ColorFormat.UYVY_RGBA,
|
|
117
|
+
COLOR_FORMAT_FASTEST: ColorFormat.Fastest,
|
|
118
|
+
COLOR_FORMAT_BGRX_BGRA_FLIPPED: ColorFormat.BGRX_BGRA_FLIPPED,
|
|
119
|
+
BANDWIDTH_METADATA_ONLY: Bandwidth.MetadataOnly,
|
|
120
|
+
BANDWIDTH_AUDIO_ONLY: Bandwidth.AudioOnly,
|
|
121
|
+
BANDWIDTH_LOWEST: Bandwidth.Lowest,
|
|
122
|
+
BANDWIDTH_HIGHEST: Bandwidth.Highest,
|
|
123
|
+
FORMAT_TYPE_PROGRESSIVE: FrameType.Progressive,
|
|
124
|
+
FORMAT_TYPE_INTERLACED: FrameType.Interlaced,
|
|
125
|
+
FORMAT_TYPE_FIELD_0: FrameType.Field0,
|
|
126
|
+
FORMAT_TYPE_FIELD_1: FrameType.Field1,
|
|
127
|
+
AUDIO_FORMAT_FLOAT_32_SEPARATE: AudioFormat.Float32Separate,
|
|
128
|
+
AUDIO_FORMAT_FLOAT_32_INTERLEAVED: AudioFormat.Float32Interleaved,
|
|
129
|
+
AUDIO_FORMAT_INT_16_INTERLEAVED: AudioFormat.Int16Interleaved,
|
|
130
|
+
FOURCC_UYVY: FourCC.UYVY,
|
|
131
|
+
FOURCC_UYVA: FourCC.UYVA,
|
|
132
|
+
FOURCC_P216: FourCC.P216,
|
|
133
|
+
FOURCC_PA16: FourCC.PA16,
|
|
134
|
+
FOURCC_YV12: FourCC.YV12,
|
|
135
|
+
FOURCC_I420: FourCC.I420,
|
|
136
|
+
FOURCC_NV12: FourCC.NV12,
|
|
137
|
+
FOURCC_BGRA: FourCC.BGRA,
|
|
138
|
+
FOURCC_BGRX: FourCC.BGRX,
|
|
139
|
+
FOURCC_RGBA: FourCC.RGBA,
|
|
140
|
+
FOURCC_RGBX: FourCC.RGBX,
|
|
141
|
+
FOURCC_FLTp: FourCC.FLTp
|
|
142
|
+
};
|
|
143
|
+
var src_default = grandi;
|
|
144
|
+
|
|
145
|
+
//#endregion
|
|
146
|
+
export { AudioFormat, Bandwidth, ColorFormat, FourCC, FrameType, src_default as default, destroy, find, initialize, isSupportedCPU, receive, routing, send, version };
|
|
147
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["addon: T.GrandiAddon"],"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\tBGRX_BGRA_FLIPPED = 200,\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\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\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 type ReceiverDataFrame =\n\t| ReceivedVideoFrame\n\t| ReceivedAudioFrame\n\t| ReceivedMetadataFrame\n\t| SourceChangeEvent\n\t| StatusChangeEvent;\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 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\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 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\tsend(params: SendOptions): Promise<Sender>;\n\trouting(params: { name?: string; groups?: string }): Promise<Routing>;\n}\n","import path from \"node:path\";\nimport nodeGypBuild from \"node-gyp-build\";\n\nimport type * as T from \"./types\";\nimport {\n\tAudioFormat,\n\tBandwidth,\n\tColorFormat,\n\tFourCC,\n\tFrameType,\n} from \"./types\";\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\nconst noopAddon: T.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\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: T.GrandiAddon = isSupportedPlatform()\n\t? (nodeGypBuild(path.join(__dirname, \"..\")) as T.GrandiAddon)\n\t: noopAddon;\n\nexport function find(params: T.FindOptions = {}): Promise<T.Finder> {\n\treturn addon.find(params);\n}\n// Named runtime exports\nexport const version = addon.version;\nexport const isSupportedCPU = addon.isSupportedCPU;\nexport const initialize = addon.initialize;\nexport const destroy = addon.destroy;\nexport const send = addon.send;\nexport const receive = addon.receive;\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\tGrandiAddon,\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\tVideoFrame,\n} from \"./types\";\n\nconst grandi = {\n\tversion,\n\tisSupportedCPU,\n\tinitialize,\n\tdestroy,\n\tsend,\n\treceive,\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;AACA;;;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;;;;;;AC9BD,SAAS,sBAA+B;AACvC,QACC,QAAQ,aAAa,YACrB,QAAQ,aAAa,WACpB,QAAQ,aAAa,WAAW,CAAC,QAAQ,MAAM,CAAC,SAAS,QAAQ,KAAK;;AA+BzE,MAAMA,QAAuB,qBAAqB,GAC9C,aAAa,KAAK,KAAK,WAAW,KAAK,CAAC,GA5BX;CAChC,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;AACT,SAAO,QAAQ,uBAAO,IAAI,MAAM,8BAA8B,CAAC;;CAEhE,KAAK,SAAS;AACb,SAAO,QAAQ,uBAAO,IAAI,MAAM,8BAA8B,CAAC;;CAEhE;AAMD,SAAgB,KAAK,SAAwB,EAAE,EAAqB;AACnE,QAAO,MAAM,KAAK,OAAO;;AAG1B,MAAa,UAAU,MAAM;AAC7B,MAAa,iBAAiB,MAAM;AACpC,MAAa,aAAa,MAAM;AAChC,MAAa,UAAU,MAAM;AAC7B,MAAa,OAAO,MAAM;AAC1B,MAAa,UAAU,MAAM;AAC7B,MAAa,UAAU,MAAM;AA2B7B,MAAM,SAAS;CACd;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
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
Binary file
|