pup-recorder 0.3.0 → 0.3.1

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.
@@ -1,8 +1,10 @@
1
1
  import { AV_SAMPLE_FMT_FLT } from 'node-av/constants';
2
2
  import { AV_SAMPLE_FMT_FLTP } from 'node-av/constants';
3
+ import { AVColorRange } from 'node-av/constants';
3
4
  import { AVPixelFormat } from 'node-av/constants';
4
5
  import { BrowserWindow } from 'electron';
5
6
  import { ChildProcess } from 'child_process';
7
+ import { Codec } from 'node-av';
6
8
  import { CodecContext } from 'node-av';
7
9
  import type { Debugger } from 'electron';
8
10
  import { EventEmitter } from 'events';
@@ -20,6 +22,9 @@ import { SpawnOptions } from 'child_process';
20
22
  import { Stream } from 'node-av';
21
23
  import z from 'zod';
22
24
 
25
+ /** Insert emulation prevention bytes (00 00 03) for Annex B compliance. */
26
+ export declare function addEmulationPrevention(nal: Buffer): Buffer;
27
+
23
28
  export declare function advanceVirtualTime(cdp: Debugger, budget: number): Promise<void>;
24
29
 
25
30
  export declare const ANNEX_B_START_CODE: Buffer<ArrayBuffer>;
@@ -67,11 +72,32 @@ export declare interface AudioEncoderOptions {
67
72
  muxer: FormatMuxer;
68
73
  }
69
74
 
75
+ export declare class BitReader {
76
+ private _bits;
77
+ pos: number;
78
+ constructor(data: Buffer);
79
+ get bits(): number[];
80
+ read(n: number): number;
81
+ readUe(): number;
82
+ }
83
+
84
+ export declare class BitWriter {
85
+ bits: number[];
86
+ w(val: number, n: number): void;
87
+ flag(val: boolean | number): void;
88
+ ue(val: number): void;
89
+ align(pad: number): void;
90
+ copy(src: number[], start: number, len: number): void;
91
+ }
92
+
93
+ export declare function buildAlphaChannelInfoSEI(): Buffer;
94
+
70
95
  /**
71
- * Build alpha_channel_info SEI message (payloadType=165).
72
- * Layout from x265 SEIAlphaChannelInfo::writeSEI.
96
+ * Build a complete alpha VPS from scratch, using the original NVENC VPS
97
+ * only as a source for the PTL (profile/tier/level) bytes.
98
+ * Matches x265 4.1 ENABLE_ALPHA VPS structure.
73
99
  */
74
- export declare function buildAlphaChannelInfoSEI(): Buffer;
100
+ export declare function buildAlphaVPS(vpsData: Buffer, width: number, height: number): Buffer;
75
101
 
76
102
  export declare function buildRust(): Promise<void>;
77
103
 
@@ -86,12 +112,7 @@ export declare function buildStegoHTML(targetURL: string, size: Size): string;
86
112
  */
87
113
  export declare function buildTickInjector(opts?: TickInjectorOptions): string;
88
114
 
89
- /**
90
- * Build unified extradata: base VPS (patched for alpha) + interleaved SPS/PPS.
91
- * Alpha SPS/PPS follow their base counterparts so the HVCC serializer
92
- * groups them into the same NAL array (required for multi-layer).
93
- */
94
- export declare function buildUnifiedExtradata(baseExtradata: Buffer, alphaExtradata: Buffer): Buffer;
115
+ export declare function buildUnifiedExtradata(opts: UnifiedExtradataOptions): Buffer;
95
116
 
96
117
  export declare const canIUseGPU: Promise<boolean>;
97
118
 
@@ -214,7 +235,7 @@ declare interface EncoderPipelineOptions {
214
235
  fps: number;
215
236
  outFile: string;
216
237
  withAudio?: boolean;
217
- disableGpu?: boolean;
238
+ disableHwCodec?: boolean;
218
239
  }
219
240
  export { EncoderPipelineOptions }
220
241
  export { EncoderPipelineOptions as EncoderPipelineOptions_alias_1 }
@@ -294,7 +315,6 @@ export declare interface HwVideoEncoderOptions {
294
315
  muxer: FormatMuxer;
295
316
  }
296
317
 
297
- /** Interleave base and alpha NALs for a single frame. */
298
318
  export declare function interleaveAccessUnits(baseNals: NalUnit[], alphaNals: NalUnit[]): Buffer;
