pup-recorder 0.3.3 → 0.3.4

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.
@@ -6,7 +6,7 @@ import { BrowserWindow } from 'electron';
6
6
  import { ChildProcess } from 'child_process';
7
7
  import { Codec } from 'node-av';
8
8
  import { CodecContext } from 'node-av';
9
- import type { Debugger } from 'electron';
9
+ import { Debugger } from 'electron';
10
10
  import { EventEmitter } from 'events';
11
11
  import { FFAudioEncoder } from 'node-av/constants';
12
12
  import { FFVideoEncoder } from 'node-av/constants';
@@ -16,11 +16,10 @@ import { HardwareContext } from 'node-av/api';
16
16
  import type { NativeImage } from 'electron';
17
17
  import { Packet } from 'node-av';
18
18
  import { Size } from 'electron';
19
- import { Socket } from 'net';
20
19
  import { SoftwareScaleContext } from 'node-av';
21
20
  import { SpawnOptions } from 'child_process';
22
21
  import { Stream } from 'node-av';
23
- import { WebFrameMain } from 'electron';
22
+ import type { WebFrameMain } from 'electron';
24
23
  import z from 'zod';
25
24
 
26
25
  /** Insert emulation prevention bytes (00 00 03) for Annex B compliance. */
@@ -156,10 +155,6 @@ declare class ConcurrencyLimiter {
156
155
  export { ConcurrencyLimiter }
157
156
  export { ConcurrencyLimiter as ConcurrencyLimiter_alias_1 }
158
157
 
159
- export declare function connectIpc(socketPath: string): Promise<IpcWriter>;
160
-
161
- export declare function createIpcServer(socketPath: string): Promise<IpcServer>;
162
-
163
158
  export declare function createStegoURL(src: string, size: Size): string;
164
159
 
165
160
  export declare function createVideoEncoder(opts: VideoFactoryOptions, muxer: FormatMuxer): Promise<VideoSetup>;
@@ -192,6 +187,8 @@ declare const defaultRenderOptions: RenderOptions;
192
187
  export { defaultRenderOptions }
193
188
  export { defaultRenderOptions as defaultRenderOptions_alias_1 }
194
189
 
190
+ export declare function disposeWindow(win: BrowserWindow): Promise<void>;
191
+
195
192
  export declare function drainPackets(ctx: CodecContext, pkt: Packet, stream: Stream, muxer: FormatMuxer): Promise<void>;
196
193
 
197
194
  export declare function electronOpts(disableGpu: boolean): Promise<string[]>;
@@ -310,40 +307,26 @@ export declare interface IpcDonePayload {
310
307
  }
311
308
 
312
309
  export declare const enum IpcMsgType {
313
- PROGRESS = 1,
314
- DONE = 2,
315
- ERROR = 3
310
+ PROGRESS = "progress",
311
+ DONE = "done",
312
+ ERROR = "error"
316
313
  }
317
314
 
318
315
  export declare class IpcReader extends EventEmitter<{
319
316
  progress: [value: number];
320
- message: [type: IpcMsgType, buffer: Buffer];
317
+ message: [msg: Msg];
321
318
  done: [payload: IpcDonePayload];
322
319
  error: [error: Error];
323
320
  close: [];
324
321
  }> {
325
- private readonly _socket;
326
- private _chunks;
327
- private _buffered;
328
- constructor(_socket: Socket);
329
- private onData;
330
- private flush;
331
- private peek;
332
- private consume;
333
- }
334
-
335
- export declare interface IpcServer {
336
- waitForConnection(): Promise<IpcReader>;
337
- close(): void;
322
+ constructor(child: ChildProcess);
338
323
  }
339
324
 
340
325
  export declare class IpcWriter {
341
- private readonly _socket;
342
- constructor(_socket: Socket);
343
326
  writeProgress(value: number): void;
344
- writeError(error: string): void;
345
- writeDone(payload: IpcDonePayload): void;
346
- private write;
327
+ writeError(error: string): Promise<void>;
328
+ writeDone(payload: IpcDonePayload): Promise<void>;
329
+ private send;
347
330
  }
348
331
 
349
332
  export declare function isEmpty(image: NativeImage): boolean;
@@ -399,6 +382,17 @@ export declare function makeFrame(width: number, height: number, pixFmt: AVPixel
399
382
 
400
383
  export declare function makePacket(): Packet;
401
384
 
385
+ declare type Msg = {
386
+ type: IpcMsgType.PROGRESS;
387
+ value: number;
388
+ } | {
389
+ type: IpcMsgType.DONE;
390
+ payload: IpcDonePayload;
391
+ } | {
392
+ type: IpcMsgType.ERROR;
393
+ error: string;
394
+ };
395
+
402
396
  export declare const NAL_HEADER_SIZE = 2;
403
397
 
404
398
  export declare interface NalUnit {
@@ -463,6 +457,7 @@ export { periodical as periodical_alias_1 }
463
457
  declare interface ProcessHandle {
464
458
  process: ChildProcess;
465
459
  wait: Promise<void>;
460
+ get killed(): boolean;
466
461
  kill(): void;
467
462
  }
468
463
  export { ProcessHandle }
@@ -494,10 +489,6 @@ declare const pupDisableHwCodec: boolean;
494
489
  export { pupDisableHwCodec }
495
490
  export { pupDisableHwCodec as pupDisableHwCodec_alias_1 }
496
491
 
497
- declare const pupIpcSocket: string | undefined;
498
- export { pupIpcSocket }
499
- export { pupIpcSocket as pupIpcSocket_alias_1 }
500
-
501
492
  declare const pupLogLevel: number;
502
493
  export { pupLogLevel }
503
494
  export { pupLogLevel as pupLogLevel_alias_1 }
@@ -564,6 +555,8 @@ declare const RenderSchema: z.ZodObject<{
564
555
  export { RenderSchema }
565
556
  export { RenderSchema as RenderSchema_alias_1 }
566
557
 
558
+ export declare function resizeDrawable(cdp: Debugger, size: Size): Promise<void>;
559
+
567
560
  declare interface RetryOptions<Args extends any[], Ret> {
568
561
  fn: (...args: Args) => Promise<Ret>;
569
562
  maxAttempts?: number;
@@ -575,7 +568,12 @@ export { RetryOptions as RetryOptions_alias_1 }
575
568
  /** Rewrite nuh_layer_id in a NAL unit (returns copy). */
576
569
  export declare function rewriteNalLayerId(nal: Buffer, layerId: number): Buffer;
577
570
 
578
- export declare function runElectronApp(size: Size, args: unknown[], ipcSocketPath: string): Promise<ProcessHandle>;
571
+ export declare function runElectronApp({ args, display }: RunElectronAppOptions): Promise<ProcessHandle>;
572
+
573
+ export declare interface RunElectronAppOptions {
574
+ args: unknown[];
575
+ display?: number;
576
+ }
579
577
 
580
578
  export declare function setInterceptor({ source, window, useInnerProxy }: NetworkOptions): void;
581
579
 
@@ -585,6 +583,8 @@ export declare function setupPupProtocol(): void;
585
583
 
586
584
  export declare function shoot(writer: IpcWriter, source: string, options: RenderOptions): Promise<IpcDonePayload>;
587
585
 
586
+ export declare function sizeEquals(a: Size, b: Size): boolean;
587
+
588
588
  declare function sleep(ms: number): Promise<void>;
589
589
  export { sleep }
590
590
  export { sleep as sleep_alias_1 }
@@ -592,13 +592,17 @@ export { sleep as sleep_alias_1 }
592
592
  /** Split Annex B bitstream into NAL units. */
593
593
  export declare function splitNalUnits(bitstream: Buffer): NalUnit[];
594
594
 
595
- export declare function startStego(frame: WebFrameMain): Promise<void>;
595
+ export declare function startElectronCrashReporter(): void;
596
+
597
+ export declare function startStego(cdp: Debugger): Promise<void>;
598
+
599
+ export declare function startXvfb(width: number, height: number): XvfbHandle;
596
600
 
597
601
  export declare const STEGO_TICK_CHANNEL = "stego-tick";
598
602
 
599
- export declare function stopStego(frame: WebFrameMain): Promise<void>;
603
+ export declare function stopStego(cdp: Debugger): Promise<void>;
600
604
 
601
- export declare function swapBuffer(frame: WebFrameMain, expected: number): Promise<void>;
605
+ export declare function swapBuffer(cdp: Debugger, expected: number): Promise<void>;
602
606
 
603
607
  export declare function tick(frame: WebFrameMain | undefined, timestampMs: number): Promise<void>;
604
608
 
@@ -704,4 +708,9 @@ export declare interface WindowOptions {
704
708
  tolerant?: boolean;
705
709
  }
706
710
 
711
+ export declare interface XvfbHandle {
712
+ display: number;
713
+ stop(): void;
714
+ }
715
+
707
716
  export { }