music-metadata 7.11.6 → 7.11.7
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 +432 -432
- package/lib/ParserFactory.d.ts +49 -49
- package/lib/ParserFactory.js +251 -251
- package/lib/aiff/AiffParser.d.ts +15 -15
- package/lib/aiff/AiffParser.js +85 -85
- package/lib/aiff/AiffToken.d.ts +22 -22
- package/lib/aiff/AiffToken.js +43 -43
- package/lib/apev2/APEv2Parser.d.ts +30 -30
- package/lib/apev2/APEv2Parser.js +162 -162
- package/lib/apev2/APEv2TagMapper.d.ts +4 -4
- package/lib/apev2/APEv2TagMapper.js +86 -86
- package/lib/apev2/APEv2Token.d.ts +100 -100
- package/lib/apev2/APEv2Token.js +126 -126
- package/lib/asf/AsfObject.d.ts +319 -319
- package/lib/asf/AsfObject.js +384 -384
- package/lib/asf/AsfParser.d.ts +17 -17
- package/lib/asf/AsfParser.js +135 -135
- package/lib/asf/AsfTagMapper.d.ts +7 -7
- package/lib/asf/AsfTagMapper.js +95 -95
- package/lib/asf/AsfUtil.d.ts +13 -13
- package/lib/asf/AsfUtil.js +40 -40
- package/lib/asf/GUID.d.ts +86 -86
- package/lib/asf/GUID.js +123 -123
- package/lib/common/BasicParser.d.ts +17 -17
- package/lib/common/BasicParser.js +18 -18
- package/lib/common/CaseInsensitiveTagMap.d.ts +10 -10
- package/lib/common/CaseInsensitiveTagMap.js +21 -21
- package/lib/common/CombinedTagMapper.d.ts +19 -19
- package/lib/common/CombinedTagMapper.js +51 -51
- package/lib/common/FourCC.d.ts +6 -6
- package/lib/common/FourCC.js +28 -28
- package/lib/common/GenericTagMapper.d.ts +51 -51
- package/lib/common/GenericTagMapper.js +55 -55
- package/lib/common/GenericTagTypes.d.ts +33 -33
- package/lib/common/GenericTagTypes.js +131 -131
- package/lib/common/MetadataCollector.d.ts +76 -76
- package/lib/common/MetadataCollector.js +275 -275
- package/lib/common/RandomFileReader.d.ts +20 -20
- package/lib/common/RandomFileReader.js +37 -37
- package/lib/common/RandomUint8ArrayReader.d.ts +18 -18
- package/lib/common/RandomUint8ArrayReader.js +25 -25
- package/lib/common/Util.d.ts +58 -57
- package/lib/common/Util.js +162 -169
- package/lib/core.d.ts +48 -48
- package/lib/core.js +90 -90
- package/lib/dsdiff/DsdiffParser.d.ts +14 -14
- package/lib/dsdiff/DsdiffParser.js +143 -143
- package/lib/dsdiff/DsdiffToken.d.ts +9 -9
- package/lib/dsdiff/DsdiffToken.js +21 -21
- package/lib/dsf/DsfChunk.d.ts +86 -86
- package/lib/dsf/DsfChunk.js +54 -54
- package/lib/dsf/DsfParser.d.ts +9 -9
- package/lib/dsf/DsfParser.js +56 -56
- package/lib/flac/FlacParser.d.ts +28 -28
- package/lib/flac/FlacParser.js +175 -175
- package/lib/id3v1/ID3v1Parser.d.ts +13 -13
- package/lib/id3v1/ID3v1Parser.js +134 -134
- package/lib/id3v1/ID3v1TagMap.d.ts +4 -4
- package/lib/id3v1/ID3v1TagMap.js +22 -22
- package/lib/id3v2/AbstractID3Parser.d.ts +17 -17
- package/lib/id3v2/AbstractID3Parser.js +60 -60
- package/lib/id3v2/FrameParser.d.ts +32 -32
- package/lib/id3v2/FrameParser.js +329 -323
- package/lib/id3v2/ID3v22TagMapper.d.ts +9 -9
- package/lib/id3v2/ID3v22TagMapper.js +55 -55
- package/lib/id3v2/ID3v24TagMapper.d.ts +14 -14
- package/lib/id3v2/ID3v24TagMapper.js +193 -193
- package/lib/id3v2/ID3v2Parser.d.ts +29 -29
- package/lib/id3v2/ID3v2Parser.js +194 -194
- package/lib/id3v2/ID3v2Token.d.ts +73 -73
- package/lib/id3v2/ID3v2Token.js +106 -106
- package/lib/iff/index.d.ts +33 -33
- package/lib/iff/index.js +19 -19
- package/lib/index.d.ts +45 -45
- package/lib/index.js +74 -74
- package/lib/lyrics3/Lyrics3.d.ts +3 -3
- package/lib/lyrics3/Lyrics3.js +17 -17
- package/lib/matroska/MatroskaDtd.d.ts +8 -8
- package/lib/matroska/MatroskaDtd.js +279 -279
- package/lib/matroska/MatroskaParser.d.ts +37 -37
- package/lib/matroska/MatroskaParser.js +235 -235
- package/lib/matroska/MatroskaTagMapper.d.ts +4 -4
- package/lib/matroska/MatroskaTagMapper.js +35 -35
- package/lib/matroska/types.d.ts +175 -175
- package/lib/matroska/types.js +32 -32
- package/lib/mp4/Atom.d.ts +16 -16
- package/lib/mp4/Atom.js +70 -70
- package/lib/mp4/AtomToken.d.ts +395 -395
- package/lib/mp4/AtomToken.js +406 -406
- package/lib/mp4/MP4Parser.d.ts +30 -30
- package/lib/mp4/MP4Parser.js +511 -511
- package/lib/mp4/MP4TagMapper.d.ts +5 -5
- package/lib/mp4/MP4TagMapper.js +115 -115
- package/lib/mpeg/ExtendedLameHeader.d.ts +27 -27
- package/lib/mpeg/ExtendedLameHeader.js +31 -31
- package/lib/mpeg/MpegParser.d.ts +49 -49
- package/lib/mpeg/MpegParser.js +529 -529
- package/lib/mpeg/ReplayGainDataFormat.d.ts +55 -55
- package/lib/mpeg/ReplayGainDataFormat.js +69 -69
- package/lib/mpeg/XingTag.d.ts +45 -45
- package/lib/mpeg/XingTag.js +69 -69
- package/lib/musepack/index.d.ts +5 -5
- package/lib/musepack/index.js +32 -32
- package/lib/musepack/sv7/BitReader.d.ts +13 -13
- package/lib/musepack/sv7/BitReader.js +54 -54
- package/lib/musepack/sv7/MpcSv7Parser.d.ts +8 -8
- package/lib/musepack/sv7/MpcSv7Parser.js +46 -46
- package/lib/musepack/sv7/StreamVersion7.d.ts +28 -28
- package/lib/musepack/sv7/StreamVersion7.js +41 -41
- package/lib/musepack/sv8/MpcSv8Parser.d.ts +6 -6
- package/lib/musepack/sv8/MpcSv8Parser.js +55 -55
- package/lib/musepack/sv8/StreamVersion8.d.ts +40 -40
- package/lib/musepack/sv8/StreamVersion8.js +80 -80
- package/lib/ogg/Ogg.d.ts +72 -72
- package/lib/ogg/Ogg.js +2 -2
- package/lib/ogg/OggParser.d.ts +23 -23
- package/lib/ogg/OggParser.js +126 -126
- package/lib/ogg/opus/Opus.d.ts +48 -48
- package/lib/ogg/opus/Opus.js +28 -28
- package/lib/ogg/opus/OpusParser.d.ts +25 -25
- package/lib/ogg/opus/OpusParser.js +56 -56
- package/lib/ogg/speex/Speex.d.ts +36 -36
- package/lib/ogg/speex/Speex.js +31 -31
- package/lib/ogg/speex/SpeexParser.d.ts +22 -22
- package/lib/ogg/speex/SpeexParser.js +35 -35
- package/lib/ogg/theora/Theora.d.ts +20 -20
- package/lib/ogg/theora/Theora.js +23 -23
- package/lib/ogg/theora/TheoraParser.d.ts +28 -28
- package/lib/ogg/theora/TheoraParser.js +44 -44
- package/lib/ogg/vorbis/Vorbis.d.ts +79 -79
- package/lib/ogg/vorbis/Vorbis.js +78 -78
- package/lib/ogg/vorbis/VorbisDecoder.d.ts +12 -12
- package/lib/ogg/vorbis/VorbisDecoder.js +32 -32
- package/lib/ogg/vorbis/VorbisParser.d.ts +36 -36
- package/lib/ogg/vorbis/VorbisParser.js +128 -128
- package/lib/ogg/vorbis/VorbisTagMapper.d.ts +7 -7
- package/lib/ogg/vorbis/VorbisTagMapper.js +132 -132
- package/lib/riff/RiffChunk.d.ts +16 -16
- package/lib/riff/RiffChunk.js +32 -32
- package/lib/riff/RiffInfoTagMap.d.ts +10 -10
- package/lib/riff/RiffInfoTagMap.js +37 -37
- package/lib/type.d.ts +599 -599
- package/lib/type.js +13 -13
- package/lib/wav/WaveChunk.d.ts +64 -64
- package/lib/wav/WaveChunk.js +65 -65
- package/lib/wav/WaveParser.d.ts +24 -24
- package/lib/wav/WaveParser.js +144 -144
- package/lib/wavpack/WavPackParser.d.ts +14 -14
- package/lib/wavpack/WavPackParser.js +105 -105
- package/lib/wavpack/WavPackToken.d.ts +64 -64
- package/lib/wavpack/WavPackToken.js +76 -76
- package/package.json +142 -142
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ChunkHeader64 = void 0;
|
|
4
|
-
const Token = require("token-types");
|
|
5
|
-
const FourCC_1 = require("../common/FourCC");
|
|
6
|
-
/**
|
|
7
|
-
* DSDIFF chunk header
|
|
8
|
-
* The data-size encoding is deviating from EA-IFF 85
|
|
9
|
-
* Ref: http://www.sonicstudio.com/pdf/dsd/DSDIFF_1.5_Spec.pdf
|
|
10
|
-
*/
|
|
11
|
-
exports.ChunkHeader64 = {
|
|
12
|
-
len: 12,
|
|
13
|
-
get: (buf, off) => {
|
|
14
|
-
return {
|
|
15
|
-
// Group-ID
|
|
16
|
-
chunkID: FourCC_1.FourCcToken.get(buf, off),
|
|
17
|
-
// Size
|
|
18
|
-
chunkSize: Token.INT64_BE.get(buf, off + 4)
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChunkHeader64 = void 0;
|
|
4
|
+
const Token = require("token-types");
|
|
5
|
+
const FourCC_1 = require("../common/FourCC");
|
|
6
|
+
/**
|
|
7
|
+
* DSDIFF chunk header
|
|
8
|
+
* The data-size encoding is deviating from EA-IFF 85
|
|
9
|
+
* Ref: http://www.sonicstudio.com/pdf/dsd/DSDIFF_1.5_Spec.pdf
|
|
10
|
+
*/
|
|
11
|
+
exports.ChunkHeader64 = {
|
|
12
|
+
len: 12,
|
|
13
|
+
get: (buf, off) => {
|
|
14
|
+
return {
|
|
15
|
+
// Group-ID
|
|
16
|
+
chunkID: FourCC_1.FourCcToken.get(buf, off),
|
|
17
|
+
// Size
|
|
18
|
+
chunkSize: Token.INT64_BE.get(buf, off + 4)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
};
|
package/lib/dsf/DsfChunk.d.ts
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import { IGetToken } from 'strtok3/lib/core';
|
|
2
|
-
/**
|
|
3
|
-
* Common interface for the common chunk DSD header
|
|
4
|
-
*/
|
|
5
|
-
export interface IChunkHeader {
|
|
6
|
-
/**
|
|
7
|
-
* Chunk ID
|
|
8
|
-
*/
|
|
9
|
-
id: string;
|
|
10
|
-
/**
|
|
11
|
-
* Chunk size
|
|
12
|
-
*/
|
|
13
|
-
size: bigint;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size
|
|
17
|
-
*/
|
|
18
|
-
export declare const ChunkHeader: IGetToken<IChunkHeader>;
|
|
19
|
-
/**
|
|
20
|
-
* Interface to DSD payload chunk
|
|
21
|
-
*/
|
|
22
|
-
export interface IDsdChunk {
|
|
23
|
-
/**
|
|
24
|
-
* Total file size
|
|
25
|
-
*/
|
|
26
|
-
fileSize: bigint;
|
|
27
|
-
/**
|
|
28
|
-
* If Metadata doesn’t exist, set 0. If the file has ID3v2 tag, then set the pointer to it.
|
|
29
|
-
* ID3v2 tag should be located in the end of the file.
|
|
30
|
-
*/
|
|
31
|
-
metadataPointer: bigint;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size
|
|
35
|
-
*/
|
|
36
|
-
export declare const DsdChunk: IGetToken<IDsdChunk>;
|
|
37
|
-
export declare enum ChannelType {
|
|
38
|
-
mono = 1,
|
|
39
|
-
stereo = 2,
|
|
40
|
-
channels = 3,
|
|
41
|
-
quad = 4,
|
|
42
|
-
'4 channels' = 5,
|
|
43
|
-
'5 channels' = 6,
|
|
44
|
-
'5.1 channels' = 7
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Interface to format chunk payload chunk
|
|
48
|
-
*/
|
|
49
|
-
export interface IFormatChunk {
|
|
50
|
-
/**
|
|
51
|
-
* Version of this file format
|
|
52
|
-
*/
|
|
53
|
-
formatVersion: number;
|
|
54
|
-
/**
|
|
55
|
-
* Format ID
|
|
56
|
-
*/
|
|
57
|
-
formatID: number;
|
|
58
|
-
/**
|
|
59
|
-
* Channel Type
|
|
60
|
-
*/
|
|
61
|
-
channelType: ChannelType;
|
|
62
|
-
/**
|
|
63
|
-
* Channel num
|
|
64
|
-
*/
|
|
65
|
-
channelNum: number;
|
|
66
|
-
/**
|
|
67
|
-
* Sampling frequency
|
|
68
|
-
*/
|
|
69
|
-
samplingFrequency: number;
|
|
70
|
-
/**
|
|
71
|
-
* Bits per sample
|
|
72
|
-
*/
|
|
73
|
-
bitsPerSample: number;
|
|
74
|
-
/**
|
|
75
|
-
* Sample count
|
|
76
|
-
*/
|
|
77
|
-
sampleCount: bigint;
|
|
78
|
-
/**
|
|
79
|
-
* Block size per channel
|
|
80
|
-
*/
|
|
81
|
-
blockSizePerChannel: number;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size
|
|
85
|
-
*/
|
|
86
|
-
export declare const FormatChunk: IGetToken<IFormatChunk>;
|
|
1
|
+
import { IGetToken } from 'strtok3/lib/core';
|
|
2
|
+
/**
|
|
3
|
+
* Common interface for the common chunk DSD header
|
|
4
|
+
*/
|
|
5
|
+
export interface IChunkHeader {
|
|
6
|
+
/**
|
|
7
|
+
* Chunk ID
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* Chunk size
|
|
12
|
+
*/
|
|
13
|
+
size: bigint;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size
|
|
17
|
+
*/
|
|
18
|
+
export declare const ChunkHeader: IGetToken<IChunkHeader>;
|
|
19
|
+
/**
|
|
20
|
+
* Interface to DSD payload chunk
|
|
21
|
+
*/
|
|
22
|
+
export interface IDsdChunk {
|
|
23
|
+
/**
|
|
24
|
+
* Total file size
|
|
25
|
+
*/
|
|
26
|
+
fileSize: bigint;
|
|
27
|
+
/**
|
|
28
|
+
* If Metadata doesn’t exist, set 0. If the file has ID3v2 tag, then set the pointer to it.
|
|
29
|
+
* ID3v2 tag should be located in the end of the file.
|
|
30
|
+
*/
|
|
31
|
+
metadataPointer: bigint;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size
|
|
35
|
+
*/
|
|
36
|
+
export declare const DsdChunk: IGetToken<IDsdChunk>;
|
|
37
|
+
export declare enum ChannelType {
|
|
38
|
+
mono = 1,
|
|
39
|
+
stereo = 2,
|
|
40
|
+
channels = 3,
|
|
41
|
+
quad = 4,
|
|
42
|
+
'4 channels' = 5,
|
|
43
|
+
'5 channels' = 6,
|
|
44
|
+
'5.1 channels' = 7
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Interface to format chunk payload chunk
|
|
48
|
+
*/
|
|
49
|
+
export interface IFormatChunk {
|
|
50
|
+
/**
|
|
51
|
+
* Version of this file format
|
|
52
|
+
*/
|
|
53
|
+
formatVersion: number;
|
|
54
|
+
/**
|
|
55
|
+
* Format ID
|
|
56
|
+
*/
|
|
57
|
+
formatID: number;
|
|
58
|
+
/**
|
|
59
|
+
* Channel Type
|
|
60
|
+
*/
|
|
61
|
+
channelType: ChannelType;
|
|
62
|
+
/**
|
|
63
|
+
* Channel num
|
|
64
|
+
*/
|
|
65
|
+
channelNum: number;
|
|
66
|
+
/**
|
|
67
|
+
* Sampling frequency
|
|
68
|
+
*/
|
|
69
|
+
samplingFrequency: number;
|
|
70
|
+
/**
|
|
71
|
+
* Bits per sample
|
|
72
|
+
*/
|
|
73
|
+
bitsPerSample: number;
|
|
74
|
+
/**
|
|
75
|
+
* Sample count
|
|
76
|
+
*/
|
|
77
|
+
sampleCount: bigint;
|
|
78
|
+
/**
|
|
79
|
+
* Block size per channel
|
|
80
|
+
*/
|
|
81
|
+
blockSizePerChannel: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size
|
|
85
|
+
*/
|
|
86
|
+
export declare const FormatChunk: IGetToken<IFormatChunk>;
|
package/lib/dsf/DsfChunk.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormatChunk = exports.ChannelType = exports.DsdChunk = exports.ChunkHeader = void 0;
|
|
4
|
-
const Token = require("token-types");
|
|
5
|
-
const FourCC_1 = require("../common/FourCC");
|
|
6
|
-
/**
|
|
7
|
-
* Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size
|
|
8
|
-
*/
|
|
9
|
-
exports.ChunkHeader = {
|
|
10
|
-
len: 12,
|
|
11
|
-
get: (buf, off) => {
|
|
12
|
-
return { id: FourCC_1.FourCcToken.get(buf, off), size: Token.UINT64_LE.get(buf, off + 4) };
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size
|
|
17
|
-
*/
|
|
18
|
-
exports.DsdChunk = {
|
|
19
|
-
len: 16,
|
|
20
|
-
get: (buf, off) => {
|
|
21
|
-
return {
|
|
22
|
-
fileSize: Token.INT64_LE.get(buf, off),
|
|
23
|
-
metadataPointer: Token.INT64_LE.get(buf, off + 8)
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
var ChannelType;
|
|
28
|
-
(function (ChannelType) {
|
|
29
|
-
ChannelType[ChannelType["mono"] = 1] = "mono";
|
|
30
|
-
ChannelType[ChannelType["stereo"] = 2] = "stereo";
|
|
31
|
-
ChannelType[ChannelType["channels"] = 3] = "channels";
|
|
32
|
-
ChannelType[ChannelType["quad"] = 4] = "quad";
|
|
33
|
-
ChannelType[ChannelType["4 channels"] = 5] = "4 channels";
|
|
34
|
-
ChannelType[ChannelType["5 channels"] = 6] = "5 channels";
|
|
35
|
-
ChannelType[ChannelType["5.1 channels"] = 7] = "5.1 channels";
|
|
36
|
-
})(ChannelType = exports.ChannelType || (exports.ChannelType = {}));
|
|
37
|
-
/**
|
|
38
|
-
* Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size
|
|
39
|
-
*/
|
|
40
|
-
exports.FormatChunk = {
|
|
41
|
-
len: 40,
|
|
42
|
-
get: (buf, off) => {
|
|
43
|
-
return {
|
|
44
|
-
formatVersion: Token.INT32_LE.get(buf, off),
|
|
45
|
-
formatID: Token.INT32_LE.get(buf, off + 4),
|
|
46
|
-
channelType: Token.INT32_LE.get(buf, off + 8),
|
|
47
|
-
channelNum: Token.INT32_LE.get(buf, off + 12),
|
|
48
|
-
samplingFrequency: Token.INT32_LE.get(buf, off + 16),
|
|
49
|
-
bitsPerSample: Token.INT32_LE.get(buf, off + 20),
|
|
50
|
-
sampleCount: Token.INT64_LE.get(buf, off + 24),
|
|
51
|
-
blockSizePerChannel: Token.INT32_LE.get(buf, off + 32)
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormatChunk = exports.ChannelType = exports.DsdChunk = exports.ChunkHeader = void 0;
|
|
4
|
+
const Token = require("token-types");
|
|
5
|
+
const FourCC_1 = require("../common/FourCC");
|
|
6
|
+
/**
|
|
7
|
+
* Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size
|
|
8
|
+
*/
|
|
9
|
+
exports.ChunkHeader = {
|
|
10
|
+
len: 12,
|
|
11
|
+
get: (buf, off) => {
|
|
12
|
+
return { id: FourCC_1.FourCcToken.get(buf, off), size: Token.UINT64_LE.get(buf, off + 4) };
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size
|
|
17
|
+
*/
|
|
18
|
+
exports.DsdChunk = {
|
|
19
|
+
len: 16,
|
|
20
|
+
get: (buf, off) => {
|
|
21
|
+
return {
|
|
22
|
+
fileSize: Token.INT64_LE.get(buf, off),
|
|
23
|
+
metadataPointer: Token.INT64_LE.get(buf, off + 8)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var ChannelType;
|
|
28
|
+
(function (ChannelType) {
|
|
29
|
+
ChannelType[ChannelType["mono"] = 1] = "mono";
|
|
30
|
+
ChannelType[ChannelType["stereo"] = 2] = "stereo";
|
|
31
|
+
ChannelType[ChannelType["channels"] = 3] = "channels";
|
|
32
|
+
ChannelType[ChannelType["quad"] = 4] = "quad";
|
|
33
|
+
ChannelType[ChannelType["4 channels"] = 5] = "4 channels";
|
|
34
|
+
ChannelType[ChannelType["5 channels"] = 6] = "5 channels";
|
|
35
|
+
ChannelType[ChannelType["5.1 channels"] = 7] = "5.1 channels";
|
|
36
|
+
})(ChannelType = exports.ChannelType || (exports.ChannelType = {}));
|
|
37
|
+
/**
|
|
38
|
+
* Common chunk DSD header: the 'chunk name (Four-CC)' & chunk size
|
|
39
|
+
*/
|
|
40
|
+
exports.FormatChunk = {
|
|
41
|
+
len: 40,
|
|
42
|
+
get: (buf, off) => {
|
|
43
|
+
return {
|
|
44
|
+
formatVersion: Token.INT32_LE.get(buf, off),
|
|
45
|
+
formatID: Token.INT32_LE.get(buf, off + 4),
|
|
46
|
+
channelType: Token.INT32_LE.get(buf, off + 8),
|
|
47
|
+
channelNum: Token.INT32_LE.get(buf, off + 12),
|
|
48
|
+
samplingFrequency: Token.INT32_LE.get(buf, off + 16),
|
|
49
|
+
bitsPerSample: Token.INT32_LE.get(buf, off + 20),
|
|
50
|
+
sampleCount: Token.INT64_LE.get(buf, off + 24),
|
|
51
|
+
blockSizePerChannel: Token.INT32_LE.get(buf, off + 32)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
};
|
package/lib/dsf/DsfParser.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AbstractID3Parser } from '../id3v2/AbstractID3Parser';
|
|
2
|
-
/**
|
|
3
|
-
* DSF (dsd stream file) File Parser
|
|
4
|
-
* Ref: https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf
|
|
5
|
-
*/
|
|
6
|
-
export declare class DsfParser extends AbstractID3Parser {
|
|
7
|
-
_parse(): Promise<void>;
|
|
8
|
-
private parseChunks;
|
|
9
|
-
}
|
|
1
|
+
import { AbstractID3Parser } from '../id3v2/AbstractID3Parser';
|
|
2
|
+
/**
|
|
3
|
+
* DSF (dsd stream file) File Parser
|
|
4
|
+
* Ref: https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf
|
|
5
|
+
*/
|
|
6
|
+
export declare class DsfParser extends AbstractID3Parser {
|
|
7
|
+
_parse(): Promise<void>;
|
|
8
|
+
private parseChunks;
|
|
9
|
+
}
|
package/lib/dsf/DsfParser.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DsfParser = void 0;
|
|
4
|
-
const _debug = require("debug");
|
|
5
|
-
const AbstractID3Parser_1 = require("../id3v2/AbstractID3Parser");
|
|
6
|
-
const DsfChunk_1 = require("./DsfChunk");
|
|
7
|
-
const ID3v2Parser_1 = require("../id3v2/ID3v2Parser");
|
|
8
|
-
const debug = _debug('music-metadata:parser:DSF');
|
|
9
|
-
/**
|
|
10
|
-
* DSF (dsd stream file) File Parser
|
|
11
|
-
* Ref: https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf
|
|
12
|
-
*/
|
|
13
|
-
class DsfParser extends AbstractID3Parser_1.AbstractID3Parser {
|
|
14
|
-
async _parse() {
|
|
15
|
-
const p0 = this.tokenizer.position; // mark start position, normally 0
|
|
16
|
-
const chunkHeader = await this.tokenizer.readToken(DsfChunk_1.ChunkHeader);
|
|
17
|
-
if (chunkHeader.id !== 'DSD ')
|
|
18
|
-
throw new Error('Invalid chunk signature');
|
|
19
|
-
this.metadata.setFormat('container', 'DSF');
|
|
20
|
-
this.metadata.setFormat('lossless', true);
|
|
21
|
-
const dsdChunk = await this.tokenizer.readToken(DsfChunk_1.DsdChunk);
|
|
22
|
-
if (dsdChunk.metadataPointer === BigInt(0)) {
|
|
23
|
-
debug(`No ID3v2 tag present`);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
debug(`expect ID3v2 at offset=${dsdChunk.metadataPointer}`);
|
|
27
|
-
await this.parseChunks(dsdChunk.fileSize - chunkHeader.size);
|
|
28
|
-
// Jump to ID3 header
|
|
29
|
-
await this.tokenizer.ignore(Number(dsdChunk.metadataPointer) - this.tokenizer.position - p0);
|
|
30
|
-
return new ID3v2Parser_1.ID3v2Parser().parse(this.metadata, this.tokenizer, this.options);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async parseChunks(bytesRemaining) {
|
|
34
|
-
while (bytesRemaining >= DsfChunk_1.ChunkHeader.len) {
|
|
35
|
-
const chunkHeader = await this.tokenizer.readToken(DsfChunk_1.ChunkHeader);
|
|
36
|
-
debug(`Parsing chunk name=${chunkHeader.id} size=${chunkHeader.size}`);
|
|
37
|
-
switch (chunkHeader.id) {
|
|
38
|
-
case 'fmt ':
|
|
39
|
-
const formatChunk = await this.tokenizer.readToken(DsfChunk_1.FormatChunk);
|
|
40
|
-
this.metadata.setFormat('numberOfChannels', formatChunk.channelNum);
|
|
41
|
-
this.metadata.setFormat('sampleRate', formatChunk.samplingFrequency);
|
|
42
|
-
this.metadata.setFormat('bitsPerSample', formatChunk.bitsPerSample);
|
|
43
|
-
this.metadata.setFormat('numberOfSamples', formatChunk.sampleCount);
|
|
44
|
-
this.metadata.setFormat('duration', Number(formatChunk.sampleCount) / formatChunk.samplingFrequency);
|
|
45
|
-
const bitrate = formatChunk.bitsPerSample * formatChunk.samplingFrequency * formatChunk.channelNum;
|
|
46
|
-
this.metadata.setFormat('bitrate', bitrate);
|
|
47
|
-
return; // We got what we want, stop further processing of chunks
|
|
48
|
-
default:
|
|
49
|
-
this.tokenizer.ignore(Number(chunkHeader.size) - DsfChunk_1.ChunkHeader.len);
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
bytesRemaining -= chunkHeader.size;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.DsfParser = DsfParser;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DsfParser = void 0;
|
|
4
|
+
const _debug = require("debug");
|
|
5
|
+
const AbstractID3Parser_1 = require("../id3v2/AbstractID3Parser");
|
|
6
|
+
const DsfChunk_1 = require("./DsfChunk");
|
|
7
|
+
const ID3v2Parser_1 = require("../id3v2/ID3v2Parser");
|
|
8
|
+
const debug = _debug('music-metadata:parser:DSF');
|
|
9
|
+
/**
|
|
10
|
+
* DSF (dsd stream file) File Parser
|
|
11
|
+
* Ref: https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf
|
|
12
|
+
*/
|
|
13
|
+
class DsfParser extends AbstractID3Parser_1.AbstractID3Parser {
|
|
14
|
+
async _parse() {
|
|
15
|
+
const p0 = this.tokenizer.position; // mark start position, normally 0
|
|
16
|
+
const chunkHeader = await this.tokenizer.readToken(DsfChunk_1.ChunkHeader);
|
|
17
|
+
if (chunkHeader.id !== 'DSD ')
|
|
18
|
+
throw new Error('Invalid chunk signature');
|
|
19
|
+
this.metadata.setFormat('container', 'DSF');
|
|
20
|
+
this.metadata.setFormat('lossless', true);
|
|
21
|
+
const dsdChunk = await this.tokenizer.readToken(DsfChunk_1.DsdChunk);
|
|
22
|
+
if (dsdChunk.metadataPointer === BigInt(0)) {
|
|
23
|
+
debug(`No ID3v2 tag present`);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
debug(`expect ID3v2 at offset=${dsdChunk.metadataPointer}`);
|
|
27
|
+
await this.parseChunks(dsdChunk.fileSize - chunkHeader.size);
|
|
28
|
+
// Jump to ID3 header
|
|
29
|
+
await this.tokenizer.ignore(Number(dsdChunk.metadataPointer) - this.tokenizer.position - p0);
|
|
30
|
+
return new ID3v2Parser_1.ID3v2Parser().parse(this.metadata, this.tokenizer, this.options);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async parseChunks(bytesRemaining) {
|
|
34
|
+
while (bytesRemaining >= DsfChunk_1.ChunkHeader.len) {
|
|
35
|
+
const chunkHeader = await this.tokenizer.readToken(DsfChunk_1.ChunkHeader);
|
|
36
|
+
debug(`Parsing chunk name=${chunkHeader.id} size=${chunkHeader.size}`);
|
|
37
|
+
switch (chunkHeader.id) {
|
|
38
|
+
case 'fmt ':
|
|
39
|
+
const formatChunk = await this.tokenizer.readToken(DsfChunk_1.FormatChunk);
|
|
40
|
+
this.metadata.setFormat('numberOfChannels', formatChunk.channelNum);
|
|
41
|
+
this.metadata.setFormat('sampleRate', formatChunk.samplingFrequency);
|
|
42
|
+
this.metadata.setFormat('bitsPerSample', formatChunk.bitsPerSample);
|
|
43
|
+
this.metadata.setFormat('numberOfSamples', formatChunk.sampleCount);
|
|
44
|
+
this.metadata.setFormat('duration', Number(formatChunk.sampleCount) / formatChunk.samplingFrequency);
|
|
45
|
+
const bitrate = formatChunk.bitsPerSample * formatChunk.samplingFrequency * formatChunk.channelNum;
|
|
46
|
+
this.metadata.setFormat('bitrate', bitrate);
|
|
47
|
+
return; // We got what we want, stop further processing of chunks
|
|
48
|
+
default:
|
|
49
|
+
this.tokenizer.ignore(Number(chunkHeader.size) - DsfChunk_1.ChunkHeader.len);
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
bytesRemaining -= chunkHeader.size;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.DsfParser = DsfParser;
|
package/lib/flac/FlacParser.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { ITokenizer } from 'strtok3/lib/core';
|
|
2
|
-
import { AbstractID3Parser } from '../id3v2/AbstractID3Parser';
|
|
3
|
-
import { INativeMetadataCollector } from '../common/MetadataCollector';
|
|
4
|
-
import { IOptions } from '../type';
|
|
5
|
-
import { ITokenParser } from '../ParserFactory';
|
|
6
|
-
export declare class FlacParser extends AbstractID3Parser {
|
|
7
|
-
private vorbisParser;
|
|
8
|
-
private padding;
|
|
9
|
-
/**
|
|
10
|
-
* Initialize parser with output (metadata), input (tokenizer) & parsing options (options).
|
|
11
|
-
* @param {INativeMetadataCollector} metadata Output
|
|
12
|
-
* @param {ITokenizer} tokenizer Input
|
|
13
|
-
* @param {IOptions} options Parsing options
|
|
14
|
-
*/
|
|
15
|
-
init(metadata: INativeMetadataCollector, tokenizer: ITokenizer, options: IOptions): ITokenParser;
|
|
16
|
-
_parse(): Promise<void>;
|
|
17
|
-
private parseDataBlock;
|
|
18
|
-
/**
|
|
19
|
-
* Parse STREAMINFO
|
|
20
|
-
*/
|
|
21
|
-
private parseBlockStreamInfo;
|
|
22
|
-
/**
|
|
23
|
-
* Parse VORBIS_COMMENT
|
|
24
|
-
* Ref: https://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-640004.2.3
|
|
25
|
-
*/
|
|
26
|
-
private parseComment;
|
|
27
|
-
private parsePicture;
|
|
28
|
-
}
|
|
1
|
+
import { ITokenizer } from 'strtok3/lib/core';
|
|
2
|
+
import { AbstractID3Parser } from '../id3v2/AbstractID3Parser';
|
|
3
|
+
import { INativeMetadataCollector } from '../common/MetadataCollector';
|
|
4
|
+
import { IOptions } from '../type';
|
|
5
|
+
import { ITokenParser } from '../ParserFactory';
|
|
6
|
+
export declare class FlacParser extends AbstractID3Parser {
|
|
7
|
+
private vorbisParser;
|
|
8
|
+
private padding;
|
|
9
|
+
/**
|
|
10
|
+
* Initialize parser with output (metadata), input (tokenizer) & parsing options (options).
|
|
11
|
+
* @param {INativeMetadataCollector} metadata Output
|
|
12
|
+
* @param {ITokenizer} tokenizer Input
|
|
13
|
+
* @param {IOptions} options Parsing options
|
|
14
|
+
*/
|
|
15
|
+
init(metadata: INativeMetadataCollector, tokenizer: ITokenizer, options: IOptions): ITokenParser;
|
|
16
|
+
_parse(): Promise<void>;
|
|
17
|
+
private parseDataBlock;
|
|
18
|
+
/**
|
|
19
|
+
* Parse STREAMINFO
|
|
20
|
+
*/
|
|
21
|
+
private parseBlockStreamInfo;
|
|
22
|
+
/**
|
|
23
|
+
* Parse VORBIS_COMMENT
|
|
24
|
+
* Ref: https://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-640004.2.3
|
|
25
|
+
*/
|
|
26
|
+
private parseComment;
|
|
27
|
+
private parsePicture;
|
|
28
|
+
}
|