299
319
 
300
320
  export declare interface IpcDonePayload {
@@ -426,6 +446,8 @@ export declare class NvencDualLayerEncoder implements Disposable {
426
446
  private drainInterleaved;
427
447
  }
428
448
 
449
+ export declare function openVideoCtx(opts: VideoCtxOptions, label: string): Promise<CodecContext>;
450
+
429
451
  export declare function packBits(bits: number[]): Buffer;
430
452
 
431
453
  declare function pargs(): string[];
@@ -481,6 +503,10 @@ declare const pupDisableGPU: boolean;
481
503
  export { pupDisableGPU }
482
504
  export { pupDisableGPU as pupDisableGPU_alias_1 }
483
505
 
506
+ declare const pupDisableHwCodec: boolean;
507
+ export { pupDisableHwCodec }
508
+ export { pupDisableHwCodec as pupDisableHwCodec_alias_1 }
509
+
484
510
  declare const pupExperimentalPuppeteer: boolean;
485
511
  export { pupExperimentalPuppeteer }
486
512
  export { pupExperimentalPuppeteer as pupExperimentalPuppeteer_alias_1 }
@@ -517,6 +543,9 @@ declare const pupUseInnerProxy: boolean;
517
543
  export { pupUseInnerProxy }
518
544
  export { pupUseInnerProxy as pupUseInnerProxy_alias_1 }
519
545
 
546
+ /** Remove emulation prevention bytes (00 00 03 → 00 00) from RBSP. */
547
+ export declare function removeEmulationPrevention(data: Buffer): Buffer;
548
+
520
549
  export declare function render(writer: IpcWriter, source: string, options: RenderOptions): Promise<IpcDonePayload>;
521
550
 
522
551
  declare type RenderOptions = z.infer<typeof RenderSchema>;
@@ -542,6 +571,7 @@ declare const RenderSchema: z.ZodObject<{
542
571
  useInnerProxy: z.ZodBoolean;
543
572
  deterministic: z.ZodBoolean;
544
573
  disableGpu: z.ZodBoolean;
574
+ disableHwCodec: z.ZodBoolean;
545
575
  }, z.core.$strip>;
546
576
  export { RenderSchema }
547
577
  export { RenderSchema as RenderSchema_alias_1 }
@@ -589,12 +619,31 @@ export declare interface TickInjectorOptions {
589
619
  skipFrameGuard?: boolean;
590
620
  }
591
621
 
622
+ export declare interface UnifiedExtradataOptions {
623
+ baseExtradata: Buffer;
624
+ alphaExtradata: Buffer;
625
+ width: number;
626
+ height: number;
627
+ }
628
+
592
629
  export declare function unsetInterceptor(window: BrowserWindow): void;
593
630
 
594
631
  declare function useRetry<Args extends any[], Ret>({ fn, maxAttempts, timeout }: RetryOptions<Args, Ret>): (...args: Args) => Promise<Ret>;
595
632
  export { useRetry }
596
633
  export { useRetry as useRetry_alias_1 }
597
634
 
635
+ export declare interface VideoCtxOptions {
636
+ codec: Codec;
637
+ width: number;
638
+ height: number;
639
+ fps: number;
640
+ bitrate: number;
641
+ pixelFormat: AVPixelFormat;
642
+ codecTag?: string;
643
+ colorRange?: AVColorRange;
644
+ options?: Record<string, string>;
645
+ }
646
+
598
647
  declare class VideoEncoder_2 implements Disposable {
599
648
  private readonly _ctx;
600
649
  private readonly _pkt;
@@ -615,7 +664,6 @@ export declare interface VideoEncoderOptions {
615
664
  fps: number;
616
665
  codecName: FFVideoEncoder;
617
666
  codecTag?: string;
618
- globalHeader: boolean;
619
667
  codecOpts: Record<string, string>;
620
668
  bitrate: number;
621
669
  pixelFormat: AVPixelFormat;
@@ -627,7 +675,7 @@ export declare interface VideoFactoryOptions {
627
675
  height: number;
628
676
  fps: number;
629
677
  bitrate?: number;
630
- disableGpu?: boolean;
678
+ disableHwCodec?: boolean;
631
679
  }
632
680
 
633
681
  export declare interface VideoSetup {