@camera.ui/common 0.0.38 → 0.0.39

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 (42) hide show
  1. package/dist/camera/codec-hardware.d.ts +162 -43
  2. package/dist/camera/codec-hardware.js +612 -348
  3. package/dist/camera/codec-hardware.js.map +1 -1
  4. package/dist/camera/ffmpeg-process.js +1 -1
  5. package/dist/camera/ffmpeg-process.js.map +1 -1
  6. package/dist/camera/ffmpeg.d.ts +19 -2
  7. package/dist/camera/ffmpeg.js +56 -29
  8. package/dist/camera/ffmpeg.js.map +1 -1
  9. package/dist/camera/utils.d.ts +16 -9
  10. package/dist/camera/utils.js +316 -90
  11. package/dist/camera/utils.js.map +1 -1
  12. package/dist/index.d.ts +0 -1
  13. package/dist/index.js +0 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/logger/index.d.ts +4 -4
  16. package/dist/logger/index.js +22 -27
  17. package/dist/logger/index.js.map +1 -1
  18. package/dist/logger/test.js +0 -15
  19. package/dist/logger/test.js.map +1 -1
  20. package/dist/net/index.js +4 -4
  21. package/dist/net/index.js.map +1 -1
  22. package/dist/utils/index.d.ts +1 -0
  23. package/dist/utils/index.js +1 -0
  24. package/dist/utils/index.js.map +1 -1
  25. package/dist/utils/reactive.d.ts +11 -0
  26. package/dist/utils/reactive.js +32 -0
  27. package/dist/utils/reactive.js.map +1 -0
  28. package/dist/utils/utils.js +1 -0
  29. package/dist/utils/utils.js.map +1 -1
  30. package/package.json +15 -21
  31. package/dist/nats/index.d.ts +0 -3
  32. package/dist/nats/index.js +0 -4
  33. package/dist/nats/index.js.map +0 -1
  34. package/dist/nats/messageQueue.d.ts +0 -48
  35. package/dist/nats/messageQueue.js +0 -141
  36. package/dist/nats/messageQueue.js.map +0 -1
  37. package/dist/nats/nats.d.ts +0 -30
  38. package/dist/nats/nats.js +0 -85
  39. package/dist/nats/nats.js.map +0 -1
  40. package/dist/nats/packer.d.ts +0 -2
  41. package/dist/nats/packer.js +0 -17
  42. package/dist/nats/packer.js.map +0 -1
@@ -1,59 +1,178 @@
1
+ /**
2
+ * Represents a hardware-accelerated video codec
3
+ */
1
4
  export interface HWVideoCodec {
5
+ /** User-friendly name of the codec */
2
6
  name: string;
7
+ /** FFmpeg codec name */
3
8
  codecName: string;
9
+ /** Type of codec (software or hardware) */
10
+ type: 'software' | 'hardware';
4
11
  }
12
+ /** Array of string arguments for FFmpeg */
5
13
  export type HWArgs = string[];
6
- export interface HWVideoFile {
7
- width: number;
8
- height: number;
9
- path?: string;
10
- }
14
+ /** FFmpeg version information */
11
15
  export interface HWFFmpegVersion {
12
16
  major: number;
13
17
  minor: number;
14
18
  patch: number;
15
19
  }
