pup-recorder 0.3.6 → 0.3.8

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.
@@ -27,6 +27,8 @@ import z from 'zod';
27
27
  /** Insert emulation prevention bytes (00 00 03) for Annex B compliance. */
28
28
  export declare function addEmulationPrevention(nal: Buffer): Buffer;
29
29
 
30
+ export declare function advanceVideos(frame: WebFrameMain | undefined, timestampMs: number): Promise<void>;
31
+
30
32
  export declare function advanceVirtualTime(cdp: Debugger, budget: number): Promise<void>;
31
33
 
32
34
  export declare const ANNEX_B_START_CODE: Buffer<ArrayBuffer>;
@@ -182,6 +184,31 @@ export declare function createStegoURL(src: string, size: Size): string;
182
184
 
183
185
  export declare function debounce<T extends (...args: unknown[]) => void>(fn: T, delay?: number): T;
184
186
 
187
+ export declare class DecodeSession {
188
+ readonly meta: VideoMeta;
189
+ private readonly src;
190
+ private readonly frameCount;
191
+ private ffmpeg;
192
+ private parser;
193
+ private ring;
194
+ private runBaseIdx;
195
+ private nextFrameIdx;
196
+ private waiters;
197
+ private exhausted;
198
+ constructor(meta: VideoMeta, src: string, frameCount: number);
199
+ getFrame(idxRaw: number): Promise<Buffer>;
200
+ close(): void;
201
+ private needsReseek;
202
+ private reseek;
203
+ private waitFrame;
204
+ private onServe;
205
+ private refillIfNeeded;
206
+ private spawn;
207
+ private onStdout;
208
+ private killFfmpeg;
209
+ private rejectAllWaiters;
210
+ }
211
+
185
212
  export declare function decodeStego(bitmap: Buffer, size: Size): number | undefined;
186
213
 
187
214
  declare const DEFAULT_DURATION = 5;
