@tvpipe/sdk 0.0.0-stage → 0.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.
Files changed (54) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +231 -2
  3. package/bin/tvpipe.js +29 -0
  4. package/dist/api.d.ts +189 -0
  5. package/dist/api.d.ts.map +1 -0
  6. package/dist/api.js +348 -0
  7. package/dist/api.js.map +1 -0
  8. package/dist/binary.d.ts +21 -0
  9. package/dist/binary.d.ts.map +1 -0
  10. package/dist/binary.js +73 -0
  11. package/dist/binary.js.map +1 -0
  12. package/dist/canvas.d.ts +21 -0
  13. package/dist/canvas.d.ts.map +1 -0
  14. package/dist/canvas.js +14 -0
  15. package/dist/canvas.js.map +1 -0
  16. package/dist/errors.d.ts +33 -0
  17. package/dist/errors.d.ts.map +1 -0
  18. package/dist/errors.js +23 -0
  19. package/dist/errors.js.map +1 -0
  20. package/dist/events.d.ts +172 -0
  21. package/dist/events.d.ts.map +1 -0
  22. package/dist/events.js +55 -0
  23. package/dist/events.js.map +1 -0
  24. package/dist/index.d.ts +15 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +13 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/process.d.ts +78 -0
  29. package/dist/process.d.ts.map +1 -0
  30. package/dist/process.js +248 -0
  31. package/dist/process.js.map +1 -0
  32. package/dist/session.d.ts +93 -0
  33. package/dist/session.d.ts.map +1 -0
  34. package/dist/session.js +192 -0
  35. package/dist/session.js.map +1 -0
  36. package/dist/slrw.d.ts +40 -0
  37. package/dist/slrw.d.ts.map +1 -0
  38. package/dist/slrw.js +86 -0
  39. package/dist/slrw.js.map +1 -0
  40. package/dist/stream.d.ts +109 -0
  41. package/dist/stream.d.ts.map +1 -0
  42. package/dist/stream.js +230 -0
  43. package/dist/stream.js.map +1 -0
  44. package/package.json +52 -4
  45. package/src/api.ts +540 -0
  46. package/src/binary.ts +92 -0
  47. package/src/canvas.ts +30 -0
  48. package/src/errors.ts +77 -0
  49. package/src/events.ts +258 -0
  50. package/src/index.ts +50 -0
  51. package/src/process.ts +283 -0
  52. package/src/session.ts +262 -0
  53. package/src/slrw.ts +99 -0
  54. package/src/stream.ts +297 -0
