pup-recorder 0.3.4 → 0.3.5

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.
@@ -13,6 +13,7 @@ import { FFVideoEncoder } from 'node-av/constants';
13
13
  import { FormatContext } from 'node-av';
14
14
  import { Frame } from 'node-av';
15
15
  import { HardwareContext } from 'node-av/api';
16
+ import { HardwareFramesContext } from 'node-av';
16
17
  import type { NativeImage } from 'electron';
17
18
  import { Packet } from 'node-av';
18
19
  import { Size } from 'electron';
@@ -155,9 +156,9 @@ declare class ConcurrencyLimiter {
155
156
  export { ConcurrencyLimiter }
156
157
  export { ConcurrencyLimiter as ConcurrencyLimiter_alias_1 }
157
158
 
158
- export declare function createStegoURL(src: string, size: Size): string;
159
+ export declare function createHwVideoEncoder(opts: HwVideoFactoryOptions, muxer: FormatMuxer): Promise<VideoSetup>;
159
160
 
160
- export declare function createVideoEncoder(opts: VideoFactoryOptions, muxer: FormatMuxer): Promise<VideoSetup>;
161
+ export declare function createStegoURL(src: string, size: Size): string;
161
162
 
162
163
  export declare function debounce<T extends (...args: unknown[]) => void>(fn: T, delay?: number): T;
163
164
 
@@ -189,6 +190,11 @@ export { defaultRenderOptions as defaultRenderOptions_alias_1 }
189
190
 
190
191
  export declare function disposeWindow(win: BrowserWindow): Promise<void>;
191
192
 
193
+ export declare interface DoneMsg {
194
+ type: IpcMsgType.DONE;
195
+ payload: IpcDonePayload;
196
+ }
197
+
192
198
  export declare function drainPackets(ctx: CodecContext, pkt: Packet, stream: Stream, muxer: FormatMuxer): Promise<void>;
193
199
 
194
200
  export declare function electronOpts(disableGpu: boolean): Promise<string[]>;
@@ -204,7 +210,7 @@ declare class EncoderPipeline {
204
210
  encodeBGRA(input: Buffer): Promise<void>;
205
211
  encodePNG(pngData: Buffer): Promise<void>;
206
212
  encodeAudio(pcm: Buffer): Promise<void>;
207
- finish(): Promise<string>;
213
+ finish(): Promise<string[]>;
208
214
  [Symbol.asyncDispose](): Promise<void>;
209
215
  private free;
210
216
  private bgraFrame;
@@ -227,10 +233,17 @@ declare type EnvParser<T> = (value: unknown) => T;
227
233
  export { EnvParser }
228
234
  export { EnvParser as EnvParser_alias_1 }
229
235
 
236
+ export declare interface ErrorMsg {
237
+ type: IpcMsgType.ERROR;
238
+ error: string;
239
+ }
240
+
230
241
  declare function exec(cmd: string, options?: SpawnOptions): ProcessHandle;
231
242
  export { exec }
232
243
  export { exec as exec_alias_1 }
233
244
 
245
+ export declare function extractAlphaToYuv420pBuffer(bgraFrame: Frame, buf: Buffer): void;
246
+
234
247
  export declare interface FixedBufferWriter {
235
248
  new (path: string, bufferSize: number, queueDepth?: number): FixedBufferWriter;
236
249
  write(buffer: Buffer): void;
@@ -298,6 +311,15 @@ export declare interface HwVideoEncoderOptions {
298
311
  muxer: FormatMuxer;
299
312
  }
300
313
 
314
+ export declare interface HwVideoFactoryOptions {
315
+ width: number;
316
+ height: number;
317
+ fps: number;
318
+ bitrate?: number;
319
+ disableHwCodec?: boolean;
320
+ sharedHw?: HardwareContext;
321
+ }
322
+
301
323
  export declare function interleaveAccessUnits(baseNals: NalUnit[], alphaNals: NalUnit[]): Buffer;
302
324
 
303
325
  export declare interface IpcDonePayload {
@@ -306,19 +328,23 @@ export declare interface IpcDonePayload {
306
328
  outFile: string;
307
329
  }
308
330
 
331
+ export declare interface IpcEvents {
332
+ progress: [value: number];
333
+ message: [msg: IpcMsg];
334
+ done: [payload: IpcDonePayload];
335
+ error: [error: Error];
336
+ close: [code: number | null];
337
+ }
338
+
339
+ export declare type IpcMsg = ProgressMsg | DoneMsg | ErrorMsg;
340
+
309
341
  export declare const enum IpcMsgType {
310
342
  PROGRESS = "progress",
311
343
  DONE = "done",
312
344
  ERROR = "error"
313
345
  }
314
346
 
315
- export declare class IpcReader extends EventEmitter<{
316
- progress: [value: number];
317
- message: [msg: Msg];
318
- done: [payload: IpcDonePayload];
319
- error: [error: Error];
320
- close: [];
321
- }> {
347
+ export declare class IpcReader extends EventEmitter<IpcEvents> {
322
348
  constructor(child: ChildProcess);
323
349
  }
324
350
 
@@ -382,17 +408,6 @@ export declare function makeFrame(width: number, height: number, pixFmt: AVPixel
382
408
 
383
409
  export declare function makePacket(): Packet;
384
410
 
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
-
396
411
  export declare const NAL_HEADER_SIZE = 2;
397
412
 
398
413
  export declare interface NalUnit {
@@ -416,8 +431,6 @@ export declare class NvencDualLayerEncoder implements Disposable {
416
431
  private _seiBuffer;
417
432
  private _pts;
418
433
  private _seiInjected;
419
- private _alphaBuf?;
420
- private _alphaFrame?;
421
434
  private constructor();
422
435
  static create(opts: HwVideoEncoderOptions): Promise<NvencDualLayerEncoder>;
423
436
  encode(bgraFrame: Frame, muxer: FormatMuxer): Promise<void>;
@@ -428,6 +441,24 @@ export declare class NvencDualLayerEncoder implements Disposable {
428
441
 
429
442
  export declare function openVideoCtx(opts: VideoCtxOptions, label: string): Promise<CodecContext>;
430
443
 
444
+ export declare class OutputSink implements AsyncDisposable {
445
+ private _s;
446
+ private _disposed;
447
+ private constructor();
448
+ static kindFromPath(path: string): SinkKind;
449
+ static create(opts: SinkOptions): Promise<OutputSink>;
450
+ private static mp4Video;
451
+ private static webmVideo;
452
+ private static audioFor;
453
+ setInputRate(sampleRate: number): void;
454
+ encodeBGRA(bgraFrame: Frame): Promise<void>;
455
+ encodeDecodedFrame(src: Frame): Promise<void>;
456
+ encodeAudio(pcm: Buffer): Promise<void>;
457
+ flush(): Promise<void>;
458
+ [Symbol.asyncDispose](): Promise<void>;
459
+ private swEncode;
460
+ }
461
+
431
462
  export declare function packBits(bits: number[]): Buffer;
432
463
 
433
464
  declare function pargs(): string[];
@@ -463,6 +494,11 @@ declare interface ProcessHandle {
463
494
  export { ProcessHandle }
464
495
  export { ProcessHandle as ProcessHandle_alias_1 }
465
496
 
497
+ export declare interface ProgressMsg {
498
+ type: IpcMsgType.PROGRESS;
499
+ value: number;
500
+ }
501
+
466
502
  export declare function proxiedUrl(url: string): string;
467
503
 
468
504
  declare function pup(source: string, options: Partial<PupOptions>): Promise<PupResult>;
@@ -568,13 +604,14 @@ export { RetryOptions as RetryOptions_alias_1 }
568
604
  /** Rewrite nuh_layer_id in a NAL unit (returns copy). */
569
605
  export declare function rewriteNalLayerId(nal: Buffer, layerId: number): Buffer;
570
606
 
571
- export declare function runElectronApp({ args, display }: RunElectronAppOptions): Promise<ProcessHandle>;
607
+ export declare function runElectronApp({ args }: RunElectronAppOptions): Promise<ProcessHandle>;
572
608
 
573
609
  export declare interface RunElectronAppOptions {
574
610
  args: unknown[];
575
- display?: number;
576
611
  }
577
612
 
613
+ export declare function send(cdp: Debugger, method: string, params?: object): Promise<unknown>;
614
+
578
615
  export declare function setInterceptor({ source, window, useInnerProxy }: NetworkOptions): void;
579
616
 
580
617
  export declare function setupAudioCapture({ encoder, getVideoTimeMs, onError, }: AudioCaptureOptions): Promise<AudioCapture>;
@@ -583,6 +620,19 @@ export declare function setupPupProtocol(): void;
583
620
 
584
621
  export declare function shoot(writer: IpcWriter, source: string, options: RenderOptions): Promise<IpcDonePayload>;
585
622
 
623
+ export declare type SinkKind = "mp4" | "webm";
624
+
625
+ export declare interface SinkOptions {
626
+ outFile: string;
627
+ kind: SinkKind;
628
+ width: number;
629
+ height: number;
630
+ fps: number;
631
+ withAudio: boolean;
632
+ disableHwCodec: boolean;
633
+ sharedHw?: HardwareContext;
634
+ }
635
+
586
636
  export declare function sizeEquals(a: Size, b: Size): boolean;
587
637
 
588
638
  declare function sleep(ms: number): Promise<void>;
@@ -596,8 +646,6 @@ export declare function startElectronCrashReporter(): void;
596
646
 
597
647
  export declare function startStego(cdp: Debugger): Promise<void>;
598
648
 
599
- export declare function startXvfb(width: number, height: number): XvfbHandle;
600
-
601
649
  export declare const STEGO_TICK_CHANNEL = "stego-tick";
602
650
 
603
651
  export declare function stopStego(cdp: Debugger): Promise<void>;
@@ -631,6 +679,7 @@ export declare interface VideoCtxOptions {
631
679
  codecTag?: string;
632
680
  colorRange?: AVColorRange;
633
681
  options?: Record<string, string>;
682
+ hwFramesCtx?: HardwareFramesContext;
634
683
  }
635
684
 
636
685
  declare class VideoEncoder_2 implements Disposable {
@@ -659,19 +708,12 @@ export declare interface VideoEncoderOptions {
659
708
  muxer: FormatMuxer;
660
709
  }
661
710
 
662
- export declare interface VideoFactoryOptions {
663
- width: number;
664
- height: number;
665
- fps: number;
666
- bitrate?: number;
667
- disableHwCodec?: boolean;
668
- }
669
-
670
711
  export declare interface VideoSetup {
671
712
  video?: VideoEncoder_2;
672
713
  hwVideo?: HwEncoder;
673
714
  codec?: CodecState_2;
674
715
  hw?: HardwareContext;
716
+ ownsHw: boolean;
675
717
  }
676
718
 
677
719
  export declare class VideoToolboxEncoder implements Disposable {
@@ -708,9 +750,8 @@ export declare interface WindowOptions {
708
750
  tolerant?: boolean;
709
751
  }
710
752
 
711
- export declare interface XvfbHandle {
712
- display: number;
713
- stop(): void;
714
- }
753
+ declare function withTimeout<T>(p: Promise<T>, ms: number, label: string): Promise<T>;
754
+ export { withTimeout }
755
+ export { withTimeout as withTimeout_alias_1 }
715
756
 
716
757
  export { }