@@ -217,6 +244,27 @@ export declare interface DoneMsg {
217
244
 
218
245
  export declare function drainPackets(ctx: CodecContext, pkt: Packet, stream: Stream, muxer: FormatMuxer): Promise<void>;
219
246
 
247
+ export declare class DualLayerMux {
248
+ private _s;
249
+ private _baseQueue;
250
+ private _alphaQueue;
251
+ constructor(s: DualLayerMuxOptions);
252
+ drain(muxer: FormatMuxer): Promise<void>;
253
+ desyncAfterEof(): string | undefined;
254
+ private receiveAll;
255
+ private snapshot;
256
+ private writePair;
257
+ }
258
+
259
+ export declare interface DualLayerMuxOptions {
260
+ baseCtx: CodecContext;
261
+ alphaCtx: CodecContext;
262
+ basePkt: Packet;
263
+ alphaPkt: Packet;
264
+ stream: Stream;
265
+ hevcCfg: NvencHevcConfig;
266
+ }
267
+
220
268
  export declare function electronOpts(disableGpu: boolean): Promise<string[]>;
221
269
 
222
270
  export declare function encodeNalHeader(type: number, layerId: number, temporalId: number): [number, number];
@@ -322,6 +370,17 @@ export declare class FrameDropStats {
322
370
  finalize(): FrameDropScore;
323
371
  }
324
372
 
373
+ export declare class FrameServer {
374
+ private sessions;
375
+ open(opts: OpenOptions): Promise<VideoMeta>;
376
+ getFrame(id: string, idx: number): Promise<Buffer>;
377
+ close(id: string): void;
378
+ closeAll(): void;
379
+ private must;
380
+ }
381
+
382
+ export declare const frameServer: FrameServer;
383
+
325
384
  export declare type HwEncoder = VideoToolboxEncoder | NvencDualLayerEncoder;
326
385
 
327
386
  export declare interface HwVideoEncoderOptions {
@@ -442,6 +501,8 @@ export declare function makeFrame(width: number, height: number, pixFmt: AVPixel
442
501
 
443
502
  export declare function makePacket(): Packet;
444
503
 
504
+ export declare const MAX_RENDER_ATTEMPTS = 3;
505
+
445
506
  export declare const NAL_BLA_W_LP = 16;
446
507
 
447
508
  export declare const NAL_HEADER_SIZE = 2;
@@ -480,13 +541,14 @@ export { noerr as noerr_alias_1 }
480
541
 
481
542
  export declare class NvencDualLayerEncoder implements Disposable {
482
543
  private _s;
544
+ private _mux;
483
545
  private _pts;
484
546
  private constructor();
485
547
  static create(opts: HwVideoEncoderOptions): Promise<NvencDualLayerEncoder>;
486
548
  encode(bgraFrame: Frame, muxer: FormatMuxer): Promise<void>;
487
549
  flush(muxer: FormatMuxer): Promise<void>;
488
550
  [Symbol.dispose](): void;
489
- private drainInterleaved;
551
+ private sendEof;
490
552
  }
491
553
 
492
554
  export declare interface NvencHevcConfig {
@@ -500,6 +562,11 @@ export declare interface NvencHevcConfig {
500
562
  ppsHasLoopFilterAcrossSlicesFlag: boolean;
501
563
  }
502
564
 
565
+ export declare interface OpenOptions {
566
+ src: string;
567
+ fps: number;
568
+ }
569
+
503
570
  export declare function openVideoCtx(opts: VideoCtxOptions, label: string): Promise<CodecContext>;
504
571
 
505
572
  export declare class OutputSink implements AsyncDisposable {
@@ -551,6 +618,19 @@ declare function periodical(callback: (count: number) => Promise<void> | void, m
551
618
  export { periodical }
552
619
  export { periodical as periodical_alias_1 }
553
620
 
621
+ export declare class PngStreamParser {
622
+ private buf;
623
+ feed(chunk: Buffer): Buffer[];
624
+ }
625
+
626
+ export declare function probe(src: string): Promise<ProbeResult>;
627
+
628
+ export declare interface ProbeResult {
629
+ width: number;
630
+ height: number;
631
+ duration: number;
632
+ }
633
+
554
634
  declare interface ProcessHandle {
555
635
  process: ChildProcess;
556
636
  wait: Promise<void>;
@@ -648,6 +728,7 @@ declare interface RetryOptions<Args extends any[], Ret> {
648
728
  fn: (...args: Args) => Promise<Ret>;
649
729
  maxAttempts?: number;
650
730
  timeout?: number;
731
+ signal?: AbortSignal;
651
732
  }
652
733
  export { RetryOptions }
653
734
  export { RetryOptions as RetryOptions_alias_1 }
@@ -681,6 +762,8 @@ export declare function send(cdp: Debugger, method: string, params?: object): Pr
681
762
 
682
763
  export declare function setInterceptor({ source, window, useInnerProxy }: NetworkOptions): void;
683
764
 
765
+ export declare function setupFrameProtocol(): void;
766
+
684
767
  export declare function setupPupProtocol(): void;
685
768
 
686
769
  export declare function shoot(options: IPCRenderOptions): Promise<IpcDonePayload>;
@@ -730,10 +813,12 @@ export declare interface UnifiedExtradataOptions {
730
813
 
731
814
  export declare function unsetInterceptor(window: BrowserWindow): void;
732
815
 
733
- declare function useRetry<Args extends any[], Ret>({ fn, maxAttempts, timeout }: RetryOptions<Args, Ret>): (...args: Args) => Promise<Ret>;
816
+ declare function useRetry<Args extends any[], Ret>({ fn, maxAttempts, timeout, signal }: RetryOptions<Args, Ret>): (...args: Args) => Promise<Ret>;
734
817
  export { useRetry }
735
818
  export { useRetry as useRetry_alias_1 }
736
819
 
820
+ export declare const VIDEO_SYMBOL = "__pup_video__";
821
+
737
822
  export declare interface VideoCtxOptions {
738
823
  codec: Codec;
739
824
  width: number;
@@ -773,6 +858,14 @@ export declare interface VideoEncoderOptions {
773
858
  muxer: FormatMuxer;
774
859
  }
775
860
 
861
+ export declare interface VideoMeta {
862
+ id: string;
863
+ width: number;
864
+ height: number;
865
+ fps: number;
866
+ duration: number;
867
+ }
868
+
776
869
  export declare interface VideoSetup {
777
870
  video?: VideoEncoder_2;
778
871
  hwVideo?: HwEncoder;
@@ -818,6 +911,8 @@ export declare interface WindowOptions {
818
911
  signal?: AbortSignal;
819
912
  }
820
913
 
914
+ export declare function withRerender<T>(action: () => Promise<T>): Promise<T>;
915
+
821
916
  declare function withTimeout<T>(p: Promise<T>, ms: number, label: string): Promise<T>;
822
917
  export { withTimeout }
823
918
  export { withTimeout as withTimeout_alias_1 }