package/dist/api.js ADDED
@@ -0,0 +1,348 @@
1
+ /**
2
+ * The functions: discover, pair, unpair, play, testPattern, preview,
3
+ * share, stream, version.
4
+ */
5
+ import { execFile } from "node:child_process";
6
+ import { resolveBinary } from "./binary.js";
7
+ import { TvpipeError } from "./errors.js";
8
+ import { TvpipeProcess } from "./process.js";
9
+ import { Session } from "./session.js";
10
+ import { StreamSession } from "./stream.js";
11
+ function toDevice(d) {
12
+ const ap = d.airplay ?? d.raop;
13
+ const protocols = [];
14
+ if (ap)
15
+ protocols.push("airplay");
16
+ if (d.cast)
17
+ protocols.push("cast");
18
+ const bool = (o, k) => typeof o?.[k] === "boolean" ? o[k] : undefined;
19
+ return {
20
+ name: d.name,
21
+ model: d.model,
22
+ addresses: d.addresses ?? [],
23
+ protocols,
24
+ video: bool(d.cast, "video") === true || bool(d.airplay, "mirroring") === true,
25
+ paired: ap ? (bool(d.airplay, "paired") ?? bool(d.raop, "paired") ?? false) : undefined,
26
+ pin: ap ? (bool(d.airplay, "pin") ?? bool(d.raop, "pin")) : undefined,
27
+ airplay: d.airplay,
28
+ raop: d.raop,
29
+ cast: d.cast,
30
+ };
31
+ }
32
+ /** Receivers on the local network (AirPlay and Cast, merged per device). */
33
+ export async function discover(options = {}) {
34
+ const args = ["discover", "--timeout", String((options.timeout ?? 3000) / 1000)];
35
+ for (const i of options.interfaces ?? [])
36
+ args.push("--interface", i);
37
+ const proc = new TvpipeProcess(args, options);
38
+ let found;
39
+ proc.on("event", (ev) => {
40
+ if (ev.type === "devices")
41
+ found = ev;
42
+ });
43
+ const abort = () => proc.stop(1000);
44
+ options.signal?.addEventListener("abort", abort, { once: true });
45
+ try {
46
+ const exit = await proc.exited;
47
+ if (options.signal?.aborted)
48
+ throw abortError(options.signal);
49
+ if (exit.code !== 0 || !found)
50
+ throw proc.error("discovery failed");
51
+ return found.devices.map(toDevice);
52
+ }
53
+ finally {
54
+ options.signal?.removeEventListener("abort", abort);
55
+ }
56
+ }
57
+ /**
58
+ * Pairs with an AirPlay receiver (Apple TV): the TV shows a PIN, `onPin`
59
+ * returns it. The pairing is stored in tvpipe's config directory (shared
60
+ * with the CLI; see `configDir`).
61
+ */
62
+ export async function pair(target, options = {}) {
63
+ const name = typeof target === "string" ? target : target.name;
64
+ if (options.signal?.aborted)
65
+ throw abortError(options.signal);
66
+ const args = ["pair", name];
67
+ if (options.pin !== undefined)
68
+ args.push("--pin", options.pin);
69
+ const proc = new TvpipeProcess(args, options);
70
+ let paired;
71
+ let cancelled;
72
+ proc.on("event", (ev) => {
73
+ if (ev.type === "paired")
74
+ paired = { name: ev.name, model: ev.model, file: ev.file };
75
+ if (ev.type === "pin-required") {
76
+ const onPin = options.onPin;
77
+ if (!onPin) {
78
+ cancelled = new TvpipeError("pin-missing", `${ev.name} shows a PIN: pass onPin to pair()`, { device: ev.name });
79
+ proc.endInput();
80
+ return;
81
+ }
82
+ Promise.resolve()
83
+ .then(() => onPin({ name: ev.name, address: ev.address }))
84
+ .then((pin) => {
85
+ proc.command({ type: "pin", pin: String(pin).trim() });
86
+ }, (err) => {
87
+ cancelled = err;
88
+ proc.endInput();
89
+ });
90
+ }
91
+ });
92
+ const abort = () => {
93
+ cancelled = abortError(options.signal);
94
+ void proc.stop(1000);
95
+ };
96
+ options.signal?.addEventListener("abort", abort, { once: true });
97
+ try {
98
+ const exit = await proc.exited;
99
+ if (cancelled)
100
+ throw cancelled;
101
+ if (exit.code !== 0 || !paired)
102
+ throw proc.error("pairing failed");
103
+ return paired;
104
+ }
105
+ finally {
106
+ options.signal?.removeEventListener("abort", abort);
107
+ proc.endInput();
108
+ }
109
+ }
110
+ /** Forgets the pairing with a receiver. Resolves with the names forgotten. */
111
+ export async function unpair(target, options = {}) {
112
+ const proc = new TvpipeProcess(["unpair", typeof target === "string" ? target : target.name], options);
113
+ const names = [];
114
+ proc.on("event", (ev) => {
115
+ if (ev.type === "unpaired")
116
+ names.push(ev.name);
117
+ });
118
+ const exit = await proc.exited;
119
+ if (exit.code !== 0)
120
+ throw proc.error("unpair failed");
121
+ return names;
122
+ }
123
+ function tunnelArgs(tunnel, ttl) {
124
+ if (!tunnel) {
125
+ if (ttl !== undefined)
126
+ throw new TvpipeError("invalid-argument", "`tunnelTtl` needs `tunnel`");
127
+ return [];
128
+ }
129
+ const args = [tunnel === true ? "--tunnel" : `--tunnel=${tunnel}`];
130
+ if (ttl !== undefined)
131
+ args.push("--tunnel-ttl", String(ttl));
132
+ return args;
133
+ }
134
+ function targetName(t) {
135
+ return typeof t === "string" ? t : t.name;
136
+ }
137
+ /** `to` resolved: the only video receiver when none was given. */
138
+ async function targets(options) {
139
+ if (options.to !== undefined) {
140
+ const list = (Array.isArray(options.to) ? options.to : [options.to]).map(targetName);
141
+ if (list.length === 0)
142
+ throw new TvpipeError("invalid-argument", "`to` is empty");
143
+ return list;
144
+ }
145
+ const devices = (await discover({ ...options, timeout: options.discoverTimeout ?? 3000 })).filter((d) => d.video);
146
+ if (devices.length === 1)
147
+ return [devices[0].name];
148
+ if (devices.length === 0) {
149
+ throw new TvpipeError("no-receivers", "no AirPlay or Cast receiver with video found on the network; pass `to` (a name, an address, or \"browser\" for a browser tab)");
150
+ }
151
+ const names = devices.map((d) => d.name);
152
+ throw new TvpipeError("ambiguous-receiver", `found ${devices.length} receivers, pass \`to\` to pick one or more: ${names.map((n) => JSON.stringify(n)).join(", ")}`, { details: { devices } });
153
+ }
154
+ function commonArgs(to, o) {
155
+ const args = [];
156
+ for (const t of to)
157
+ args.push("--to", t);
158
+ if (o.latency !== undefined)
159
+ args.push("--latency", String(Math.round(o.latency)));
160
+ if (o.size !== undefined)
161
+ args.push("--size", typeof o.size === "string" ? o.size : `${o.size.width}x${o.size.height}`);
162
+ if (o.fps !== undefined)
163
+ args.push("--fps", String(o.fps));
164
+ if (o.bitrate !== undefined)
165
+ args.push("--bitrate", String(Math.round(o.bitrate)));
166
+ if (o.audio === false)
167
+ args.push("--no-audio");
168
+ if (o.reconnect !== undefined)
169
+ args.push("--reconnect", String(o.reconnect));
170
+ if (to.some((t) => t.toLowerCase() === "browser")) {
171
+ const p = o.player ?? {};
172
+ args.push("--port", String(p.port ?? 0));
173
+ if (p.open)
174
+ args.push("--open");
175
+ if (p.waitForViewer)
176
+ args.push("--wait-for-viewer");
177
+ if (p.newToken)
178
+ args.push("--new-token");
179
+ args.push(...tunnelArgs(p.tunnel, p.tunnelTtl));
180
+ }
181
+ else if (o.player) {
182
+ throw new TvpipeError("invalid-argument", "`player` options need a \"browser\" receiver in `to`");
183
+ }
184
+ return args;
185
+ }
186
+ function playArgs(o) {
187
+ const args = [];
188
+ if (o.loop)
189
+ args.push("--loop");
190
+ if (o.realtime === true)
191
+ args.push("--realtime");
192
+ if (o.realtime === false)
193
+ args.push("--no-realtime");
194
+ if (o.encoder)
195
+ args.push("--encoder", o.encoder);
196
+ if (o.ffmpeg)
197
+ args.push("--ffmpeg", o.ffmpeg);
198
+ return args;
199
+ }
200
+ function abortError(signal) {
201
+ return new TvpipeError("aborted", "aborted", { cause: signal.reason });
202
+ }
203
+ /**
204
+ * Starts a session and resolves once `ready` saw its event; with `onPin`,
205
+ * pairs a receiver that needs it and starts once more.
206
+ */
207
+ async function start(options, build, make, ready) {
208
+ if (options.signal?.aborted)
209
+ throw abortError(options.signal);
210
+ const to = await targets(options);
211
+ const paired = new Set();
212
+ for (;;) {
213
+ try {
214
+ return await startOnce(options, build(to), make, ready);
215
+ }
216
+ catch (err) {
217
+ const device = err instanceof TvpipeError && err.code === "pairing-required" ? err.device : undefined;
218
+ if (!device || !options.onPin || paired.has(device))
219
+ throw err;
220
+ paired.add(device);
221
+ await pair(device, { ...options, onPin: options.onPin });
222
+ }
223
+ }
224
+ }
225
+ async function startOnce(options, args, make, ready) {
226
+ const proc = new TvpipeProcess(args, options);
227
+ const session = make(proc);
228
+ return new Promise((resolve, reject) => {
229
+ let settled = false;
230
+ const settle = (f) => {
231
+ if (!settled) {
232
+ settled = true;
233
+ session.off("event", onEvent);
234
+ f();
235
+ }
236
+ };
237
+ const onEvent = (ev) => {
238
+ if (ready(ev))
239
+ settle(() => resolve(session));
240
+ };
241
+ session.on("event", onEvent);
242
+ session.done.then(() => settle(() => reject(options.signal?.aborted
243
+ ? abortError(options.signal)
244
+ : new TvpipeError("closed", "the session ended before it started", { log: session.log }))), (err) => settle(() => reject(options.signal?.aborted ? abortError(options.signal) : err)));
245
+ });
246
+ }
247
+ const isStarted = (ev) => ev.type === "started";
248
+ /**
249
+ * Plays a file, URL or capture device. Resolves once streaming started;
250
+ * the session ends at the end of the input (`done`) or with `stop()`.
251
+ */
252
+ export function play(input, options = {}) {
253
+ const inputArgs = typeof input === "object" && !(input instanceof URL) ? ["--", ...input.ffmpeg] : [String(input)];
254
+ return start(options, (to) => ["play", ...commonArgs(to, options), ...playArgs(options), ...inputArgs], (proc) => new Session(proc, options), isStarted);
255
+ }
256
+ /** The built-in test pattern (a clock, a frame counter, a beep and flash every second); no ffmpeg needed. */
257
+ export function testPattern(options = {}) {
258
+ return start(options, (to) => ["test-pattern", ...commonArgs(to, options), ...playArgs(options)], (proc) => new Session(proc, options), isStarted);
259
+ }
260
+ /**
261
+ * Plays to a browser tab on this computer (`to: "browser"` plus whatever
262
+ * `to` adds); `session.playerUrl` is the page. Without input: the test pattern.
263
+ */
264
+ export function preview(input, options = {}) {
265
+ const extra = options.to === undefined ? [] : Array.isArray(options.to) ? options.to : [options.to];
266
+ const opts = { ...options, to: ["browser", ...extra.filter((t) => targetName(t).toLowerCase() !== "browser")] };
267
+ return input === undefined ? testPattern(opts) : play(input, opts);
268
+ }
269
+ export function share(a, b) {
270
+ const url = typeof a === "string" || a instanceof URL ? String(a) : undefined;
271
+ const options = (url === undefined ? a : b);
272
+ const build = (to) => {
273
+ if (options.player?.tunnel) {
274
+ throw new TvpipeError("invalid-argument", "`share` puts the share page on a link (`tunnel`), not the player");
275
+ }
276
+ const args = ["share", ...commonArgs(to, options)];
277
+ if (options.open)
278
+ args.push("--open");
279
+ if (url !== undefined && options.tunnel) {
280
+ throw new TvpipeError("invalid-argument", "`tunnel` is for `share()` without URL");
281
+ }
282
+ args.push(...tunnelArgs(options.tunnel, options.tunnelTtl));
283
+ if (options.yes)
284
+ args.push("--yes");
285
+ if (url !== undefined) {
286
+ if (options.visible)
287
+ args.push("--visible");
288
+ if (options.profile)
289
+ args.push("--profile", options.profile);
290
+ if (options.reload !== undefined)
291
+ args.push("--reload", String(options.reload));
292
+ if (options.browser)
293
+ args.push("--browser", options.browser);
294
+ args.push(url);
295
+ }
296
+ return args;
297
+ };
298
+ return start(options, build, (proc) => new Session(proc, options), url !== undefined ? isStarted : options.tunnel ? (ev) => ev.type === "tunnel" : (ev) => ev.type === "share-page");
299
+ }
300
+ /**
301
+ * Streams frames the program makes: raw pixels (`writeVideo`, a canvas),
302
+ * PCM (`writeAudio`), or H.264 (`writeH264`, WebCodecs `writeChunk`).
303
+ * Resolves once the receivers are connected; write from then on.
304
+ */
305
+ export async function stream(options) {
306
+ const v = options.video;
307
+ if (!(v.width > 0 && v.height > 0 && v.width % 2 === 0 && v.height % 2 === 0)) {
308
+ throw new TvpipeError("invalid-argument", "video width and height must be positive and even");
309
+ }
310
+ if (!(v.fps > 0))
311
+ throw new TvpipeError("invalid-argument", "video fps must be positive");
312
+ const encoded = "codec" in v;
313
+ const pixfmt = encoded ? "h264" : (v.format ?? "rgba");
314
+ // `audio` is a spec here, not CommonOptions' boolean.
315
+ const common = { ...options, audio: undefined };
316
+ const build = (to) => {
317
+ const args = ["play", ...commonArgs(to, common), "--raw-video", `${v.width}x${v.height}@${v.fps}:${pixfmt}`];
318
+ const a = options.audio;
319
+ if (a)
320
+ args.push("--raw-audio", `${a.sampleRate}:${a.channels}:s16le`);
321
+ if (!encoded)
322
+ args.push("--encoder", options.encoder ?? "builtin");
323
+ if (options.ffmpeg)
324
+ args.push("--ffmpeg", options.ffmpeg);
325
+ args.push("-");
326
+ return args;
327
+ };
328
+ return start(common, build, (proc) => new StreamSession(proc, {
329
+ ...options,
330
+ video: v,
331
+ audio: options.audio,
332
+ latencyMs: options.latency,
333
+ }), (ev) => ev.type === "connected");
334
+ }
335
+ // ---------------------------------------------------------------------------
336
+ /** The binary's version (`tvpipe --version`). */
337
+ export function version(options = {}) {
338
+ const binary = resolveBinary(options);
339
+ return new Promise((resolve, reject) => {
340
+ execFile(binary, ["--version"], { windowsHide: true }, (err, stdout) => {
341
+ if (err)
342
+ reject(new TvpipeError("binary-missing", `cannot run ${binary}: ${err.message}`, { cause: err }));
343
+ else
344
+ resolve(stdout.trim().replace(/^tvpipe\s+/, ""));
345
+ });
346
+ });
347
+ }
348
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAsB,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAuB,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,OAAO,EAAuB,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAkC,MAAM,aAAa,CAAC;AAgC5E,SAAS,QAAQ,CAAC,CAAY;IAC5B,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC;IAC/B,MAAM,SAAS,GAAwB,EAAE,CAAC;IAC1C,IAAI,EAAE;QAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAClC,IAAI,CAAC,CAAC,IAAI;QAAE,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;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C,CAAC;IACF,OAAO,KAAK,CACV,MAAM,EACN,KAAK,EACL,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,aAAa,CAAC,IAAI,EAAE;QACtB,GAAG,OAAO;QACV,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS,EAAE,OAAO,CAAC,OAAO;KAC3B,CAAC,EACJ,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,WAAW,CAChC,CAAC;AACJ,CAAC;AAED,8EAA8E;AAE9E,iDAAiD;AACjD,MAAM,UAAU,OAAO,CAAC,UAAyB,EAAE;IACjD,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACtC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,QAAQ,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACrE,IAAI,GAAG;gBAAE,MAAM,CAAC,IAAI,WAAW,CAAC,gBAAgB,EAAE,cAAc,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;;gBACtG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Finds the tvpipe binary: the `binary` option, `$TVPIPE_BINARY`, or the
3
+ * platform package (`@tvpipe/<os>-<cpu>`) npm installed next to this one.
4
+ */
5
+ /** The platforms with a published binary: `${process.platform}-${process.arch}`. */
6
+ export declare const PLATFORMS: readonly ["darwin-arm64", "darwin-x64", "linux-arm64", "linux-x64", "win32-arm64", "win32-x64"];
7
+ export type Platform = (typeof PLATFORMS)[number];
8
+ /** The npm package with the binary for a platform. */
9
+ export declare function platformPackage(platform?: string): string;
10
+ export interface BinaryOptions {
11
+ /** Path of a tvpipe binary to use instead of the installed one. */
12
+ binary?: string | undefined;
13
+ }
14
+ /** The environment variable that names a binary to use. */
15
+ export declare const BINARY_ENV = "TVPIPE_BINARY";
16
+ /**
17
+ * The tvpipe binary to run. Throws a {@link TvpipeError} (`binary-missing`
18
+ * or `unsupported-platform`) that says how to fix it.
19
+ */
20
+ export declare function resolveBinary(options?: BinaryOptions): string;
21
+ //# sourceMappingURL=binary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../src/binary.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,oFAAoF;AACpF,eAAO,MAAM,SAAS,iGAOZ,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD,sDAAsD;AACtD,wBAAgB,eAAe,CAAC,QAAQ,GAAE,MAA8C,GAAG,MAAM,CAEhG;AAED,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED,2DAA2D;AAC3D,eAAO,MAAM,UAAU,kBAAkB,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM,CAmDjE"}
package/dist/binary.js ADDED
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Finds the tvpipe binary: the `binary` option, `$TVPIPE_BINARY`, or the
3
+ * platform package (`@tvpipe/<os>-<cpu>`) npm installed next to this one.
4
+ */
5
+ import { accessSync, chmodSync, constants, existsSync } from "node:fs";
6
+ import { createRequire } from "node:module";
7
+ import { dirname, join } from "node:path";
8
+ import { TvpipeError } from "./errors.js";
9
+ /** The platforms with a published binary: `${process.platform}-${process.arch}`. */
10
+ export const PLATFORMS = [
11
+ "darwin-arm64",
12
+ "darwin-x64",
13
+ "linux-arm64",
14
+ "linux-x64",
15
+ "win32-arm64",
16
+ "win32-x64",
17
+ ];
18
+ /** The npm package with the binary for a platform. */
19
+ export function platformPackage(platform = `${process.platform}-${process.arch}`) {
20
+ return `@tvpipe/${platform}`;
21
+ }
22
+ /** The environment variable that names a binary to use. */
23
+ export const BINARY_ENV = "TVPIPE_BINARY";
24
+ /**
25
+ * The tvpipe binary to run. Throws a {@link TvpipeError} (`binary-missing`
26
+ * or `unsupported-platform`) that says how to fix it.
27
+ */
28
+ export function resolveBinary(options = {}) {
29
+ const explicit = options.binary ?? process.env[BINARY_ENV];
30
+ if (explicit) {
31
+ if (!existsSync(explicit)) {
32
+ throw new TvpipeError("binary-missing", `tvpipe binary not found at ${explicit} (from ${options.binary ? "the binary option" : `$${BINARY_ENV}`})`);
33
+ }
34
+ return explicit;
35
+ }
36
+ const platform = `${process.platform}-${process.arch}`;
37
+ if (!PLATFORMS.includes(platform)) {
38
+ throw new TvpipeError("unsupported-platform", `tvpipe has no binary for ${platform} (supported: ${PLATFORMS.join(", ")}); ` +
39
+ `build it from https://github.com/mitsuhiko/tvpipe and set $${BINARY_ENV} to its path`);
40
+ }
41
+ const pkg = platformPackage(platform);
42
+ const exe = process.platform === "win32" ? "tvpipe.exe" : "tvpipe";
43
+ let path;
44
+ try {
45
+ const require = createRequire(import.meta.url);
46
+ path = join(dirname(require.resolve(`${pkg}/package.json`)), "bin", exe);
47
+ }
48
+ catch (cause) {
49
+ throw new TvpipeError("binary-missing", `the tvpipe binary for ${platform} is not installed: npm did not install the optional ` +
50
+ `dependency ${pkg} (installed with --omit=optional or --no-optional, or the lockfile ` +
51
+ `was made on another platform?). Reinstall @tvpipe/sdk with optional dependencies, ` +
52
+ `install ${pkg} explicitly, or set $${BINARY_ENV} to a tvpipe binary`, { cause });
53
+ }
54
+ if (!existsSync(path)) {
55
+ throw new TvpipeError("binary-missing", `${pkg} is installed but has no ${join("bin", exe)}`);
56
+ }
57
+ if (process.platform !== "win32") {
58
+ try {
59
+ accessSync(path, constants.X_OK);
60
+ }
61
+ catch {
62
+ // Some package managers drop the executable bit.
63
+ try {
64
+ chmodSync(path, 0o755);
65
+ }
66
+ catch {
67
+ // Spawning reports the problem.
68
+ }
69
+ }
70
+ }
71
+ return path;
72
+ }
73
+ //# sourceMappingURL=binary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.js","sourceRoot":"","sources":["../src/binary.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,oFAAoF;AACpF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,cAAc;IACd,YAAY;IACZ,aAAa;IACb,WAAW;IACX,aAAa;IACb,WAAW;CACH,CAAC;AAIX,sDAAsD;AACtD,MAAM,UAAU,eAAe,CAAC,WAAmB,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE;IACtF,OAAO,WAAW,QAAQ,EAAE,CAAC;AAC/B,CAAC;AAOD,2DAA2D;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,UAAyB,EAAE;IACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC3D,IAAI,QAAQ,EAAE,CAAC;QACb,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,WAAW,CACnB,gBAAgB,EAChB,8BAA8B,QAAQ,UAAU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,4BAA4B,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;IAChG,CAAC;IACD,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;QAAC,MAAM,CAAC;YACP,iDAAiD;YACjD,IAAI,CAAC;gBACH,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACzB,CAAC;YAAC,MAAM,CAAC;gBACP,gCAAgC;YAClC,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Canvases, duck-typed: anything with `width`, `height` and a 2D context
3
+ * with `getImageData` (node-canvas, skia-canvas, @napi-rs/canvas,
4
+ * OffscreenCanvas). No dependency on any of them.
5
+ */
6
+ export interface ImageDataLike {
7
+ readonly width: number;
8
+ readonly height: number;
9
+ readonly data: Uint8ClampedArray | Uint8Array;
10
+ }
11
+ export interface Context2DLike {
12
+ getImageData(x: number, y: number, width: number, height: number): ImageDataLike;
13
+ }
14
+ export interface CanvasLike {
15
+ readonly width: number;
16
+ readonly height: number;
17
+ getContext(type: "2d"): Context2DLike | null;
18
+ }
19
+ /** The canvas's RGBA pixels (a fresh copy, as `getImageData` makes one). */
20
+ export declare function canvasPixels(canvas: CanvasLike): ImageDataLike;
21
+ //# sourceMappingURL=canvas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../src/canvas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,UAAU,CAAC;CAC/C;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;CAClF;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,aAAa,GAAG,IAAI,CAAC;CAC9C;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,CAM9D"}
package/dist/canvas.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Canvases, duck-typed: anything with `width`, `height` and a 2D context
3
+ * with `getImageData` (node-canvas, skia-canvas, @napi-rs/canvas,
4
+ * OffscreenCanvas). No dependency on any of them.
5
+ */
6
+ /** The canvas's RGBA pixels (a fresh copy, as `getImageData` makes one). */
7
+ export function canvasPixels(canvas) {
8
+ const ctx = canvas.getContext("2d");
9
+ if (!ctx || typeof ctx.getImageData !== "function") {
10
+ throw new TypeError("the canvas has no 2D context with getImageData");
11
+ }
12
+ return ctx.getImageData(0, 0, canvas.width, canvas.height);
13
+ }
14
+ //# sourceMappingURL=canvas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canvas.js","sourceRoot":"","sources":["../src/canvas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,4EAA4E;AAC5E,MAAM,UAAU,YAAY,CAAC,MAAkB;IAC7C,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;QACnD,MAAM,IAAI,SAAS,CAAC,gDAAgD,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,GAAG,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Errors of the SDK. Every failure is a {@link TvpipeError} with a human
3
+ * message and a stable `code` to branch on.
4
+ */
5
+ /**
6
+ * Stable error codes. The binary's codes (docs/machine.md) plus the SDK's
7
+ * own; unknown failures use the binary's error kind (`io`, `auth`, …).
8
+ */
9
+ export type TvpipeErrorCode = "pairing-required" | "no-receiver" | "input-not-found" | "ffmpeg-missing" | "pin-missing" | "bad-input" | "fairplay-required" | "feature-disabled" | "binary-missing" | "unsupported-platform" | "protocol-mismatch" | "no-receivers" | "ambiguous-receiver" | "pairing-failed" | "aborted" | "exited" | "invalid-argument" | "closed" | "io" | "malformed" | "protocol" | "crypto" | "auth" | "unsupported" | "timeout" | "not-found" | "process" | "usage" | "unimplemented" | (string & {});
10
+ export interface TvpipeErrorOptions {
11
+ /** The binary's error kind (`auth`, `not-found`, …), when it reported one. */
12
+ kind?: string;
13
+ /** The receiver the error is about. */
14
+ device?: string;
15
+ /** The process's exit code, when it exited. */
16
+ exitCode?: number | null;
17
+ /** The last log lines and stderr output of the process. */
18
+ log?: string[];
19
+ cause?: unknown;
20
+ /** Extra data, e.g. the receivers found for `ambiguous-receiver`. */
21
+ details?: Record<string, unknown>;
22
+ }
23
+ export declare class TvpipeError extends Error {
24
+ name: string;
25
+ readonly code: TvpipeErrorCode;
26
+ readonly kind: string | undefined;
27
+ readonly device: string | undefined;
28
+ readonly exitCode: number | null | undefined;
29
+ readonly log: string[];
30
+ readonly details: Record<string, unknown>;
31
+ constructor(code: TvpipeErrorCode, message: string, options?: TvpipeErrorOptions);
32
+ }
33
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,MAAM,eAAe,GA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O,GAAE,kBAAuB;CASrF"}
package/dist/errors.js ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Errors of the SDK. Every failure is a {@link TvpipeError} with a human
3
+ * message and a stable `code` to branch on.
4
+ */
5
+ export class TvpipeError extends Error {
6
+ name = "TvpipeError";
7
+ code;
8
+ kind;
9
+ device;
10
+ exitCode;
11
+ log;
12
+ details;
13
+ constructor(code, message, options = {}) {
14
+ super(message, options.cause === undefined ? undefined : { cause: options.cause });
15
+ this.code = code;
16
+ this.kind = options.kind;
17
+ this.device = options.device;
18
+ this.exitCode = options.exitCode;
19
+ this.log = options.log ?? [];
20
+ this.details = options.details ?? {};
21
+ }
22
+ }
23
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuDH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,IAAI,GAAG,aAAa,CAAC;IACrB,IAAI,CAAkB;IACtB,IAAI,CAAqB;IACzB,MAAM,CAAqB;IAC3B,QAAQ,CAA4B;IACpC,GAAG,CAAW;IACd,OAAO,CAA0B;IAE1C,YAAY,IAAqB,EAAE,OAAe,EAAE,UAA8B,EAAE;QAClF,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACnF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;IACvC,CAAC;CACF"}