webcodecs-node 0.2.2 → 0.5.0
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.
- package/README.md +4 -0
- package/dist/__tests__/AudioData.test.js +2 -1
- package/dist/__tests__/AudioData.test.js.map +1 -1
- package/dist/__tests__/AudioDecoder.test.js +8 -8
- package/dist/__tests__/AudioDecoder.test.js.map +1 -1
- package/dist/__tests__/AudioEncoder.test.js +3 -3
- package/dist/__tests__/AudioEncoder.test.js.map +1 -1
- package/dist/__tests__/EncodedChunks.test.js +3 -2
- package/dist/__tests__/EncodedChunks.test.js.map +1 -1
- package/dist/__tests__/HardwareAcceleration.test.js +2 -1
- package/dist/__tests__/HardwareAcceleration.test.js.map +1 -1
- package/dist/__tests__/ImageDecoder.test.js +16 -45
- package/dist/__tests__/ImageDecoder.test.js.map +1 -1
- package/dist/__tests__/ImageDecoder.wpt.test.d.ts +8 -0
- package/dist/__tests__/ImageDecoder.wpt.test.d.ts.map +1 -0
- package/dist/__tests__/ImageDecoder.wpt.test.js +135 -0
- package/dist/__tests__/ImageDecoder.wpt.test.js.map +1 -0
- package/dist/__tests__/NodeAvDecoder.test.d.ts +2 -0
- package/dist/__tests__/NodeAvDecoder.test.d.ts.map +1 -0
- package/dist/__tests__/NodeAvDecoder.test.js +206 -0
- package/dist/__tests__/NodeAvDecoder.test.js.map +1 -0
- package/dist/__tests__/NodeAvEncoder.test.d.ts +2 -0
- package/dist/__tests__/NodeAvEncoder.test.d.ts.map +1 -0
- package/dist/__tests__/NodeAvEncoder.test.js +176 -0
- package/dist/__tests__/NodeAvEncoder.test.js.map +1 -0
- package/dist/__tests__/VideoDecoder.test.js +5 -5
- package/dist/__tests__/VideoDecoder.test.js.map +1 -1
- package/dist/__tests__/VideoEncoder.test.js +3 -3
- package/dist/__tests__/VideoEncoder.test.js.map +1 -1
- package/dist/__tests__/VideoFrame.test.js +4 -1
- package/dist/__tests__/VideoFrame.test.js.map +1 -1
- package/dist/backends/index.d.ts +3 -0
- package/dist/backends/index.d.ts.map +1 -0
- package/dist/backends/index.js +2 -0
- package/dist/backends/index.js.map +1 -0
- package/dist/backends/types.d.ts +168 -0
- package/dist/backends/types.d.ts.map +1 -0
- package/dist/backends/types.js +25 -0
- package/dist/backends/types.js.map +1 -0
- package/dist/codec-utils/audio-codecs.d.ts +60 -0
- package/dist/codec-utils/audio-codecs.d.ts.map +1 -0
- package/dist/codec-utils/audio-codecs.js +117 -0
- package/dist/codec-utils/audio-codecs.js.map +1 -0
- package/dist/codec-utils/formats.d.ts +42 -0
- package/dist/codec-utils/formats.d.ts.map +1 -0
- package/dist/codec-utils/formats.js +147 -0
- package/dist/codec-utils/formats.js.map +1 -0
- package/dist/codec-utils/index.d.ts +9 -0
- package/dist/codec-utils/index.d.ts.map +1 -0
- package/dist/codec-utils/index.js +12 -0
- package/dist/codec-utils/index.js.map +1 -0
- package/dist/codec-utils/types.d.ts +87 -0
- package/dist/codec-utils/types.d.ts.map +1 -0
- package/dist/codec-utils/types.js +10 -0
- package/dist/codec-utils/types.js.map +1 -0
- package/dist/containers/Demuxer.d.ts +114 -0
- package/dist/containers/Demuxer.d.ts.map +1 -0
- package/dist/containers/Demuxer.js +256 -0
- package/dist/containers/Demuxer.js.map +1 -0
- package/dist/containers/Muxer.d.ts +142 -0
- package/dist/containers/Muxer.d.ts.map +1 -0
- package/dist/containers/Muxer.js +295 -0
- package/dist/containers/Muxer.js.map +1 -0
- package/dist/containers/extract.d.ts +25 -0
- package/dist/containers/extract.d.ts.map +1 -0
- package/dist/containers/extract.js +64 -0
- package/dist/containers/extract.js.map +1 -0
- package/dist/containers/index.d.ts +40 -0
- package/dist/containers/index.d.ts.map +1 -0
- package/dist/containers/index.js +41 -0
- package/dist/containers/index.js.map +1 -0
- package/dist/containers/transcode.d.ts +138 -0
- package/dist/containers/transcode.d.ts.map +1 -0
- package/dist/containers/transcode.js +536 -0
- package/dist/containers/transcode.js.map +1 -0
- package/dist/core/AudioData.d.ts +5 -1
- package/dist/core/AudioData.d.ts.map +1 -1
- package/dist/core/AudioData.js +69 -13
- package/dist/core/AudioData.js.map +1 -1
- package/dist/core/EncodedAudioChunk.d.ts +1 -1
- package/dist/core/EncodedAudioChunk.d.ts.map +1 -1
- package/dist/core/EncodedAudioChunk.js +1 -1
- package/dist/core/EncodedAudioChunk.js.map +1 -1
- package/dist/core/EncodedVideoChunk.d.ts.map +1 -1
- package/dist/core/EncodedVideoChunk.js +3 -19
- package/dist/core/EncodedVideoChunk.js.map +1 -1
- package/dist/core/VideoFrame.d.ts +31 -11
- package/dist/core/VideoFrame.d.ts.map +1 -1
- package/dist/core/VideoFrame.js +244 -81
- package/dist/core/VideoFrame.js.map +1 -1
- package/dist/decoders/AudioDecoder.d.ts +14 -12
- package/dist/decoders/AudioDecoder.d.ts.map +1 -1
- package/dist/decoders/AudioDecoder.js +113 -173
- package/dist/decoders/AudioDecoder.js.map +1 -1
- package/dist/decoders/ImageDecoder.d.ts +1 -3
- package/dist/decoders/ImageDecoder.d.ts.map +1 -1
- package/dist/decoders/ImageDecoder.js +39 -192
- package/dist/decoders/ImageDecoder.js.map +1 -1
- package/dist/decoders/VideoDecoder.d.ts +14 -13
- package/dist/decoders/VideoDecoder.d.ts.map +1 -1
- package/dist/decoders/VideoDecoder.js +115 -166
- package/dist/decoders/VideoDecoder.js.map +1 -1
- package/dist/demos/demo-1080p-transcode.d.ts +8 -0
- package/dist/demos/demo-1080p-transcode.d.ts.map +1 -0
- package/dist/demos/demo-1080p-transcode.js +188 -0
- package/dist/demos/demo-1080p-transcode.js.map +1 -0
- package/dist/demos/demo-containers.d.ts +7 -0
- package/dist/demos/demo-containers.d.ts.map +1 -0
- package/dist/demos/demo-containers.js +140 -0
- package/dist/demos/demo-containers.js.map +1 -0
- package/dist/demos/demo-conversion.js +2 -2
- package/dist/demos/demo-conversion.js.map +1 -1
- package/dist/demos/demo-four-corners.d.ts +6 -0
- package/dist/demos/demo-four-corners.d.ts.map +1 -0
- package/dist/demos/demo-four-corners.js +218 -0
- package/dist/demos/demo-four-corners.js.map +1 -0
- package/dist/demos/demo-hwaccel-conversion.js +1 -1
- package/dist/demos/demo-hwaccel-conversion.js.map +1 -1
- package/dist/demos/demo-hwaccel.js +1 -1
- package/dist/demos/demo-hwaccel.js.map +1 -1
- package/dist/demos/demo-samples.js +232 -68
- package/dist/demos/demo-samples.js.map +1 -1
- package/dist/demos/demo-streaming.js +6 -6
- package/dist/demos/demo-streaming.js.map +1 -1
- package/dist/encoders/AudioEncoder.d.ts +14 -13
- package/dist/encoders/AudioEncoder.d.ts.map +1 -1
- package/dist/encoders/AudioEncoder.js +138 -228
- package/dist/encoders/AudioEncoder.js.map +1 -1
- package/dist/encoders/VideoEncoder.d.ts +13 -14
- package/dist/encoders/VideoEncoder.d.ts.map +1 -1
- package/dist/encoders/VideoEncoder.js +92 -161
- package/dist/encoders/VideoEncoder.js.map +1 -1
- package/dist/ffmpeg/index.d.ts +3 -2
- package/dist/ffmpeg/index.d.ts.map +1 -1
- package/dist/ffmpeg/index.js +3 -3
- package/dist/ffmpeg/index.js.map +1 -1
- package/dist/formats/conversions/batch-converter.d.ts +61 -0
- package/dist/formats/conversions/batch-converter.d.ts.map +1 -0
- package/dist/formats/conversions/batch-converter.js +274 -0
- package/dist/formats/conversions/batch-converter.js.map +1 -0
- package/dist/formats/conversions/frame-converter.d.ts +17 -0
- package/dist/formats/conversions/frame-converter.d.ts.map +1 -1
- package/dist/formats/conversions/frame-converter.js +144 -10
- package/dist/formats/conversions/frame-converter.js.map +1 -1
- package/dist/formats/conversions/index.d.ts +2 -0
- package/dist/formats/conversions/index.d.ts.map +1 -1
- package/dist/formats/conversions/index.js +4 -0
- package/dist/formats/conversions/index.js.map +1 -1
- package/dist/hardware/decoder-args.d.ts +2 -7
- package/dist/hardware/decoder-args.d.ts.map +1 -1
- package/dist/hardware/decoder-args.js +2 -32
- package/dist/hardware/decoder-args.js.map +1 -1
- package/dist/hardware/detection.d.ts +1 -1
- package/dist/hardware/detection.d.ts.map +1 -1
- package/dist/hardware/detection.js +54 -27
- package/dist/hardware/detection.js.map +1 -1
- package/dist/hardware/encoder-args.d.ts +2 -11
- package/dist/hardware/encoder-args.d.ts.map +1 -1
- package/dist/hardware/encoder-args.js +2 -71
- package/dist/hardware/encoder-args.js.map +1 -1
- package/dist/hardware/index.d.ts +2 -2
- package/dist/hardware/index.d.ts.map +1 -1
- package/dist/hardware/index.js +2 -2
- package/dist/hardware/index.js.map +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/dist/mediabunny/FFmpegAudioDecoder.d.ts +4 -17
- package/dist/mediabunny/FFmpegAudioDecoder.d.ts.map +1 -1
- package/dist/mediabunny/FFmpegAudioDecoder.js +57 -185
- package/dist/mediabunny/FFmpegAudioDecoder.js.map +1 -1
- package/dist/mediabunny/FFmpegAudioEncoder.d.ts +6 -39
- package/dist/mediabunny/FFmpegAudioEncoder.d.ts.map +1 -1
- package/dist/mediabunny/FFmpegAudioEncoder.js +66 -329
- package/dist/mediabunny/FFmpegAudioEncoder.js.map +1 -1
- package/dist/mediabunny/FFmpegVideoDecoder.d.ts +5 -38
- package/dist/mediabunny/FFmpegVideoDecoder.d.ts.map +1 -1
- package/dist/mediabunny/FFmpegVideoDecoder.js +39 -283
- package/dist/mediabunny/FFmpegVideoDecoder.js.map +1 -1
- package/dist/mediabunny/FFmpegVideoEncoder.d.ts +9 -37
- package/dist/mediabunny/FFmpegVideoEncoder.d.ts.map +1 -1
- package/dist/mediabunny/FFmpegVideoEncoder.js +49 -336
- package/dist/mediabunny/FFmpegVideoEncoder.js.map +1 -1
- package/dist/node-av/HardwarePipeline.d.ts +36 -0
- package/dist/node-av/HardwarePipeline.d.ts.map +1 -0
- package/dist/node-av/HardwarePipeline.js +243 -0
- package/dist/node-av/HardwarePipeline.js.map +1 -0
- package/dist/node-av/NodeAvAudioDecoder.d.ts +46 -0
- package/dist/node-av/NodeAvAudioDecoder.d.ts.map +1 -0
- package/dist/node-av/NodeAvAudioDecoder.js +350 -0
- package/dist/node-av/NodeAvAudioDecoder.js.map +1 -0
- package/dist/node-av/NodeAvAudioEncoder.d.ts +50 -0
- package/dist/node-av/NodeAvAudioEncoder.d.ts.map +1 -0
- package/dist/node-av/NodeAvAudioEncoder.js +506 -0
- package/dist/node-av/NodeAvAudioEncoder.js.map +1 -0
- package/dist/node-av/NodeAvImageDecoder.d.ts +114 -0
- package/dist/node-av/NodeAvImageDecoder.d.ts.map +1 -0
- package/dist/node-av/NodeAvImageDecoder.js +406 -0
- package/dist/node-av/NodeAvImageDecoder.js.map +1 -0
- package/dist/node-av/NodeAvVideoDecoder.d.ts +43 -0
- package/dist/node-av/NodeAvVideoDecoder.d.ts.map +1 -0
- package/dist/node-av/NodeAvVideoDecoder.js +365 -0
- package/dist/node-av/NodeAvVideoDecoder.js.map +1 -0
- package/dist/node-av/NodeAvVideoEncoder.d.ts +56 -0
- package/dist/node-av/NodeAvVideoEncoder.d.ts.map +1 -0
- package/dist/node-av/NodeAvVideoEncoder.js +509 -0
- package/dist/node-av/NodeAvVideoEncoder.js.map +1 -0
- package/dist/polyfill.d.ts.map +1 -1
- package/dist/polyfill.js +11 -9
- package/dist/polyfill.js.map +1 -1
- package/dist/utils/aac.d.ts.map +1 -1
- package/dist/utils/aac.js +6 -0
- package/dist/utils/aac.js.map +1 -1
- package/dist/utils/buffer-pool.d.ts +109 -0
- package/dist/utils/buffer-pool.d.ts.map +1 -0
- package/dist/utils/buffer-pool.js +278 -0
- package/dist/utils/buffer-pool.js.map +1 -0
- package/dist/utils/codec-cache.d.ts +65 -0
- package/dist/utils/codec-cache.d.ts.map +1 -0
- package/dist/utils/codec-cache.js +116 -0
- package/dist/utils/codec-cache.js.map +1 -0
- package/dist/utils/errors.d.ts +62 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +84 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/event-target.d.ts +42 -0
- package/dist/utils/event-target.d.ts.map +1 -0
- package/dist/utils/event-target.js +96 -0
- package/dist/utils/event-target.js.map +1 -0
- package/dist/utils/hardware-pool.d.ts +88 -0
- package/dist/utils/hardware-pool.d.ts.map +1 -0
- package/dist/utils/hardware-pool.js +266 -0
- package/dist/utils/hardware-pool.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +12 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/timeout.d.ts +44 -0
- package/dist/utils/timeout.d.ts.map +1 -0
- package/dist/utils/timeout.js +73 -0
- package/dist/utils/timeout.js.map +1 -0
- package/dist/utils/type-guards.d.ts +11 -1
- package/dist/utils/type-guards.d.ts.map +1 -1
- package/dist/utils/type-guards.js.map +1 -1
- package/package.json +20 -34
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NodeAvImageDecoder - Node-av based image decoder
|
|
3
|
+
*
|
|
4
|
+
* Decodes still images and animated images (GIF, APNG) using node-av
|
|
5
|
+
* native bindings (FFmpeg's libav* libraries).
|
|
6
|
+
*
|
|
7
|
+
* Note: Animated WebP is NOT fully supported due to FFmpeg's webp demuxer
|
|
8
|
+
* skipping ANIM/ANMF chunks. Consider using a dedicated WebP library for
|
|
9
|
+
* animated WebP support.
|
|
10
|
+
*/
|
|
11
|
+
import type { VideoColorSpaceInit } from '../formats/index.js';
|
|
12
|
+
export interface DecodedImageFrame {
|
|
13
|
+
data: Uint8Array;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
timestamp: number;
|
|
17
|
+
duration: number;
|
|
18
|
+
complete: boolean;
|
|
19
|
+
colorSpace?: VideoColorSpaceInit;
|
|
20
|
+
}
|
|
21
|
+
export interface ImageDecoderConfig {
|
|
22
|
+
mimeType: string;
|
|
23
|
+
data: Uint8Array;
|
|
24
|
+
desiredWidth?: number;
|
|
25
|
+
desiredHeight?: number;
|
|
26
|
+
colorSpace?: VideoColorSpaceInit;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Decode images using node-av native bindings
|
|
30
|
+
*/
|
|
31
|
+
export declare class NodeAvImageDecoder {
|
|
32
|
+
private decoder;
|
|
33
|
+
private demuxer;
|
|
34
|
+
private formatContext;
|
|
35
|
+
private stream;
|
|
36
|
+
private filter;
|
|
37
|
+
private config;
|
|
38
|
+
private frames;
|
|
39
|
+
private closed;
|
|
40
|
+
private static readonly DUMMY_TIME_BASE;
|
|
41
|
+
private static readonly DEFAULT_FRAME_DURATION;
|
|
42
|
+
constructor(config: ImageDecoderConfig);
|
|
43
|
+
/**
|
|
44
|
+
* Decode all frames from the image data
|
|
45
|
+
*/
|
|
46
|
+
decode(): Promise<DecodedImageFrame[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Check if this format requires Demuxer for proper decoding
|
|
49
|
+
*/
|
|
50
|
+
private usesDemuxer;
|
|
51
|
+
/**
|
|
52
|
+
* Get the codec ID for the MIME type
|
|
53
|
+
*/
|
|
54
|
+
private getCodecId;
|
|
55
|
+
/**
|
|
56
|
+
* Decode animated images using Demuxer API
|
|
57
|
+
* This properly parses container formats like GIF and APNG
|
|
58
|
+
*/
|
|
59
|
+
private decodeWithDemuxer;
|
|
60
|
+
/**
|
|
61
|
+
* Convert a decoded frame to RGBA with specific timing
|
|
62
|
+
*/
|
|
63
|
+
private convertFrameWithTiming;
|
|
64
|
+
/**
|
|
65
|
+
* Initialize the decoder with the given codec (for static images)
|
|
66
|
+
*/
|
|
67
|
+
private initializeDecoder;
|
|
68
|
+
/**
|
|
69
|
+
* Decode static image data
|
|
70
|
+
*/
|
|
71
|
+
private decodeData;
|
|
72
|
+
/**
|
|
73
|
+
* Send a packet to the decoder
|
|
74
|
+
*/
|
|
75
|
+
private sendPacket;
|
|
76
|
+
/**
|
|
77
|
+
* Drain decoded frames from the decoder
|
|
78
|
+
*/
|
|
79
|
+
private drainFrames;
|
|
80
|
+
/**
|
|
81
|
+
* Convert a decoded frame to RGBA (for static images)
|
|
82
|
+
*/
|
|
83
|
+
private convertFrame;
|
|
84
|
+
/**
|
|
85
|
+
* Flush the decoder to get any remaining frames
|
|
86
|
+
*/
|
|
87
|
+
private flush;
|
|
88
|
+
/**
|
|
89
|
+
* Clean up resources
|
|
90
|
+
*/
|
|
91
|
+
private cleanup;
|
|
92
|
+
/**
|
|
93
|
+
* Close the decoder
|
|
94
|
+
*/
|
|
95
|
+
close(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Check if a MIME type is supported
|
|
98
|
+
*/
|
|
99
|
+
static isTypeSupported(mimeType: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Check if animated decoding is supported for this type
|
|
102
|
+
* (GIF and APNG work, WebP does not due to FFmpeg limitations)
|
|
103
|
+
*/
|
|
104
|
+
static isAnimatedTypeSupported(mimeType: string): boolean;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Probe image dimensions using node-av
|
|
108
|
+
* Returns { width, height } or { width: 0, height: 0 } if probing fails
|
|
109
|
+
*/
|
|
110
|
+
export declare function probeImageDimensions(data: Uint8Array, mimeType: string): Promise<{
|
|
111
|
+
width: number;
|
|
112
|
+
height: number;
|
|
113
|
+
}>;
|
|
114
|
+
//# sourceMappingURL=NodeAvImageDecoder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeAvImageDecoder.d.ts","sourceRoot":"","sources":["../../src/node-av/NodeAvImageDecoder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAgBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ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uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;CAG1D;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAkD5C"}
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NodeAvImageDecoder - Node-av based image decoder
|
|
3
|
+
*
|
|
4
|
+
* Decodes still images and animated images (GIF, APNG) using node-av
|
|
5
|
+
* native bindings (FFmpeg's libav* libraries).
|
|
6
|
+
*
|
|
7
|
+
* Note: Animated WebP is NOT fully supported due to FFmpeg's webp demuxer
|
|
8
|
+
* skipping ANIM/ANMF chunks. Consider using a dedicated WebP library for
|
|
9
|
+
* animated WebP support.
|
|
10
|
+
*/
|
|
11
|
+
import { Decoder, Demuxer, FilterAPI } from 'node-av/api';
|
|
12
|
+
import { FormatContext, Packet, Rational } from 'node-av/lib';
|
|
13
|
+
import { AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_PNG, AV_CODEC_ID_MJPEG, AV_CODEC_ID_WEBP, AV_CODEC_ID_GIF, AV_CODEC_ID_BMP, AV_CODEC_ID_TIFF, AV_CODEC_ID_AV1, } from 'node-av/constants';
|
|
14
|
+
// MIME type to AVCodecID mapping
|
|
15
|
+
const MIME_TO_CODEC_ID = {
|
|
16
|
+
'image/png': AV_CODEC_ID_PNG,
|
|
17
|
+
'image/apng': AV_CODEC_ID_PNG,
|
|
18
|
+
'image/jpeg': AV_CODEC_ID_MJPEG,
|
|
19
|
+
'image/jpg': AV_CODEC_ID_MJPEG,
|
|
20
|
+
'image/webp': AV_CODEC_ID_WEBP,
|
|
21
|
+
'image/gif': AV_CODEC_ID_GIF,
|
|
22
|
+
'image/bmp': AV_CODEC_ID_BMP,
|
|
23
|
+
'image/tiff': AV_CODEC_ID_TIFF,
|
|
24
|
+
'image/avif': AV_CODEC_ID_AV1,
|
|
25
|
+
};
|
|
26
|
+
// Formats that require Demuxer for proper decoding (container formats)
|
|
27
|
+
// Note: WebP is excluded because FFmpeg's webp demuxer doesn't support ANIM/ANMF
|
|
28
|
+
const DEMUXER_FORMATS = ['image/gif', 'image/apng', 'image/avif'];
|
|
29
|
+
/**
|
|
30
|
+
* Decode images using node-av native bindings
|
|
31
|
+
*/
|
|
32
|
+
export class NodeAvImageDecoder {
|
|
33
|
+
decoder = null;
|
|
34
|
+
demuxer = null;
|
|
35
|
+
formatContext = null;
|
|
36
|
+
stream = null;
|
|
37
|
+
filter = null;
|
|
38
|
+
config;
|
|
39
|
+
frames = [];
|
|
40
|
+
closed = false;
|
|
41
|
+
// Use a dummy time_base for still images (required by node-av)
|
|
42
|
+
static DUMMY_TIME_BASE = new Rational(1, 25);
|
|
43
|
+
static DEFAULT_FRAME_DURATION = 100000; // 100ms in microseconds
|
|
44
|
+
constructor(config) {
|
|
45
|
+
this.config = config;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Decode all frames from the image data
|
|
49
|
+
*/
|
|
50
|
+
async decode() {
|
|
51
|
+
if (this.closed) {
|
|
52
|
+
throw new Error('Decoder is closed');
|
|
53
|
+
}
|
|
54
|
+
const codecId = this.getCodecId();
|
|
55
|
+
if (!codecId) {
|
|
56
|
+
throw new Error(`Unsupported image type: ${this.config.mimeType}`);
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
if (this.usesDemuxer()) {
|
|
60
|
+
// Use Demuxer for animated formats (GIF, APNG)
|
|
61
|
+
await this.decodeWithDemuxer();
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// Use raw Decoder for static images
|
|
65
|
+
await this.initializeDecoder(codecId);
|
|
66
|
+
await this.decodeData();
|
|
67
|
+
await this.flush();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
this.cleanup();
|
|
72
|
+
}
|
|
73
|
+
return this.frames;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Check if this format requires Demuxer for proper decoding
|
|
77
|
+
*/
|
|
78
|
+
usesDemuxer() {
|
|
79
|
+
return DEMUXER_FORMATS.includes(this.config.mimeType.toLowerCase());
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get the codec ID for the MIME type
|
|
83
|
+
*/
|
|
84
|
+
getCodecId() {
|
|
85
|
+
return MIME_TO_CODEC_ID[this.config.mimeType.toLowerCase()] ?? null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Decode animated images using Demuxer API
|
|
89
|
+
* This properly parses container formats like GIF and APNG
|
|
90
|
+
*/
|
|
91
|
+
async decodeWithDemuxer() {
|
|
92
|
+
// Open demuxer from buffer
|
|
93
|
+
this.demuxer = await Demuxer.open(Buffer.from(this.config.data));
|
|
94
|
+
// Find video stream
|
|
95
|
+
const videoStream = this.demuxer.streams.find((s) => s.codecpar.codecType === AVMEDIA_TYPE_VIDEO);
|
|
96
|
+
if (!videoStream) {
|
|
97
|
+
throw new Error('No video stream found in image');
|
|
98
|
+
}
|
|
99
|
+
// Store stream reference and create decoder
|
|
100
|
+
this.stream = videoStream;
|
|
101
|
+
this.decoder = await Decoder.create(videoStream, { exitOnError: false });
|
|
102
|
+
// Get time base for duration calculation
|
|
103
|
+
const timeBase = videoStream.timeBase;
|
|
104
|
+
const timeBaseNum = timeBase?.num ?? 1;
|
|
105
|
+
const timeBaseDen = timeBase?.den ?? 1;
|
|
106
|
+
// Read and decode all packets
|
|
107
|
+
for await (const packet of this.demuxer.packets()) {
|
|
108
|
+
if (!packet)
|
|
109
|
+
break;
|
|
110
|
+
if (packet.streamIndex === videoStream.index) {
|
|
111
|
+
// Calculate timestamp and duration in microseconds
|
|
112
|
+
const pts = Number(packet.pts ?? 0n);
|
|
113
|
+
const duration = Number(packet.duration ?? 0n);
|
|
114
|
+
const timestampUs = Math.round((pts * timeBaseNum / timeBaseDen) * 1_000_000);
|
|
115
|
+
const durationUs = duration > 0
|
|
116
|
+
? Math.round((duration * timeBaseNum / timeBaseDen) * 1_000_000)
|
|
117
|
+
: NodeAvImageDecoder.DEFAULT_FRAME_DURATION;
|
|
118
|
+
// Decode packet
|
|
119
|
+
await this.decoder.decode(packet);
|
|
120
|
+
// Drain frames
|
|
121
|
+
let frame = await this.decoder.receive();
|
|
122
|
+
while (frame) {
|
|
123
|
+
const converted = await this.convertFrameWithTiming(frame, timestampUs, durationUs);
|
|
124
|
+
frame.unref();
|
|
125
|
+
if (converted) {
|
|
126
|
+
this.frames.push(converted);
|
|
127
|
+
}
|
|
128
|
+
frame = await this.decoder.receive();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
packet.unref();
|
|
132
|
+
}
|
|
133
|
+
// Flush decoder
|
|
134
|
+
try {
|
|
135
|
+
await this.decoder.flush();
|
|
136
|
+
let frame = await this.decoder.receive();
|
|
137
|
+
while (frame) {
|
|
138
|
+
const lastTimestamp = this.frames.length > 0
|
|
139
|
+
? this.frames[this.frames.length - 1].timestamp + this.frames[this.frames.length - 1].duration
|
|
140
|
+
: 0;
|
|
141
|
+
const converted = await this.convertFrameWithTiming(frame, lastTimestamp, NodeAvImageDecoder.DEFAULT_FRAME_DURATION);
|
|
142
|
+
frame.unref();
|
|
143
|
+
if (converted) {
|
|
144
|
+
this.frames.push(converted);
|
|
145
|
+
}
|
|
146
|
+
frame = await this.decoder.receive();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
// Ignore flush errors
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Convert a decoded frame to RGBA with specific timing
|
|
155
|
+
*/
|
|
156
|
+
async convertFrameWithTiming(frame, timestamp, duration) {
|
|
157
|
+
const width = frame.width;
|
|
158
|
+
const height = frame.height;
|
|
159
|
+
if (width === 0 || height === 0) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
// Build filter description for scaling and format conversion
|
|
163
|
+
let filterDesc = '';
|
|
164
|
+
if (this.config.desiredWidth || this.config.desiredHeight) {
|
|
165
|
+
const scaleW = this.config.desiredWidth || -1;
|
|
166
|
+
const scaleH = this.config.desiredHeight || -1;
|
|
167
|
+
filterDesc = `scale=${scaleW}:${scaleH},format=rgba`;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
filterDesc = 'format=rgba';
|
|
171
|
+
}
|
|
172
|
+
// Create or reuse filter
|
|
173
|
+
if (!this.filter) {
|
|
174
|
+
this.filter = FilterAPI.create(filterDesc, {});
|
|
175
|
+
}
|
|
176
|
+
await this.filter.process(frame);
|
|
177
|
+
let filtered = await this.filter.receive();
|
|
178
|
+
let attempts = 0;
|
|
179
|
+
while (filtered === null && attempts < 10) {
|
|
180
|
+
filtered = await this.filter.receive();
|
|
181
|
+
attempts++;
|
|
182
|
+
}
|
|
183
|
+
if (!filtered) {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
const outputWidth = this.config.desiredWidth || width;
|
|
187
|
+
const outputHeight = this.config.desiredHeight || height;
|
|
188
|
+
const buffer = filtered.toBuffer();
|
|
189
|
+
filtered.unref();
|
|
190
|
+
return {
|
|
191
|
+
data: new Uint8Array(buffer),
|
|
192
|
+
width: outputWidth,
|
|
193
|
+
height: outputHeight,
|
|
194
|
+
timestamp,
|
|
195
|
+
duration,
|
|
196
|
+
complete: true,
|
|
197
|
+
colorSpace: this.config.colorSpace,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Initialize the decoder with the given codec (for static images)
|
|
202
|
+
*/
|
|
203
|
+
async initializeDecoder(codecId) {
|
|
204
|
+
this.formatContext = new FormatContext();
|
|
205
|
+
this.formatContext.allocContext();
|
|
206
|
+
this.stream = this.formatContext.newStream();
|
|
207
|
+
this.stream.timeBase = NodeAvImageDecoder.DUMMY_TIME_BASE;
|
|
208
|
+
const params = this.stream.codecpar;
|
|
209
|
+
params.codecType = AVMEDIA_TYPE_VIDEO;
|
|
210
|
+
params.codecId = codecId;
|
|
211
|
+
params.width = 0;
|
|
212
|
+
params.height = 0;
|
|
213
|
+
this.decoder = await Decoder.create(this.stream, {
|
|
214
|
+
exitOnError: false,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Decode static image data
|
|
219
|
+
*/
|
|
220
|
+
async decodeData() {
|
|
221
|
+
if (!this.decoder || !this.stream) {
|
|
222
|
+
throw new Error('Decoder not initialized');
|
|
223
|
+
}
|
|
224
|
+
await this.sendPacket(Buffer.from(this.config.data), 0);
|
|
225
|
+
await this.drainFrames();
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Send a packet to the decoder
|
|
229
|
+
*/
|
|
230
|
+
async sendPacket(data, pts) {
|
|
231
|
+
if (!this.decoder || !this.stream)
|
|
232
|
+
return;
|
|
233
|
+
const packet = new Packet();
|
|
234
|
+
packet.alloc();
|
|
235
|
+
packet.streamIndex = this.stream.index;
|
|
236
|
+
packet.pts = BigInt(pts);
|
|
237
|
+
packet.dts = BigInt(pts);
|
|
238
|
+
packet.timeBase = NodeAvImageDecoder.DUMMY_TIME_BASE;
|
|
239
|
+
packet.data = data;
|
|
240
|
+
packet.duration = 1n;
|
|
241
|
+
await this.decoder.decode(packet);
|
|
242
|
+
packet.unref();
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Drain decoded frames from the decoder
|
|
246
|
+
*/
|
|
247
|
+
async drainFrames() {
|
|
248
|
+
if (!this.decoder)
|
|
249
|
+
return;
|
|
250
|
+
let frame = await this.decoder.receive();
|
|
251
|
+
while (frame) {
|
|
252
|
+
const converted = await this.convertFrame(frame);
|
|
253
|
+
frame.unref();
|
|
254
|
+
if (converted) {
|
|
255
|
+
this.frames.push(converted);
|
|
256
|
+
}
|
|
257
|
+
frame = await this.decoder.receive();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Convert a decoded frame to RGBA (for static images)
|
|
262
|
+
*/
|
|
263
|
+
async convertFrame(frame) {
|
|
264
|
+
const width = frame.width;
|
|
265
|
+
const height = frame.height;
|
|
266
|
+
if (width === 0 || height === 0) {
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
let filterDesc = '';
|
|
270
|
+
if (this.config.desiredWidth || this.config.desiredHeight) {
|
|
271
|
+
const scaleW = this.config.desiredWidth || -1;
|
|
272
|
+
const scaleH = this.config.desiredHeight || -1;
|
|
273
|
+
filterDesc = `scale=${scaleW}:${scaleH},format=rgba`;
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
filterDesc = 'format=rgba';
|
|
277
|
+
}
|
|
278
|
+
if (!this.filter) {
|
|
279
|
+
this.filter = FilterAPI.create(filterDesc, {});
|
|
280
|
+
}
|
|
281
|
+
await this.filter.process(frame);
|
|
282
|
+
let filtered = await this.filter.receive();
|
|
283
|
+
let attempts = 0;
|
|
284
|
+
while (filtered === null && attempts < 10) {
|
|
285
|
+
filtered = await this.filter.receive();
|
|
286
|
+
attempts++;
|
|
287
|
+
}
|
|
288
|
+
if (!filtered) {
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
const outputWidth = this.config.desiredWidth || width;
|
|
292
|
+
const outputHeight = this.config.desiredHeight || height;
|
|
293
|
+
const buffer = filtered.toBuffer();
|
|
294
|
+
filtered.unref();
|
|
295
|
+
// Static images have timestamp 0 and duration 0
|
|
296
|
+
return {
|
|
297
|
+
data: new Uint8Array(buffer),
|
|
298
|
+
width: outputWidth,
|
|
299
|
+
height: outputHeight,
|
|
300
|
+
timestamp: 0,
|
|
301
|
+
duration: 0,
|
|
302
|
+
complete: true,
|
|
303
|
+
colorSpace: this.config.colorSpace,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Flush the decoder to get any remaining frames
|
|
308
|
+
*/
|
|
309
|
+
async flush() {
|
|
310
|
+
if (!this.decoder)
|
|
311
|
+
return;
|
|
312
|
+
try {
|
|
313
|
+
await this.decoder.flush();
|
|
314
|
+
await this.drainFrames();
|
|
315
|
+
}
|
|
316
|
+
catch {
|
|
317
|
+
// Ignore flush errors
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Clean up resources
|
|
322
|
+
*/
|
|
323
|
+
cleanup() {
|
|
324
|
+
this.filter?.close();
|
|
325
|
+
this.filter = null;
|
|
326
|
+
this.decoder?.close();
|
|
327
|
+
this.decoder = null;
|
|
328
|
+
this.demuxer?.close();
|
|
329
|
+
this.demuxer = null;
|
|
330
|
+
this.formatContext = null;
|
|
331
|
+
this.stream = null;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Close the decoder
|
|
335
|
+
*/
|
|
336
|
+
close() {
|
|
337
|
+
if (this.closed)
|
|
338
|
+
return;
|
|
339
|
+
this.closed = true;
|
|
340
|
+
this.cleanup();
|
|
341
|
+
this.frames = [];
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Check if a MIME type is supported
|
|
345
|
+
*/
|
|
346
|
+
static isTypeSupported(mimeType) {
|
|
347
|
+
return mimeType.toLowerCase() in MIME_TO_CODEC_ID;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Check if animated decoding is supported for this type
|
|
351
|
+
* (GIF and APNG work, WebP does not due to FFmpeg limitations)
|
|
352
|
+
*/
|
|
353
|
+
static isAnimatedTypeSupported(mimeType) {
|
|
354
|
+
return DEMUXER_FORMATS.includes(mimeType.toLowerCase());
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Probe image dimensions using node-av
|
|
359
|
+
* Returns { width, height } or { width: 0, height: 0 } if probing fails
|
|
360
|
+
*/
|
|
361
|
+
export async function probeImageDimensions(data, mimeType) {
|
|
362
|
+
const codecId = MIME_TO_CODEC_ID[mimeType.toLowerCase()];
|
|
363
|
+
if (!codecId) {
|
|
364
|
+
return { width: 0, height: 0 };
|
|
365
|
+
}
|
|
366
|
+
let formatContext = null;
|
|
367
|
+
let stream = null;
|
|
368
|
+
let decoder = null;
|
|
369
|
+
try {
|
|
370
|
+
formatContext = new FormatContext();
|
|
371
|
+
formatContext.allocContext();
|
|
372
|
+
stream = formatContext.newStream();
|
|
373
|
+
stream.timeBase = new Rational(1, 25);
|
|
374
|
+
const params = stream.codecpar;
|
|
375
|
+
params.codecType = AVMEDIA_TYPE_VIDEO;
|
|
376
|
+
params.codecId = codecId;
|
|
377
|
+
params.width = 0;
|
|
378
|
+
params.height = 0;
|
|
379
|
+
decoder = await Decoder.create(stream, { exitOnError: false });
|
|
380
|
+
const packet = new Packet();
|
|
381
|
+
packet.alloc();
|
|
382
|
+
packet.streamIndex = stream.index;
|
|
383
|
+
packet.pts = 0n;
|
|
384
|
+
packet.dts = 0n;
|
|
385
|
+
packet.timeBase = new Rational(1, 25);
|
|
386
|
+
packet.data = Buffer.from(data);
|
|
387
|
+
packet.duration = 1n;
|
|
388
|
+
await decoder.decode(packet);
|
|
389
|
+
packet.unref();
|
|
390
|
+
const frame = await decoder.receive();
|
|
391
|
+
if (frame) {
|
|
392
|
+
const width = frame.width;
|
|
393
|
+
const height = frame.height;
|
|
394
|
+
frame.unref();
|
|
395
|
+
return { width, height };
|
|
396
|
+
}
|
|
397
|
+
return { width: 0, height: 0 };
|
|
398
|
+
}
|
|
399
|
+
catch {
|
|
400
|
+
return { width: 0, height: 0 };
|
|
401
|
+
}
|
|
402
|
+
finally {
|
|
403
|
+
decoder?.close();
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
//# sourceMappingURL=NodeAvImageDecoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeAvImageDecoder.js","sourceRoot":"","sources":["../../src/node-av/NodeAvImageDecoder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SA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C;YAC5B,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAC3B,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACjC,CAAC;YAAS,CAAC;QACT,OAAO,EAAE,KAAK,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NodeAvVideoDecoder - Video decoder using node-av native bindings
|
|
3
|
+
*
|
|
4
|
+
* Implements the VideoDecoderBackend interface for decoding video streams
|
|
5
|
+
* using FFmpeg's libav* libraries via node-av.
|
|
6
|
+
*/
|
|
7
|
+
import { EventEmitter } from 'events';
|
|
8
|
+
import type { VideoDecoderBackend, VideoDecoderBackendConfig } from '../backends/types.js';
|
|
9
|
+
/**
|
|
10
|
+
* NodeAV-backed video decoder implementing VideoDecoderBackend interface
|
|
11
|
+
*/
|
|
12
|
+
export declare class NodeAvVideoDecoder extends EventEmitter implements VideoDecoderBackend {
|
|
13
|
+
private decoder;
|
|
14
|
+
private hardware;
|
|
15
|
+
private formatContext;
|
|
16
|
+
private stream;
|
|
17
|
+
private filter;
|
|
18
|
+
private config;
|
|
19
|
+
private queue;
|
|
20
|
+
private processing;
|
|
21
|
+
private processingPromise;
|
|
22
|
+
private shuttingDown;
|
|
23
|
+
private packetIndex;
|
|
24
|
+
private packetTimeBase;
|
|
25
|
+
private outputPixelFormat;
|
|
26
|
+
private filterDescription;
|
|
27
|
+
private hardwarePreference;
|
|
28
|
+
get isHealthy(): boolean;
|
|
29
|
+
startDecoder(config: VideoDecoderBackendConfig): void;
|
|
30
|
+
write(data: Buffer | Uint8Array): boolean;
|
|
31
|
+
end(): void;
|
|
32
|
+
kill(): void;
|
|
33
|
+
shutdown(): Promise<void>;
|
|
34
|
+
private processQueue;
|
|
35
|
+
private ensureDecoder;
|
|
36
|
+
private logDecoderSelection;
|
|
37
|
+
private decodeBuffer;
|
|
38
|
+
private drainFrames;
|
|
39
|
+
private toOutput;
|
|
40
|
+
private finish;
|
|
41
|
+
private cleanup;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=NodeAvVideoDecoder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeAvVideoDecoder.d.ts","sourceRoot":"","sources":["../../src/node-av/NodeAvVideoDecoder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAyBtC,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EAE1B,MAAM,sBAAsB,CAAC;AAe9B;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,YAAa,YAAW,mBAAmB;IACjF,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,QAAQ,CAAgC;IAChD,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,MAAM,CAA0C;IACxD,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,iBAAiB,CAA8B;IACvD,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,cAAc,CAAgD;IACtE,OAAO,CAAC,iBAAiB,CAAqC;IAC9D,OAAO,CAAC,iBAAiB,CAAuB;IAChD,OAAO,CAAC,kBAAkB,CAA4E;IAEtG,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,YAAY,CAAC,MAAM,EAAE,yBAAyB,GAAG,IAAI;IAQrD,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO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