taglib-wasm 1.8.3 → 2.0.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 +8 -1
- package/dist/disc-folder.d.ts +19 -0
- package/dist/disc-folder.d.ts.map +1 -0
- package/dist/disc-folder.js +550 -0
- package/dist/index.browser.d.ts +3 -4
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +171 -173
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -13
- package/dist/simple.browser.js +164 -30
- package/dist/src/constants/complex-properties.d.ts +0 -114
- package/dist/src/constants/complex-properties.d.ts.map +1 -1
- package/dist/src/constants/complex-properties.js +0 -55
- package/dist/src/constants/index.d.ts +0 -1
- package/dist/src/constants/index.d.ts.map +1 -1
- package/dist/src/constants/index.js +0 -1
- package/dist/src/file-utils/import-operations.d.ts.map +1 -1
- package/dist/src/file-utils/import-operations.js +1 -1
- package/dist/src/folder-api/file-processors.d.ts.map +1 -1
- package/dist/src/folder-api/file-processors.js +6 -5
- package/dist/src/folder-api/scan-for-albums.js +3 -3
- package/dist/src/folder-api/scan-operations.js +2 -2
- package/dist/src/msgpack/decoder.d.ts.map +1 -1
- package/dist/src/msgpack/decoder.js +5 -6
- package/dist/src/msgpack/encoder.d.ts.map +1 -1
- package/dist/src/msgpack/encoder.js +4 -3
- package/dist/src/runtime/module-loader.d.ts.map +1 -1
- package/dist/src/runtime/module-loader.js +3 -3
- package/dist/src/runtime/wasi-adapter/file-handle.d.ts +8 -0
- package/dist/src/runtime/wasi-adapter/file-handle.d.ts.map +1 -1
- package/dist/src/runtime/wasi-adapter/file-handle.js +32 -1
- package/dist/src/simple/batch-operations.d.ts.map +1 -1
- package/dist/src/simple/batch-operations.js +14 -10
- package/dist/src/simple/picture-operations.js +1 -1
- package/dist/src/taglib/audio-file-base.d.ts +15 -9
- package/dist/src/taglib/audio-file-base.d.ts.map +1 -1
- package/dist/src/taglib/audio-file-base.js +35 -4
- package/dist/src/taglib/audio-file-impl.d.ts +2 -2
- package/dist/src/taglib/audio-file-impl.d.ts.map +1 -1
- package/dist/src/taglib/audio-file-impl.js +25 -13
- package/dist/src/taglib/audio-file-interface.d.ts +27 -6
- package/dist/src/taglib/audio-file-interface.d.ts.map +1 -1
- package/dist/src/taglib/auto-dispose.d.ts +6 -0
- package/dist/src/taglib/auto-dispose.d.ts.map +1 -0
- package/dist/src/taglib/auto-dispose.js +13 -0
- package/dist/src/taglib/embind-adapter.d.ts +2 -2
- package/dist/src/taglib/embind-adapter.d.ts.map +1 -1
- package/dist/src/taglib/embind-adapter.js +17 -0
- package/dist/src/taglib/extra-state-registry.d.ts.map +1 -1
- package/dist/src/taglib/extra-state-registry.js +9 -0
- package/dist/src/taglib/metadata-extent.d.ts.map +1 -1
- package/dist/src/taglib/metadata-extent.js +44 -1
- package/dist/src/taglib/mutable-tag.d.ts +15 -15
- package/dist/src/taglib/mutable-tag.d.ts.map +1 -1
- package/dist/src/taglib/save-reconstruct.d.ts.map +1 -1
- package/dist/src/taglib/taglib-class.d.ts.map +1 -1
- package/dist/src/types/tags.d.ts +0 -4
- package/dist/src/types/tags.d.ts.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/wasm.d.ts +20 -1
- package/dist/src/wasm.d.ts.map +1 -1
- package/dist/src/web-utils/canvas.d.ts.map +1 -1
- package/dist/src/web-utils/canvas.js +6 -1
- package/dist/src/web-utils/data-url.js +1 -1
- package/dist/taglib-wasi.wasm +0 -0
- package/package.json +18 -10
- package/dist/src/constants/tags.d.ts +0 -81
- package/dist/src/constants/tags.d.ts.map +0 -1
- package/dist/src/constants/tags.js +0 -86
|
@@ -3,7 +3,6 @@ import { errorMessage, MetadataError } from "../errors/classes.js";
|
|
|
3
3
|
import { remapKeysFromTagLib } from "../constants/properties.js";
|
|
4
4
|
const MSGPACK_DECODE_OPTIONS = {
|
|
5
5
|
useBigInt64: false,
|
|
6
|
-
extensionCodec: void 0,
|
|
7
6
|
maxStrLength: 1e6,
|
|
8
7
|
maxBinLength: 5e7,
|
|
9
8
|
maxArrayLength: 1e4,
|
|
@@ -189,11 +188,11 @@ function decodeFastTagData(msgpackBuffer) {
|
|
|
189
188
|
maxMapLength: 50
|
|
190
189
|
});
|
|
191
190
|
return {
|
|
192
|
-
title: decoded.title,
|
|
193
|
-
artist: decoded.artist,
|
|
194
|
-
album: decoded.album,
|
|
195
|
-
year: decoded.year,
|
|
196
|
-
track: decoded.track
|
|
191
|
+
...decoded.title !== void 0 ? { title: decoded.title } : {},
|
|
192
|
+
...decoded.artist !== void 0 ? { artist: decoded.artist } : {},
|
|
193
|
+
...decoded.album !== void 0 ? { album: decoded.album } : {},
|
|
194
|
+
...decoded.year !== void 0 ? { year: decoded.year } : {},
|
|
195
|
+
...decoded.track !== void 0 ? { track: decoded.track } : {}
|
|
197
196
|
};
|
|
198
197
|
} catch (error) {
|
|
199
198
|
throw new MetadataError(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../../src/msgpack/encoder.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,OAAO,EACP,WAAW,EACZ,MAAM,aAAa,CAAC;AAIrB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../../src/msgpack/encoder.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,OAAO,EACP,WAAW,EACZ,MAAM,aAAa,CAAC;AAIrB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,aAe3B,CAAC;AA2BH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KEYS = /* @__PURE__ */ new Set([
|
|
|
14
14
|
"id3Tags",
|
|
15
15
|
"_stripId3",
|
|
16
16
|
// Exact MP4 atom names — must reach C++ verbatim, not via toTagLibKey.
|
|
17
|
-
"_mp4ItemNames"
|
|
17
|
+
"_mp4ItemNames",
|
|
18
|
+
// Foreign-mean MP4 atom names to delete at save (taglib-65nm).
|
|
19
|
+
"_mp4ItemRemovals"
|
|
18
20
|
]);
|
|
19
21
|
const MSGPACK_ENCODE_OPTIONS = {
|
|
20
22
|
sortKeys: false,
|
|
21
23
|
forceFloat32: false,
|
|
22
24
|
ignoreUndefined: true,
|
|
23
25
|
initialBufferSize: 2048,
|
|
24
|
-
maxDepth: 32
|
|
25
|
-
extensionCodec: void 0
|
|
26
|
+
maxDepth: 32
|
|
26
27
|
};
|
|
27
28
|
function lyricsTexts(value) {
|
|
28
29
|
const entries = Array.isArray(value) ? value : [value];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-loader.d.ts","sourceRoot":"","sources":["../../../src/runtime/module-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"module-loader.d.ts","sourceRoot":"","sources":["../../../src/runtime/module-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAkFvB"}
|
|
@@ -46,9 +46,9 @@ async function loadTagLibModule(options) {
|
|
|
46
46
|
try {
|
|
47
47
|
const { loadUnifiedTagLibModule } = await import("./unified-loader/index.js");
|
|
48
48
|
return await loadUnifiedTagLibModule({
|
|
49
|
-
wasmBinary: options
|
|
50
|
-
wasmUrl: options
|
|
51
|
-
forceWasmType: options
|
|
49
|
+
...options?.wasmBinary !== void 0 ? { wasmBinary: options.wasmBinary } : {},
|
|
50
|
+
...options?.wasmUrl !== void 0 ? { wasmUrl: options.wasmUrl } : {},
|
|
51
|
+
...options?.forceWasmType !== void 0 ? { forceWasmType: options.forceWasmType } : {},
|
|
52
52
|
debug: false
|
|
53
53
|
});
|
|
54
54
|
} catch (error) {
|
|
@@ -32,6 +32,14 @@ export declare class WasiFileHandle implements FileHandle {
|
|
|
32
32
|
setMP4Item(key: string, value: string): void;
|
|
33
33
|
/** Record an exact atom name to be repaired after the PropertyMap write. */
|
|
34
34
|
private registerMp4ItemName;
|
|
35
|
+
/**
|
|
36
|
+
* Record a foreign-mean freeform atom for deletion at save (taglib-65nm).
|
|
37
|
+
* The PropertyMap erase pass cannot express foreign atoms, so the C++ shim
|
|
38
|
+
* consumes this list and calls removeItem on each exact atom name.
|
|
39
|
+
*/
|
|
40
|
+
private registerMp4ItemRemoval;
|
|
41
|
+
getMp4ItemRemovals(): string[] | undefined;
|
|
42
|
+
setMp4ItemRemovals(removals: string[]): void;
|
|
35
43
|
removeMP4Item(key: string): void;
|
|
36
44
|
getPictures(): RawPicture[];
|
|
37
45
|
setPictures(pictures: RawPicture[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-handle.d.ts","sourceRoot":"","sources":["../../../../src/runtime/wasi-adapter/file-handle.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,aAAa,EAC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AAE,EAAE,EAAE,OAAO,CAAC;QAAC,EAAE,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;IA+BtD,UAAU,IAAI;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE;IAOlE,UAAU,CACR,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,GAC9D,IAAI;IAaP,SAAS,IAAI,SAAS,EAAE;IAoBxB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI;IAKpC,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,EAAE;IAsB3C,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI;IAUpD,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAInC,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,GAAG,SAAS;IAMhE,OAAO,IAAI,IAAI;CAKhB"}
|
|
@@ -52,7 +52,10 @@ const INTERNAL_KEYS = /* @__PURE__ */ new Set([
|
|
|
52
52
|
"bextData",
|
|
53
53
|
"ixml",
|
|
54
54
|
// Exact MP4 atom names for the write path, not a readable property.
|
|
55
|
-
"_mp4ItemNames"
|
|
55
|
+
"_mp4ItemNames",
|
|
56
|
+
// Foreign-mean MP4 atom names to delete at save (taglib-65nm): a write-time
|
|
57
|
+
// directive, never a property.
|
|
58
|
+
"_mp4ItemRemovals"
|
|
56
59
|
]);
|
|
57
60
|
function preserveEmptyValues(data) {
|
|
58
61
|
for (const [key, value] of Object.entries(data)) {
|
|
@@ -325,9 +328,37 @@ class WasiFileHandle {
|
|
|
325
328
|
_mp4ItemNames: [...existing, name]
|
|
326
329
|
};
|
|
327
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* Record a foreign-mean freeform atom for deletion at save (taglib-65nm).
|
|
333
|
+
* The PropertyMap erase pass cannot express foreign atoms, so the C++ shim
|
|
334
|
+
* consumes this list and calls removeItem on each exact atom name.
|
|
335
|
+
*/
|
|
336
|
+
registerMp4ItemRemoval(name) {
|
|
337
|
+
const existing = this.tagData?._mp4ItemRemovals ?? [];
|
|
338
|
+
if (existing.includes(name)) return;
|
|
339
|
+
this.tagData = {
|
|
340
|
+
...this.tagData,
|
|
341
|
+
_mp4ItemRemovals: [...existing, name]
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
getMp4ItemRemovals() {
|
|
345
|
+
this.checkNotDestroyed();
|
|
346
|
+
return this.tagData?._mp4ItemRemovals;
|
|
347
|
+
}
|
|
348
|
+
setMp4ItemRemovals(removals) {
|
|
349
|
+
this.checkNotDestroyed();
|
|
350
|
+
this.tagData = {
|
|
351
|
+
...this.tagData,
|
|
352
|
+
_mp4ItemRemovals: [...new Set(removals)]
|
|
353
|
+
};
|
|
354
|
+
}
|
|
328
355
|
removeMP4Item(key) {
|
|
329
356
|
this.checkNotDestroyed();
|
|
330
357
|
if (this.tagData) {
|
|
358
|
+
if (key.startsWith("----:")) {
|
|
359
|
+
delete this.tagData[key];
|
|
360
|
+
this.registerMp4ItemRemoval(key);
|
|
361
|
+
}
|
|
331
362
|
const mappedKey = fromTagLibKey(mp4ItemPropertyKey(key));
|
|
332
363
|
delete this.tagData[mappedKey];
|
|
333
364
|
const mirror = mirrorForRawKey(mappedKey);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-operations.d.ts","sourceRoot":"","sources":["../../../src/simple/batch-operations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAMhF,qDAAqD;AACrD,MAAM,WAAW,Y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C,CAMnD;AAED,oHAAoH;AACpH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,eAAe,GAAG,SAAS,CAAC;IACxC,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B;AAwBD;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,YAAY,CAAC,CA6BvB;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAUpC"}
|
|
@@ -67,10 +67,10 @@ function extractDynamics(audioFile) {
|
|
|
67
67
|
"replayGainAlbumPeak"
|
|
68
68
|
];
|
|
69
69
|
for (const field of fields) {
|
|
70
|
-
const val = audioFile.getProperty(field);
|
|
71
|
-
if (val) dynamics[field] = val;
|
|
70
|
+
const val = audioFile.getProperty(field)?.[0];
|
|
71
|
+
if (val !== void 0) dynamics[field] = val;
|
|
72
72
|
}
|
|
73
|
-
let appleSoundCheck = audioFile.getProperty("appleSoundCheck");
|
|
73
|
+
let appleSoundCheck = audioFile.getProperty("appleSoundCheck")?.[0];
|
|
74
74
|
if (!appleSoundCheck && audioFile.isMP4()) {
|
|
75
75
|
appleSoundCheck = audioFile.getMP4Item("----:com.apple.iTunes:iTunNORM");
|
|
76
76
|
}
|
|
@@ -96,23 +96,27 @@ async function readMetadata(file) {
|
|
|
96
96
|
`File may be corrupted or in an unsupported format. File: ${name}`
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
|
+
const dynamics = extractDynamics(audioFile);
|
|
99
100
|
return {
|
|
100
101
|
tags: readExtendedTag(audioFile),
|
|
101
102
|
properties: audioFile.audioProperties(),
|
|
102
103
|
hasCoverArt: audioFile.getPictures().length > 0,
|
|
103
|
-
dynamics:
|
|
104
|
+
...dynamics !== void 0 ? { dynamics } : {}
|
|
104
105
|
};
|
|
105
106
|
} finally {
|
|
106
107
|
audioFile.dispose();
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
async function readMetadataBatch(files, options = {}) {
|
|
110
|
-
return executeBatch(files, options, (audioFile) =>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
return executeBatch(files, options, (audioFile) => {
|
|
112
|
+
const dynamics = extractDynamics(audioFile);
|
|
113
|
+
return {
|
|
114
|
+
tags: readExtendedTag(audioFile),
|
|
115
|
+
properties: audioFile.audioProperties(),
|
|
116
|
+
hasCoverArt: audioFile.getPictures().length > 0,
|
|
117
|
+
...dynamics !== void 0 ? { dynamics } : {}
|
|
118
|
+
};
|
|
119
|
+
});
|
|
116
120
|
}
|
|
117
121
|
export {
|
|
118
122
|
readMetadata,
|
|
@@ -51,7 +51,7 @@ async function readPictureMetadata(file) {
|
|
|
51
51
|
return pictures.map((pic) => ({
|
|
52
52
|
type: pic.type,
|
|
53
53
|
mimeType: pic.mimeType,
|
|
54
|
-
description: pic.description,
|
|
54
|
+
...pic.description !== void 0 ? { description: pic.description } : {},
|
|
55
55
|
size: pic.data.length
|
|
56
56
|
}));
|
|
57
57
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TagLibModule, WasmFileHandle } from "../wasm.js";
|
|
2
2
|
import type { AudioProperties, FileType, OpenOptions, PropertyMap } from "../types.js";
|
|
3
3
|
import type { MutableTag } from "./mutable-tag.js";
|
|
4
4
|
import type { TypedAudioFile } from "./audio-file-interface.js";
|
|
@@ -10,15 +10,15 @@ import type { TypedAudioFile } from "./audio-file-interface.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export declare abstract class BaseAudioFileImpl {
|
|
12
12
|
protected readonly module: TagLibModule;
|
|
13
|
-
protected fileHandle:
|
|
13
|
+
protected fileHandle: WasmFileHandle | null;
|
|
14
14
|
protected cachedAudioProperties: AudioProperties | null;
|
|
15
|
-
protected readonly sourcePath
|
|
16
|
-
protected originalSource
|
|
15
|
+
protected readonly sourcePath: string | undefined;
|
|
16
|
+
protected originalSource: string | Uint8Array | ArrayBuffer | File | undefined;
|
|
17
17
|
protected isPartiallyLoaded: boolean;
|
|
18
|
-
protected readonly partialLoadOptions
|
|
18
|
+
protected readonly partialLoadOptions: OpenOptions | undefined;
|
|
19
19
|
/** Text-property wire keys in the partial header at load; undefined if full. */
|
|
20
|
-
protected readonly partialKeysAtLoad
|
|
21
|
-
constructor(module: TagLibModule, fileHandle:
|
|
20
|
+
protected readonly partialKeysAtLoad: ReadonlySet<string> | undefined;
|
|
21
|
+
constructor(module: TagLibModule, fileHandle: WasmFileHandle, sourcePath?: string, originalSource?: string | Uint8Array | ArrayBuffer | File, isPartiallyLoaded?: boolean, partialLoadOptions?: OpenOptions);
|
|
22
22
|
/**
|
|
23
23
|
* Wire-key text properties present in the partial header at load but now
|
|
24
24
|
* absent — the user deleted them. The partial-load reconstruct subtracts these
|
|
@@ -27,15 +27,21 @@ export declare abstract class BaseAudioFileImpl {
|
|
|
27
27
|
* their own reconstruct path); empty for a full load.
|
|
28
28
|
*/
|
|
29
29
|
protected partialDeletedPropertyKeys(): ReadonlySet<string>;
|
|
30
|
-
protected get handle():
|
|
30
|
+
protected get handle(): WasmFileHandle;
|
|
31
31
|
getFormat(): FileType;
|
|
32
32
|
isFormat<F extends FileType>(format: F): this is TypedAudioFile<F>;
|
|
33
33
|
tag(): MutableTag;
|
|
34
34
|
audioProperties(): AudioProperties | undefined;
|
|
35
35
|
properties(): PropertyMap;
|
|
36
36
|
setProperties(properties: PropertyMap): void;
|
|
37
|
-
getProperty(key: string): string | undefined;
|
|
37
|
+
getProperty(key: string): string[] | undefined;
|
|
38
38
|
setProperty(key: string, value: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* The empty-string clearing contract, named (taglib-qyw2): both backends
|
|
41
|
+
* remove the property when the written value is empty, and setProperty's
|
|
42
|
+
* wire-key normalization + MP4 freeform atom-name handling apply unchanged.
|
|
43
|
+
*/
|
|
44
|
+
removeProperty(key: string): void;
|
|
39
45
|
isMP4(): boolean;
|
|
40
46
|
getMP4Item(key: string): string | undefined;
|
|
41
47
|
setMP4Item(key: string, value: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio-file-base.d.ts","sourceRoot":"","sources":["../../../src/taglib/audio-file-base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"audio-file-base.d.ts","sourceRoot":"","sources":["../../../src/taglib/audio-file-base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EACV,eAAe,EACf,QAAQ,EACR,WAAW,EACX,WAAW,EACZ,MAAM,aAAa,CAAC;AASrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAiBhE;;;;;GAKG;AACH,8BAAsB,iBAAiB;IAgBnC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY;IAfzC,SAAS,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI,CAAC;IAC5C,SAAS,CAAC,qBAAqB,EAAE,eAAe,GAAG,IAAI,CAAQ;IAC/D,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAClD,SAAS,CAAC,cAAc,EACpB,MAAM,GACN,UAAU,GACV,WAAW,GACX,IAAI,GACJ,SAAS,CAAC;IACd,SAAS,CAAC,iBAAiB,EAAE,OAAO,CAAS;IAC7C,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/D,gFAAgF;IAChF,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAA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
12
12
|
import { MP4_ITEM_NAMES_KEY } from "./mp4-item-names.js";
|
|
13
13
|
import { buildMutableTag } from "./mutable-tag-impl.js";
|
|
14
|
+
import { registerAutoDispose, unregisterAutoDispose } from "./auto-dispose.js";
|
|
14
15
|
const LYRICS_PROPERTY_KEY = "lyrics";
|
|
15
16
|
const LYRICS_WIRE_KEY = toTagLibKey(LYRICS_PROPERTY_KEY);
|
|
16
17
|
const EMPTY_KEY_SET = /* @__PURE__ */ new Set();
|
|
@@ -31,6 +32,7 @@ class BaseAudioFileImpl {
|
|
|
31
32
|
this.isPartiallyLoaded = isPartiallyLoaded;
|
|
32
33
|
this.partialLoadOptions = partialLoadOptions;
|
|
33
34
|
this.partialKeysAtLoad = isPartiallyLoaded ? new Set(Object.keys(fileHandle.getProperties())) : void 0;
|
|
35
|
+
registerAutoDispose(this, fileHandle);
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* Wire-key text properties present in the partial header at load but now
|
|
@@ -90,16 +92,36 @@ class BaseAudioFileImpl {
|
|
|
90
92
|
this.handle.setProperties(translated);
|
|
91
93
|
}
|
|
92
94
|
getProperty(key) {
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
+
const wireKey = toTagLibKey(fromTagLibKey(key));
|
|
96
|
+
const values = this.handle.getProperties()[wireKey]?.filter(
|
|
97
|
+
(v) => v !== ""
|
|
98
|
+
);
|
|
99
|
+
if (values !== void 0 && values.length > 0) return values;
|
|
95
100
|
if (!this.isMP4()) return void 0;
|
|
96
|
-
const remapped = this.properties()[key]?.
|
|
97
|
-
return remapped
|
|
101
|
+
const remapped = this.properties()[key]?.filter((v) => v !== "");
|
|
102
|
+
return remapped !== void 0 && remapped.length > 0 ? remapped : void 0;
|
|
98
103
|
}
|
|
99
104
|
setProperty(key, value) {
|
|
100
105
|
const wireKey = toTagLibKey(fromTagLibKey(key));
|
|
101
106
|
const atomNames = mp4FreeformAtomNames([wireKey]);
|
|
102
107
|
if (atomNames.length > 0 && this.isMP4()) {
|
|
108
|
+
if (value === "") {
|
|
109
|
+
const prior = this.handle.getMp4ItemRemovals?.() ?? [];
|
|
110
|
+
this.handle.setMp4ItemRemovals?.([
|
|
111
|
+
.../* @__PURE__ */ new Set([...prior, ...atomNames])
|
|
112
|
+
]);
|
|
113
|
+
if (this.module.isWasi) {
|
|
114
|
+
this.handle.setProperties({
|
|
115
|
+
...this.handle.getProperties(),
|
|
116
|
+
[wireKey]: []
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
const rest = { ...this.handle.getProperties() };
|
|
120
|
+
delete rest[wireKey];
|
|
121
|
+
this.handle.setProperties(rest);
|
|
122
|
+
}
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
103
125
|
this.handle.setProperties({
|
|
104
126
|
...this.handle.getProperties(),
|
|
105
127
|
[wireKey]: [value],
|
|
@@ -109,6 +131,14 @@ class BaseAudioFileImpl {
|
|
|
109
131
|
}
|
|
110
132
|
this.handle.setProperty(wireKey, value);
|
|
111
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* The empty-string clearing contract, named (taglib-qyw2): both backends
|
|
136
|
+
* remove the property when the written value is empty, and setProperty's
|
|
137
|
+
* wire-key normalization + MP4 freeform atom-name handling apply unchanged.
|
|
138
|
+
*/
|
|
139
|
+
removeProperty(key) {
|
|
140
|
+
this.setProperty(key, "");
|
|
141
|
+
}
|
|
112
142
|
isMP4() {
|
|
113
143
|
return this.handle.isMP4();
|
|
114
144
|
}
|
|
@@ -141,6 +171,7 @@ class BaseAudioFileImpl {
|
|
|
141
171
|
return this.handle.isValid();
|
|
142
172
|
}
|
|
143
173
|
dispose() {
|
|
174
|
+
unregisterAutoDispose(this);
|
|
144
175
|
if (this.fileHandle) {
|
|
145
176
|
this.fileHandle.destroy();
|
|
146
177
|
this.fileHandle = null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TagLibModule, WasmFileHandle } from "../wasm.js";
|
|
2
2
|
import type { OpenOptions, Picture } from "../types.js";
|
|
3
3
|
import type { Chapter, SetChaptersOptions } from "../types/chapters.js";
|
|
4
4
|
import type { BroadcastAudioExtension } from "../types/bwf.js";
|
|
@@ -16,7 +16,7 @@ export declare function readFileSync(path: string): Uint8Array;
|
|
|
16
16
|
*/
|
|
17
17
|
export declare class AudioFileImpl extends BaseAudioFileImpl implements AudioFile {
|
|
18
18
|
private pathModeBuffer;
|
|
19
|
-
constructor(module: TagLibModule, fileHandle:
|
|
19
|
+
constructor(module: TagLibModule, fileHandle: WasmFileHandle, sourcePath?: string, originalSource?: string | Uint8Array | ArrayBuffer | File, isPartiallyLoaded?: boolean, partialLoadOptions?: OpenOptions);
|
|
20
20
|
save(): boolean;
|
|
21
21
|
getFileBuffer(): Uint8Array;
|
|
22
22
|
saveToFile(path?: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio-file-impl.d.ts","sourceRoot":"","sources":["../../../src/taglib/audio-file-impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"audio-file-impl.d.ts","sourceRoot":"","sources":["../../../src/taglib/audio-file-impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,YAAY,EACZ,cAAc,EACf,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,KAAK,EACV,UAAU,EACV,MAAM,EACN,cAAc,EACf,MAAM,oCAAoC,CAAC;AAc5C,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAA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M,EAAE,cAAc,EAAE,GAAG,IAAI;IAQzC,SAAS,IAAI,gBAAgB,GAAG,SAAS;IAKzC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ/C,cAAc,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,EAAE;IAMzC,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI;IAOpD,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAMnC,UAAU,IAAI;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,EAAE,EAAE,OAAO,CAAA;KAAE;IAI1C,YAAY,CAAC,IAAI,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,OAAO,CAAC;QAAC,EAAE,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;CAM1D"}
|
|
@@ -132,7 +132,7 @@ class AudioFileImpl extends BaseAudioFileImpl {
|
|
|
132
132
|
mimeType: pic.mimeType,
|
|
133
133
|
data: pic.data,
|
|
134
134
|
type: PICTURE_TYPE_NAMES[pic.type] ?? "Other",
|
|
135
|
-
description: pic.description
|
|
135
|
+
...pic.description !== void 0 ? { description: pic.description } : {}
|
|
136
136
|
}));
|
|
137
137
|
}
|
|
138
138
|
setPictures(pictures) {
|
|
@@ -157,13 +157,20 @@ class AudioFileImpl extends BaseAudioFileImpl {
|
|
|
157
157
|
getChapters() {
|
|
158
158
|
const sorted = sortChapters(this.handle.getChapters());
|
|
159
159
|
const trackEndMs = this.audioProperties()?.durationMs;
|
|
160
|
-
return sorted.map((c, i) =>
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
160
|
+
return sorted.map((c, i) => {
|
|
161
|
+
const endTimeMs = inferEndTimeMs(sorted, i, trackEndMs);
|
|
162
|
+
return {
|
|
163
|
+
startTimeMs: c.startTimeMs,
|
|
164
|
+
...endTimeMs !== void 0 ? { endTimeMs } : {},
|
|
165
|
+
// Truthiness, not !== undefined: an empty CHAP title/id must read back
|
|
166
|
+
// as ABSENT (the old `c.title || undefined` contract; the Embind
|
|
167
|
+
// reader emits "" unconditionally, WASI omits — coalescing keeps the
|
|
168
|
+
// backends agreeing).
|
|
169
|
+
...c.title ? { title: c.title } : {},
|
|
170
|
+
...c.id ? { id: c.id } : {},
|
|
171
|
+
...c.source !== void 0 ? { source: c.source } : {}
|
|
172
|
+
};
|
|
173
|
+
});
|
|
167
174
|
}
|
|
168
175
|
setChapters(chapters, options) {
|
|
169
176
|
const fmt = this.getFormat();
|
|
@@ -177,10 +184,10 @@ class AudioFileImpl extends BaseAudioFileImpl {
|
|
|
177
184
|
const style = options?.mp4ChapterStyle ?? "quicktime";
|
|
178
185
|
const source = fmt === "MP4" ? style : "id3";
|
|
179
186
|
const raw = sorted.map((c, i) => ({
|
|
180
|
-
id: c.id,
|
|
187
|
+
...c.id !== void 0 ? { id: c.id } : {},
|
|
181
188
|
startTimeMs: c.startTimeMs,
|
|
182
189
|
endTimeMs: inferEndTimeMs(sorted, i, trackEndMs) ?? c.startTimeMs,
|
|
183
|
-
title: c.title,
|
|
190
|
+
...c.title !== void 0 ? { title: c.title } : {},
|
|
184
191
|
source
|
|
185
192
|
}));
|
|
186
193
|
this.handle.setChapters(raw, style);
|
|
@@ -207,8 +214,9 @@ class AudioFileImpl extends BaseAudioFileImpl {
|
|
|
207
214
|
return this.handle.getRatings().map(
|
|
208
215
|
(r) => ({
|
|
209
216
|
rating: r.rating,
|
|
210
|
-
email: r.email
|
|
211
|
-
|
|
217
|
+
...r.email !== void 0 && r.email !== "" ? { email: r.email } : {},
|
|
218
|
+
// 0 must read back as ABSENT (old `r.counter || undefined` contract).
|
|
219
|
+
...r.counter !== 0 ? { counter: r.counter } : {}
|
|
212
220
|
})
|
|
213
221
|
);
|
|
214
222
|
}
|
|
@@ -239,7 +247,11 @@ class AudioFileImpl extends BaseAudioFileImpl {
|
|
|
239
247
|
return ratings.length > 0 ? normalized(ratings[0].rating) : void 0;
|
|
240
248
|
}
|
|
241
249
|
setRating(rating, email) {
|
|
242
|
-
this.setRatings([{
|
|
250
|
+
this.setRatings([{
|
|
251
|
+
rating,
|
|
252
|
+
...email !== void 0 ? { email } : {},
|
|
253
|
+
counter: 0
|
|
254
|
+
}]);
|
|
243
255
|
}
|
|
244
256
|
getId3v2Frames(id) {
|
|
245
257
|
assertMp3(this.getFormat());
|
|
@@ -20,14 +20,34 @@ export interface AudioFile {
|
|
|
20
20
|
properties(): PropertyMap;
|
|
21
21
|
/** Set multiple properties at once from a PropertyMap. */
|
|
22
22
|
setProperties(properties: PropertyMap): void;
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Get a property's values by key (typed version).
|
|
25
|
+
*
|
|
26
|
+
* Returns ALL values for the key — tag reads are arrays (taglib-sip2); the
|
|
27
|
+
* scalar convenience lives in the typed accessors (`tag().title`). `undefined`
|
|
28
|
+
* means the key is absent. Use `?.[0]` for the first value.
|
|
29
|
+
*/
|
|
30
|
+
getProperty<K extends import("../constants.js").PropertyKey>(key: K): import("../constants.js").PropertyValue<K>[] | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Get a property's values by key (string version).
|
|
33
|
+
*
|
|
34
|
+
* Returns ALL values for the key — tag reads are arrays (taglib-sip2); the
|
|
35
|
+
* scalar convenience lives in the typed accessors (`tag().title`). `undefined`
|
|
36
|
+
* means the key is absent. Use `?.[0]` for the first value.
|
|
37
|
+
*/
|
|
38
|
+
getProperty(key: string): string[] | undefined;
|
|
27
39
|
/** Set a single property value (typed version). */
|
|
28
40
|
setProperty<K extends import("../constants.js").PropertyKey>(key: K, value: import("../constants.js").PropertyValue<K>): void;
|
|
29
41
|
/** Set a single property value (string version). */
|
|
30
42
|
setProperty(key: string, value: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Remove a single property by key.
|
|
45
|
+
*
|
|
46
|
+
* Equivalent to `setProperty(key, "")` — the empty-string clearing contract,
|
|
47
|
+
* made explicit (taglib-qyw2). On both backends an empty write removes the
|
|
48
|
+
* property from the file on save.
|
|
49
|
+
*/
|
|
50
|
+
removeProperty(key: string): void;
|
|
31
51
|
/** Type-narrowing check: returns true if this file matches the given format. */
|
|
32
52
|
isFormat<F extends FileType>(format: F): this is TypedAudioFile<F>;
|
|
33
53
|
/** Check if this is an MP4/M4A file. */
|
|
@@ -147,10 +167,11 @@ export interface AudioFile {
|
|
|
147
167
|
* Note: The string-accepting overloads are intentionally removed. If you need
|
|
148
168
|
* arbitrary string keys (e.g. custom tags), use the un-narrowed AudioFile reference.
|
|
149
169
|
*/
|
|
150
|
-
export interface TypedAudioFile<F extends FileType> extends Omit<AudioFile, "getProperty" | "setProperty" | "audioProperties"> {
|
|
170
|
+
export interface TypedAudioFile<F extends FileType> extends Omit<AudioFile, "getProperty" | "setProperty" | "removeProperty" | "audioProperties"> {
|
|
151
171
|
getFormat(): F;
|
|
152
172
|
audioProperties(): TypedAudioProperties<F> | undefined;
|
|
153
|
-
getProperty<K extends FormatPropertyKey<F>>(key: K): import("../constants.js").PropertyValue<K> | undefined;
|
|
173
|
+
getProperty<K extends FormatPropertyKey<F>>(key: K): import("../constants.js").PropertyValue<K>[] | undefined;
|
|
154
174
|
setProperty<K extends FormatPropertyKey<F>>(key: K, value: import("../constants.js").PropertyValue<K>): void;
|
|
175
|
+
removeProperty<K extends FormatPropertyKey<F>>(key: K): void;
|
|
155
176
|
}
|
|
156
177
|
//# sourceMappingURL=audio-file-interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio-file-interface.d.ts","sourceRoot":"","sources":["../../../src/taglib/audio-file-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,QAAQ,EACR,OAAO,EACP,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,oB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CAAC,GACL,OAAO,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC;IAE5D,WAAW,CAAC,CAAC,SAAS,iBAAiB,CAAC,CAAC,CAAC,EACxC,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,OAAO,iBAAiB,EAAE,aAAa,CAAC,CAAC,CAAC,GAChD,IAAI,CAAC;IAER,cAAc,CAAC,CAAC,SAAS,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;CAC9D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FileHandle } from "../wasm.js";
|
|
2
|
+
/** @internal Register `handle` for release when `target` becomes garbage. */
|
|
3
|
+
export declare function registerAutoDispose(target: object, handle: FileHandle): void;
|
|
4
|
+
/** @internal Drop the pending registration for `target` (explicit dispose). */
|
|
5
|
+
export declare function unregisterAutoDispose(target: object): void;
|
|
6
|
+
//# sourceMappingURL=auto-dispose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-dispose.d.ts","sourceRoot":"","sources":["../../../src/taglib/auto-dispose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA0B7C,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAE5E;AAED,+EAA+E;AAC/E,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE1D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const registry = new FinalizationRegistry((handle) => {
|
|
2
|
+
handle.destroy();
|
|
3
|
+
});
|
|
4
|
+
function registerAutoDispose(target, handle) {
|
|
5
|
+
registry.register(target, handle, target);
|
|
6
|
+
}
|
|
7
|
+
function unregisterAutoDispose(target) {
|
|
8
|
+
registry.unregister(target);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
registerAutoDispose,
|
|
12
|
+
unregisterAutoDispose
|
|
13
|
+
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* A Proxy forwards all property access to the raw Embind object by default,
|
|
6
6
|
* overriding only getTagData, setTagData, and getAudioProperties.
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { WasmFileHandle } from "../wasm.js";
|
|
9
9
|
/** @internal Embind-generated TagWrapper — methods on C++ prototype. */
|
|
10
10
|
interface EmbindTagWrapper {
|
|
11
11
|
title(): string;
|
|
@@ -48,6 +48,6 @@ export interface EmbindFileHandle {
|
|
|
48
48
|
[key: string]: unknown;
|
|
49
49
|
}
|
|
50
50
|
/** @internal Wrap an Embind FileHandle with a Proxy for the data-oriented interface. */
|
|
51
|
-
export declare function wrapEmbindHandle(raw: EmbindFileHandle):
|
|
51
|
+
export declare function wrapEmbindHandle(raw: EmbindFileHandle): WasmFileHandle;
|
|
52
52
|
export {};
|
|
53
53
|
//# sourceMappingURL=embind-adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embind-adapter.d.ts","sourceRoot":"","sources":["../../../src/taglib/embind-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"embind-adapter.d.ts","sourceRoot":"","sources":["../../../src/taglib/embind-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAyB,cAAc,EAAE,MAAM,YAAY,CAAC;AAcxE,wEAAwE;AACxE,UAAU,gBAAgB;IACxB,KAAK,IAAI,MAAM,CAAC;IAChB,MAAM,IAAI,MAAM,CAAC;IACjB,KAAK,IAAI,MAAM,CAAC;IAChB,OAAO,IAAI,MAAM,CAAC;IAClB,KAAK,IAAI,MAAM,CAAC;IAChB,IAAI,IAAI,MAAM,CAAC;IACf,KAAK,IAAI,MAAM,CAAC;IAChB,QAAQ,CA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{
|
|
5
5
|
const stagedId3v2Frames = {};
|
|
6
|
+
let destroyed = false;
|
|
6
7
|
const overrides = {
|
|
7
8
|
getTagData() {
|
|
8
9
|
const tw = raw.getTag();
|
|
@@ -82,6 +83,22 @@ function wrapEmbindHandle(raw) {
|
|
|
82
83
|
stripId3Tags(opts) {
|
|
83
84
|
raw.stripId3Tags(opts);
|
|
84
85
|
},
|
|
86
|
+
destroy() {
|
|
87
|
+
if (destroyed) return;
|
|
88
|
+
destroyed = true;
|
|
89
|
+
raw.destroy();
|
|
90
|
+
},
|
|
91
|
+
get destroyed() {
|
|
92
|
+
return destroyed;
|
|
93
|
+
},
|
|
94
|
+
// taglib-qyw2: the PropertyMap erase pass computes freeform item names
|
|
95
|
+
// from the property table (upper-cased) and misses the restored exact-case
|
|
96
|
+
// atom (taglib-bnhl), so clears queue the exact name here; the imperative
|
|
97
|
+
// Embind model applies removeItem immediately, before setProperties.
|
|
98
|
+
setMp4ItemRemovals(removals) {
|
|
99
|
+
const handle = raw;
|
|
100
|
+
for (const name of removals) handle.removeMP4Item(name);
|
|
101
|
+
},
|
|
85
102
|
getAudioProperties() {
|
|
86
103
|
const pw = raw.getAudioProperties();
|
|
87
104
|
if (!pw) return null;
|