16
- export type HwAccellMethod = 'auto' | 'cuda' | 'vaapi' | 'videotoolbox' | 'qsv' | 'rkmpp' | 'v4l2m2m';
20
+ /** Hardware acceleration methods supported by FFmpeg */
21
+ export type HwAccelMethod = 'auto' | 'cuda' | 'vaapi' | 'videotoolbox' | 'qsv' | 'rkmpp' | 'v4l2m2m' | 'opencl' | 'vulkan' | 'amf' | 'jetson';
22
+ /**
23
+ * Class to intelligently select the best VAAPI device
24
+ */
25
+ export declare class VaapiDeviceSelector {
26
+ private _selectedGpu;
27
+ /**
28
+ * Get the best available VAAPI device
29
+ * @returns Path to the VAAPI device
30
+ */
31
+ getSelectedGpu(): Promise<string>;
32
+ }
33
+ /**
34
+ * Class to handle hardware-accelerated video encoding with FFmpeg
35
+ */
17
36
  export declare class FFMpegHardware {
18
- static VideoCodecN264: HWVideoCodec;
19
- static VideoCodecN264H: HWVideoCodec;
20
- static VideoCodecI264: HWVideoCodec;
21
- static VideoCodecI264C: HWVideoCodec;
22
- static VideoCodecM264: HWVideoCodec;
23
- static VideoCodecV264: HWVideoCodec;
24
- static VideoCodecO264: HWVideoCodec;
25
- static VideoCodecRK264: HWVideoCodec;
26
- static VideoCodecJetson264: HWVideoCodec;
27
- static VideoCodecV4L2M2M264: HWVideoCodec;
28
- static VideoCodecVulkan264: HWVideoCodec;
29
- static VideoCodecN265: HWVideoCodec;
30
- static VideoCodecI265: HWVideoCodec;
31
- static VideoCodecM265: HWVideoCodec;
32
- static VideoCodecV265: HWVideoCodec;
33
- static VideoCodecRK265: HWVideoCodec;
34
- static VideoCodecJetson265: HWVideoCodec;
35
- static VideoCodecV4L2M2M265: HWVideoCodec;
36
- static VideoCodecVulkan265: HWVideoCodec;
37
- hwCodecSupport: HWVideoCodec[];
38
- private minHeight;
37
+ static readonly VideoCodecLibx264: HWVideoCodec;
38
+ static readonly VideoCodecNvenc264: HWVideoCodec;
39
+ static readonly VideoCodecQsv264: HWVideoCodec;
40
+ static readonly VideoCodecVaapi264: HWVideoCodec;
41
+ static readonly VideoCodecAmf264: HWVideoCodec;
42
+ static readonly VideoCodecToolbox264: HWVideoCodec;
43
+ static readonly VideoCodecOmx264: HWVideoCodec;
44
+ static readonly VideoCodecRkmpp264: HWVideoCodec;
45
+ static readonly VideoCodecJetson264: HWVideoCodec;
46
+ static readonly VideoCodecV4L2M2M264: HWVideoCodec;
47
+ static readonly VideoCodecVulkan264: HWVideoCodec;
48
+ static readonly VideoCodecOpenCL264: HWVideoCodec;
49
+ static readonly VideoCodecLibx265: HWVideoCodec;
50
+ static readonly VideoCodecNvenc265: HWVideoCodec;
51
+ static readonly VideoCodecQsv265: HWVideoCodec;
52
+ static readonly VideoCodecVaapi265: HWVideoCodec;
53
+ static readonly VideoCodecAmf265: HWVideoCodec;
54
+ static readonly VideoCodecToolbox265: HWVideoCodec;
55
+ static readonly VideoCodecOmx265: HWVideoCodec;
56
+ static readonly VideoCodecRkmpp265: HWVideoCodec;
57
+ static readonly VideoCodecJetson265: HWVideoCodec;
58
+ static readonly VideoCodecV4L2M2M265: HWVideoCodec;
59
+ static readonly VideoCodecVulkan265: HWVideoCodec;
60
+ static readonly VideoCodecOpenCL265: HWVideoCodec;
61
+ /** List of supported hardware codecs on the current system */
62
+ supportedCodecs: HWVideoCodec[];
39
63
  private scalerRegex;
40
64
  private _ffmpegPath;
41
- private ffmpegPathChanged;
42
- get ffmpegPath(): string;
65
+ private _userAgent;
66
+ private _vaapiDeviceSelector;
67
+ private _ffmpegVersion;
68
+ /** Get all supported H.264 codecs */
43
69
  static get H264Codecs(): HWVideoCodec[];
70
+ /** Get all supported H.265 codecs */
44
71
  static get H265Codecs(): HWVideoCodec[];
45
- constructor(_ffmpegPath?: string);
46
- setFfmpegPath(_ffmpegPath: string): void;
47
- initHWSupport(): Promise<void>;
48
- hwDeviceInit(args: HWArgs, toCodec: HWVideoCodec): HWArgs;
49
- codecInit(codec: HWVideoCodec): HWArgs;
50
- hwDeviceArgs(toCodec: HWVideoCodec): HWArgs;
51
- hwFilterInit(toCodec: HWVideoCodec, fullhw?: boolean): string;
52
- hwApplyScaleTemplate(sargs: string, toCodec: HWVideoCodec, targetWidth: number, targetHeight: number): string;
53
- hwApplyFullHWFilter(args: string, toCodec: HWVideoCodec, fullhw: boolean): string;
54
- hwMaxResFilter(toCodec: HWVideoCodec, vf: HWVideoFile, reqHeight: number, fullhw: boolean): string | null;
55
- getHwaccelMethod(codec: HWVideoCodec): HwAccellMethod;
56
- private executeFFmpeg;
57
- private calculateTargetDimensions;
58
- hwCodecMaxRes(codec: HWVideoCodec): [number, number];
72
+ /**
73
+ * Create a new FFMpegHardware instance
74
+ * @param _ffmpegPath Path to the FFmpeg executable
75
+ * @param userAgent Custom user agent for FFmpeg requests
76
+ */
77
+ constructor(_ffmpegPath?: string, userAgent?: string);
78
+ /**
79
+ * Get FFmpeg version information
80
+ * @returns Version object with major, minor, and patch numbers
81
+ */
82
+ getFFmpegVersion(): Promise<HWFFmpegVersion>;
83
+ /**
84
+ * Filter codecs based on current system architecture and OS
85
+ * @returns Filtered array of codecs that are likely to work on this system
86
+ */
87
+ getSystemCompatibleCodecs(): HWVideoCodec[];
88
+ /**
89
+ * Initialize hardware acceleration support by testing specific codecs
90
+ * @param codecs List of codecs to test
91
+ */
92
+ detectSupportedCodecsFromList(codecs: HWVideoCodec[]): Promise<void>;
93
+ /**
94
+ * Initialize hardware acceleration support by testing available codecs
95
+ */
96
+ detectSupportedCodecs(): Promise<void>;
97
+ /**
98
+ * Create platform-specific probe arguments for testing codec support
99
+ * @param codec Codec to test
100
+ * @returns FFmpeg arguments for testing
101
+ */
102
+ private createPlatformSpecificProbeArgs;
103
+ /**
104
+ * Set up hardware device initialization arguments
105
+ * @param args Existing FFmpeg arguments
106
+ * @param codec Target codec to set up
107
+ * @returns Updated arguments array
108
+ */
109
+ setupHardwareDevice(args: HWArgs, codec: HWVideoCodec): Promise<HWArgs>;
110
+ /**
111
+ * Add codec-specific encoding parameters
112
+ * @param codec Target codec
113
+ * @returns Array of FFmpeg arguments for the codec
114
+ */
115
+ getCodecSpecificArgs(codec: HWVideoCodec): HWArgs;
116
+ /**
117
+ * Create complete hardware filter chain for scaling and processing
118
+ * @param codec Target codec
119
+ * @param requestedWidth Desired output width
120
+ * @param requestedHeight Desired output height
121
+ * @param keepOnHardware Whether to keep processing on hardware
122
+ * @param pixelFormat Optional specific pixel format for output
123
+ * @returns Complete filter string or null
124
+ */
125
+ createHardwareFilter(codec: HWVideoCodec, requestedWidth?: number, requestedHeight?: number, keepOnHardware?: boolean, pixelFormat?: string): string | null;
126
+ /**
127
+ * Create filter chain for software encoders
128
+ * @param requestedWidth Desired output width
129
+ * @param requestedHeight Desired output height
130
+ * @param pixelFormat Optional specific pixel format for output
131
+ * @returns Filter string for software encoding
132
+ */
133
+ createSoftwareFilter(requestedWidth?: number, requestedHeight?: number, pixelFormat?: string): string;
134
+ /**
135
+ * Get initial filter setup for hardware pipeline
136
+ * @param codec Target codec
137
+ * @param keepOnHardware Whether to keep processing on hardware (true) or use hybrid pipeline (false)
138
+ * @returns Initial filter string
139
+ */
140
+ createInitialFilter(codec: HWVideoCodec, keepOnHardware?: boolean): string;
141
+ /**
142
+ * Apply hardware-specific scaling template
143
+ * @param currentFilter Current filter string
144
+ * @param codec Target codec
145
+ * @param width Target width
146
+ * @param height Target height
147
+ * @returns Updated filter string with hardware-specific scaling
148
+ */
149
+ applyScalingFilter(currentFilter: string, codec: HWVideoCodec, width: number, height: number): string;
150
+ /**
151
+ * Add final filters to bring data back to CPU if needed and handle format conversion
152
+ * @param currentFilter Current filter string
153
+ * @param codec Target codec
154
+ * @param keepOnHardware Whether to keep processing on hardware
155
+ * @param pixelFormat Optional specific pixel format for output
156
+ * @returns Final filter chain
157
+ */
158
+ finalizePipeline(currentFilter: string, codec: HWVideoCodec, keepOnHardware: boolean, pixelFormat?: string): string;
159
+ /**
160
+ * Determine the hardware acceleration method used by a codec
161
+ * @param codec Target codec
162
+ * @returns Hardware acceleration method
163
+ */
164
+ getHardwareMethod(codec: HWVideoCodec): HwAccelMethod;
165
+ /**
166
+ * Execute FFmpeg with given arguments
167
+ * @param args FFmpeg arguments
168
+ * @returns Promise that resolves when FFmpeg completes successfully
169
+ */
170
+ private runFFmpeg;
171
+ /**
172
+ * Calculate output dimensions
173
+ * @param targetWidth Desired output width
174
+ * @param targetHeight Desired output height
175
+ * @returns [width, height] tuple with even dimensions
176
+ */
177
+ private calculateOutputDimensions;
59
178
  }