music-metadata 7.12.4 → 8.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 +47 -31
- package/lib/ParserFactory.js +37 -41
- package/lib/aiff/AiffParser.js +25 -17
- package/lib/aiff/AiffToken.js +13 -12
- package/lib/apev2/APEv2Parser.js +29 -32
- package/lib/apev2/APEv2TagMapper.js +2 -6
- package/lib/apev2/APEv2Token.js +13 -19
- package/lib/asf/AsfObject.js +42 -56
- package/lib/asf/AsfParser.js +15 -19
- package/lib/asf/AsfTagMapper.js +2 -6
- package/lib/asf/AsfUtil.js +4 -7
- package/lib/asf/GUID.js +1 -4
- package/lib/common/BasicParser.js +1 -5
- package/lib/common/CaseInsensitiveTagMap.js +2 -6
- package/lib/common/CombinedTagMapper.js +20 -24
- package/lib/common/FourCC.js +3 -6
- package/lib/common/GenericTagMapper.js +2 -6
- package/lib/common/GenericTagTypes.js +5 -10
- package/lib/common/MetadataCollector.js +20 -25
- package/lib/common/RandomFileReader.js +2 -6
- package/lib/common/RandomUint8ArrayReader.js +1 -5
- package/lib/common/Util.js +11 -25
- package/lib/core.js +18 -28
- package/lib/dsdiff/DsdiffParser.js +24 -28
- package/lib/dsdiff/DsdiffToken.js +4 -7
- package/lib/dsf/DsfChunk.js +8 -11
- package/lib/dsf/DsfParser.js +13 -17
- package/lib/flac/FlacParser.js +22 -26
- package/lib/id3v1/ID3v1Parser.js +16 -21
- package/lib/id3v1/ID3v1TagMap.js +2 -6
- package/lib/id3v2/AbstractID3Parser.js +13 -17
- package/lib/id3v2/FrameParser.js +12 -17
- package/lib/id3v2/ID3v22TagMapper.js +4 -8
- package/lib/id3v2/ID3v24TagMapper.js +5 -9
- package/lib/id3v2/ID3v2Parser.js +10 -14
- package/lib/id3v2/ID3v2Token.js +9 -12
- package/lib/iff/index.js +4 -7
- package/lib/index.js +14 -44
- package/lib/lyrics3/Lyrics3.js +3 -7
- package/lib/matroska/MatroskaDtd.js +111 -114
- package/lib/matroska/MatroskaParser.js +20 -24
- package/lib/matroska/MatroskaTagMapper.js +2 -6
- package/lib/matroska/types.js +6 -9
- package/lib/mp4/Atom.js +4 -8
- package/lib/mp4/AtomToken.js +29 -44
- package/lib/mp4/MP4Parser.js +12 -16
- package/lib/mp4/MP4TagMapper.js +4 -8
- package/lib/mpeg/ExtendedLameHeader.js +6 -9
- package/lib/mpeg/MpegParser.js +17 -21
- package/lib/mpeg/ReplayGainDataFormat.js +2 -5
- package/lib/mpeg/XingTag.js +9 -13
- package/lib/musepack/index.js +10 -12
- package/lib/musepack/sv7/BitReader.js +2 -6
- package/lib/musepack/sv7/MpcSv7Parser.js +9 -13
- package/lib/musepack/sv7/StreamVersion7.js +3 -6
- package/lib/musepack/sv8/MpcSv8Parser.js +9 -13
- package/lib/musepack/sv8/StreamVersion8.js +5 -9
- package/lib/ogg/Ogg.js +1 -2
- package/lib/ogg/OggParser.js +19 -24
- package/lib/ogg/opus/Opus.js +2 -6
- package/lib/ogg/opus/OpusParser.js +4 -8
- package/lib/ogg/speex/Speex.js +3 -6
- package/lib/ogg/speex/SpeexParser.js +5 -9
- package/lib/ogg/theora/Theora.js +2 -5
- package/lib/ogg/theora/TheoraParser.js +5 -9
- package/lib/ogg/vorbis/Vorbis.js +6 -10
- package/lib/ogg/vorbis/VorbisDecoder.js +2 -6
- package/lib/ogg/vorbis/VorbisParser.js +18 -22
- package/lib/ogg/vorbis/VorbisTagMapper.js +3 -7
- package/lib/riff/RiffChunk.js +3 -7
- package/lib/riff/RiffInfoTagMap.js +4 -8
- package/lib/type.js +1 -5
- package/lib/wav/BwfChunk.js +8 -11
- package/lib/wav/WaveChunk.js +4 -9
- package/lib/wav/WaveParser.js +17 -21
- package/lib/wavpack/WavPackParser.js +17 -21
- package/lib/wavpack/WavPackToken.js +4 -8
- package/package.json +34 -44
- package/lib/ParserFactory.d.ts +0 -48
- package/lib/aiff/AiffParser.d.ts +0 -14
- package/lib/aiff/AiffToken.d.ts +0 -22
- package/lib/apev2/APEv2Parser.d.ts +0 -30
- package/lib/apev2/APEv2TagMapper.d.ts +0 -4
- package/lib/apev2/APEv2Token.d.ts +0 -100
- package/lib/asf/AsfObject.d.ts +0 -319
- package/lib/asf/AsfParser.d.ts +0 -17
- package/lib/asf/AsfTagMapper.d.ts +0 -7
- package/lib/asf/AsfUtil.d.ts +0 -13
- package/lib/asf/GUID.d.ts +0 -84
- package/lib/common/BasicParser.d.ts +0 -17
- package/lib/common/CaseInsensitiveTagMap.d.ts +0 -10
- package/lib/common/CombinedTagMapper.d.ts +0 -19
- package/lib/common/FourCC.d.ts +0 -6
- package/lib/common/GenericTagMapper.d.ts +0 -51
- package/lib/common/GenericTagTypes.d.ts +0 -33
- package/lib/common/MetadataCollector.d.ts +0 -76
- package/lib/common/RandomFileReader.d.ts +0 -22
- package/lib/common/RandomUint8ArrayReader.d.ts +0 -18
- package/lib/common/Util.d.ts +0 -57
- package/lib/core.d.ts +0 -48
- package/lib/dsdiff/DsdiffParser.d.ts +0 -14
- package/lib/dsdiff/DsdiffToken.d.ts +0 -9
- package/lib/dsf/DsfChunk.d.ts +0 -86
- package/lib/dsf/DsfParser.d.ts +0 -9
- package/lib/flac/FlacParser.d.ts +0 -28
- package/lib/id3v1/ID3v1Parser.d.ts +0 -13
- package/lib/id3v1/ID3v1TagMap.d.ts +0 -4
- package/lib/id3v2/AbstractID3Parser.d.ts +0 -17
- package/lib/id3v2/FrameParser.d.ts +0 -31
- package/lib/id3v2/ID3v22TagMapper.d.ts +0 -9
- package/lib/id3v2/ID3v24TagMapper.d.ts +0 -14
- package/lib/id3v2/ID3v2Parser.d.ts +0 -28
- package/lib/id3v2/ID3v2Token.d.ts +0 -73
- package/lib/iff/index.d.ts +0 -33
- package/lib/index.d.ts +0 -45
- package/lib/lyrics3/Lyrics3.d.ts +0 -3
- package/lib/matroska/MatroskaDtd.d.ts +0 -8
- package/lib/matroska/MatroskaParser.d.ts +0 -37
- package/lib/matroska/MatroskaTagMapper.d.ts +0 -4
- package/lib/matroska/types.d.ts +0 -175
- package/lib/mp4/Atom.d.ts +0 -16
- package/lib/mp4/AtomToken.d.ts +0 -395
- package/lib/mp4/MP4Parser.d.ts +0 -30
- package/lib/mp4/MP4TagMapper.d.ts +0 -5
- package/lib/mpeg/ExtendedLameHeader.d.ts +0 -27
- package/lib/mpeg/MpegParser.d.ts +0 -49
- package/lib/mpeg/ReplayGainDataFormat.d.ts +0 -55
- package/lib/mpeg/XingTag.d.ts +0 -45
- package/lib/musepack/index.d.ts +0 -5
- package/lib/musepack/sv7/BitReader.d.ts +0 -13
- package/lib/musepack/sv7/MpcSv7Parser.d.ts +0 -8
- package/lib/musepack/sv7/StreamVersion7.d.ts +0 -28
- package/lib/musepack/sv8/MpcSv8Parser.d.ts +0 -6
- package/lib/musepack/sv8/StreamVersion8.d.ts +0 -40
- package/lib/ogg/Ogg.d.ts +0 -72
- package/lib/ogg/OggParser.d.ts +0 -23
- package/lib/ogg/opus/Opus.d.ts +0 -48
- package/lib/ogg/opus/OpusParser.d.ts +0 -25
- package/lib/ogg/speex/Speex.d.ts +0 -36
- package/lib/ogg/speex/SpeexParser.d.ts +0 -22
- package/lib/ogg/theora/Theora.d.ts +0 -20
- package/lib/ogg/theora/TheoraParser.d.ts +0 -28
- package/lib/ogg/vorbis/Vorbis.d.ts +0 -69
- package/lib/ogg/vorbis/VorbisDecoder.d.ts +0 -12
- package/lib/ogg/vorbis/VorbisParser.d.ts +0 -36
- package/lib/ogg/vorbis/VorbisTagMapper.d.ts +0 -7
- package/lib/riff/RiffChunk.d.ts +0 -16
- package/lib/riff/RiffInfoTagMap.d.ts +0 -10
- package/lib/type.d.ts +0 -592
- package/lib/wav/BwfChunk.d.ts +0 -17
- package/lib/wav/WaveChunk.d.ts +0 -64
- package/lib/wav/WaveParser.d.ts +0 -24
- package/lib/wavpack/WavPackParser.d.ts +0 -14
- package/lib/wavpack/WavPackToken.d.ts +0 -64
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IRandomReader } from '../type';
|
|
3
|
-
/**
|
|
4
|
-
* Provides abstract file access via the IRandomRead interface
|
|
5
|
-
*/
|
|
6
|
-
export declare class RandomFileReader implements IRandomReader {
|
|
7
|
-
private readonly fileHandle;
|
|
8
|
-
filePath: string;
|
|
9
|
-
fileSize: number;
|
|
10
|
-
private constructor();
|
|
11
|
-
/**
|
|
12
|
-
* Read from a given position of an abstracted file or buffer.
|
|
13
|
-
* @param buffer {Buffer} is the buffer that the data will be written to.
|
|
14
|
-
* @param offset {number} is the offset in the buffer to start writing at.
|
|
15
|
-
* @param length {number}is an integer specifying the number of bytes to read.
|
|
16
|
-
* @param position {number} is an argument specifying where to begin reading from in the file.
|
|
17
|
-
* @return {Promise<number>} bytes read
|
|
18
|
-
*/
|
|
19
|
-
randomRead(buffer: Buffer, offset: number, length: number, position: number): Promise<number>;
|
|
20
|
-
close(): Promise<void>;
|
|
21
|
-
static init(filePath: string, fileSize: number): Promise<RandomFileReader>;
|
|
22
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { IRandomReader } from '../type';
|
|
2
|
-
/**
|
|
3
|
-
* Provides abstract Uint8Array access via the IRandomRead interface
|
|
4
|
-
*/
|
|
5
|
-
export declare class RandomUint8ArrayReader implements IRandomReader {
|
|
6
|
-
private readonly uint8Array;
|
|
7
|
-
readonly fileSize: number;
|
|
8
|
-
constructor(uint8Array: Uint8Array);
|
|
9
|
-
/**
|
|
10
|
-
* Read from a given position of an abstracted file or buffer.
|
|
11
|
-
* @param uint8Array - Uint8Array that the data will be written to.
|
|
12
|
-
* @param offset - Offset in the buffer to start writing at.
|
|
13
|
-
* @param length - Integer specifying the number of bytes to read.
|
|
14
|
-
* @param position - Specifies where to begin reading from in the file.
|
|
15
|
-
* @return Promise providing bytes read
|
|
16
|
-
*/
|
|
17
|
-
randomRead(uint8Array: Uint8Array, offset: number, length: number, position: number): Promise<number>;
|
|
18
|
-
}
|
package/lib/common/Util.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { IRatio } from '../type';
|
|
2
|
-
export declare type StringEncoding = 'ascii' | 'utf8' | 'utf16le' | 'ucs2' | 'base64url' | 'latin1' | 'hex';
|
|
3
|
-
export interface ITextEncoding {
|
|
4
|
-
encoding: StringEncoding;
|
|
5
|
-
bom?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare function getBit(buf: Uint8Array, off: number, bit: number): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Found delimiting zero in uint8Array
|
|
10
|
-
* @param uint8Array Uint8Array to find the zero delimiter in
|
|
11
|
-
* @param start Offset in uint8Array
|
|
12
|
-
* @param end Last position to parse in uint8Array
|
|
13
|
-
* @param encoding The string encoding used
|
|
14
|
-
* @return Absolute position on uint8Array where zero found
|
|
15
|
-
*/
|
|
16
|
-
export declare function findZero(uint8Array: Uint8Array, start: number, end: number, encoding?: StringEncoding): number;
|
|
17
|
-
export declare function trimRightNull(x: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* Decode string
|
|
20
|
-
*/
|
|
21
|
-
export declare function decodeString(uint8Array: Uint8Array, encoding: StringEncoding): string;
|
|
22
|
-
export declare function stripNulls(str: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* Read bit-aligned number start from buffer
|
|
25
|
-
* Total offset in bits = byteOffset * 8 + bitOffset
|
|
26
|
-
* @param source Byte buffer
|
|
27
|
-
* @param byteOffset Starting offset in bytes
|
|
28
|
-
* @param bitOffset Starting offset in bits: 0 = lsb
|
|
29
|
-
* @param len Length of number in bits
|
|
30
|
-
* @return Decoded bit aligned number
|
|
31
|
-
*/
|
|
32
|
-
export declare function getBitAllignedNumber(source: Uint8Array, byteOffset: number, bitOffset: number, len: number): number;
|
|
33
|
-
/**
|
|
34
|
-
* Read bit-aligned number start from buffer
|
|
35
|
-
* Total offset in bits = byteOffset * 8 + bitOffset
|
|
36
|
-
* @param source Byte Uint8Array
|
|
37
|
-
* @param byteOffset Starting offset in bytes
|
|
38
|
-
* @param bitOffset Starting offset in bits: 0 = most significant bit, 7 is the least significant bit
|
|
39
|
-
* @return True if bit is set
|
|
40
|
-
*/
|
|
41
|
-
export declare function isBitSet(source: Uint8Array, byteOffset: number, bitOffset: number): boolean;
|
|
42
|
-
export declare function a2hex(str: string): string;
|
|
43
|
-
/**
|
|
44
|
-
* Convert power ratio to DB
|
|
45
|
-
* ratio: [0..1]
|
|
46
|
-
*/
|
|
47
|
-
export declare function ratioToDb(ratio: number): number;
|
|
48
|
-
/**
|
|
49
|
-
* Convert dB to ratio
|
|
50
|
-
* db Decibels
|
|
51
|
-
*/
|
|
52
|
-
export declare function dbToRatio(dB: number): number;
|
|
53
|
-
/**
|
|
54
|
-
* Convert replay gain to ratio and Decibel
|
|
55
|
-
* @param value string holding a ratio like '0.034' or '-7.54 dB'
|
|
56
|
-
*/
|
|
57
|
-
export declare function toRatio(value: string): IRatio;
|
package/lib/core.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Readable } from 'stream';
|
|
3
|
-
import * as strtok3 from 'strtok3/lib/core';
|
|
4
|
-
import { IAudioMetadata, INativeTagDict, IOptions, IPicture, IPrivateOptions, IRandomReader, ITag } from './type';
|
|
5
|
-
export { IFileInfo } from 'strtok3/lib/core';
|
|
6
|
-
/**
|
|
7
|
-
* Parse audio from Node Stream.Readable
|
|
8
|
-
* @param stream - Stream to read the audio track from
|
|
9
|
-
* @param options - Parsing options
|
|
10
|
-
* @param fileInfo - File information object or MIME-type string
|
|
11
|
-
* @returns Metadata
|
|
12
|
-
*/
|
|
13
|
-
export declare function parseStream(stream: Readable, fileInfo?: strtok3.IFileInfo | string, options?: IOptions): Promise<IAudioMetadata>;
|
|
14
|
-
/**
|
|
15
|
-
* Parse audio from Node Buffer
|
|
16
|
-
* @param uint8Array - Uint8Array holding audio data
|
|
17
|
-
* @param fileInfo - File information object or MIME-type string
|
|
18
|
-
* @param options - Parsing options
|
|
19
|
-
* @returns Metadata
|
|
20
|
-
* Ref: https://github.com/Borewit/strtok3/blob/e6938c81ff685074d5eb3064a11c0b03ca934c1d/src/index.ts#L15
|
|
21
|
-
*/
|
|
22
|
-
export declare function parseBuffer(uint8Array: Uint8Array, fileInfo?: strtok3.IFileInfo | string, options?: IOptions): Promise<IAudioMetadata>;
|
|
23
|
-
/**
|
|
24
|
-
* Parse audio from ITokenizer source
|
|
25
|
-
* @param tokenizer - Audio source implementing the tokenizer interface
|
|
26
|
-
* @param options - Parsing options
|
|
27
|
-
* @returns Metadata
|
|
28
|
-
*/
|
|
29
|
-
export declare function parseFromTokenizer(tokenizer: strtok3.ITokenizer, options?: IOptions): Promise<IAudioMetadata>;
|
|
30
|
-
/**
|
|
31
|
-
* Create a dictionary ordered by their tag id (key)
|
|
32
|
-
* @param nativeTags list of tags
|
|
33
|
-
* @returns tags indexed by id
|
|
34
|
-
*/
|
|
35
|
-
export declare function orderTags(nativeTags: ITag[]): INativeTagDict;
|
|
36
|
-
/**
|
|
37
|
-
* Convert rating to 1-5 star rating
|
|
38
|
-
* @param rating: Normalized rating [0..1] (common.rating[n].rating)
|
|
39
|
-
* @returns Number of stars: 1, 2, 3, 4 or 5 stars
|
|
40
|
-
*/
|
|
41
|
-
export declare function ratingToStars(rating: number): number;
|
|
42
|
-
/**
|
|
43
|
-
* Select most likely cover image.
|
|
44
|
-
* @param pictures Usually metadata.common.picture
|
|
45
|
-
* @return Cover image, if any, otherwise null
|
|
46
|
-
*/
|
|
47
|
-
export declare function selectCover(pictures?: IPicture[]): IPicture | null;
|
|
48
|
-
export declare function scanAppendingHeaders(randomReader: IRandomReader, options?: IPrivateOptions): Promise<void>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { BasicParser } from '../common/BasicParser';
|
|
2
|
-
/**
|
|
3
|
-
* DSDIFF - Direct Stream Digital Interchange File Format (Phillips)
|
|
4
|
-
*
|
|
5
|
-
* Ref:
|
|
6
|
-
* - http://www.sonicstudio.com/pdf/dsd/DSDIFF_1.5_Spec.pdf
|
|
7
|
-
*/
|
|
8
|
-
export declare class DsdiffParser extends BasicParser {
|
|
9
|
-
parse(): Promise<void>;
|
|
10
|
-
private readFmt8Chunks;
|
|
11
|
-
private readData;
|
|
12
|
-
private handleSoundPropertyChunks;
|
|
13
|
-
private handleChannelChunks;
|
|
14
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IGetToken } from 'strtok3/lib/core';
|
|
2
|
-
import { IChunkHeader64 } from '../iff';
|
|
3
|
-
export { IChunkHeader64 } from '../iff';
|
|
4
|
-
/**
|
|
5
|
-
* DSDIFF chunk header
|
|
6
|
-
* The data-size encoding is deviating from EA-IFF 85
|
|
7
|
-
* Ref: http://www.sonicstudio.com/pdf/dsd/DSDIFF_1.5_Spec.pdf
|
|
8
|
-
*/
|
|
9
|
-
export declare const ChunkHeader64: IGetToken<IChunkHeader64>;
|
package/lib/dsf/DsfChunk.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
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/DsfParser.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
postId3v2Parse(): Promise<void>;
|
|
8
|
-
private parseChunks;
|
|
9
|
-
}
|
package/lib/flac/FlacParser.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
postId3v2Parse(): 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,13 +0,0 @@
|
|
|
1
|
-
import { BasicParser } from '../common/BasicParser';
|
|
2
|
-
import { IRandomReader } from '../type';
|
|
3
|
-
/**
|
|
4
|
-
* ID3v1 Genre mappings
|
|
5
|
-
* Ref: https://de.wikipedia.org/wiki/Liste_der_ID3v1-Genres
|
|
6
|
-
*/
|
|
7
|
-
export declare const Genres: string[];
|
|
8
|
-
export declare class ID3v1Parser extends BasicParser {
|
|
9
|
-
private static getGenre;
|
|
10
|
-
parse(): Promise<void>;
|
|
11
|
-
private addTag;
|
|
12
|
-
}
|
|
13
|
-
export declare function hasID3v1Header(reader: IRandomReader): Promise<boolean>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ITokenizer } from 'strtok3/lib/core';
|
|
2
|
-
import { BasicParser } from '../common/BasicParser';
|
|
3
|
-
/**
|
|
4
|
-
* Abstract parser which tries take ID3v2 and ID3v1 headers.
|
|
5
|
-
*/
|
|
6
|
-
export declare abstract class AbstractID3Parser extends BasicParser {
|
|
7
|
-
static startsWithID3v2Header(tokenizer: ITokenizer): Promise<boolean>;
|
|
8
|
-
private id3parser;
|
|
9
|
-
parse(): Promise<void>;
|
|
10
|
-
/**
|
|
11
|
-
* Called after ID3v2 headers are parsed
|
|
12
|
-
*/
|
|
13
|
-
abstract postId3v2Parse(): Promise<void>;
|
|
14
|
-
protected finalize(): void;
|
|
15
|
-
private parseID3v2;
|
|
16
|
-
private tryReadId3v2Headers;
|
|
17
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ID3v2MajorVersion } from './ID3v2Token';
|
|
2
|
-
import { IWarningCollector } from '../common/MetadataCollector';
|
|
3
|
-
export declare function parseGenre(origVal: string): string[];
|
|
4
|
-
export declare class FrameParser {
|
|
5
|
-
private major;
|
|
6
|
-
private warningCollector;
|
|
7
|
-
/**
|
|
8
|
-
* Create id3v2 frame parser
|
|
9
|
-
* @param major - Major version, e.g. (4) for id3v2.4
|
|
10
|
-
* @param warningCollector - Used to collect decode issue
|
|
11
|
-
*/
|
|
12
|
-
constructor(major: ID3v2MajorVersion, warningCollector: IWarningCollector);
|
|
13
|
-
readData(uint8Array: Uint8Array, type: string, includeCovers: boolean): any;
|
|
14
|
-
protected static fixPictureMimeType(pictureType: string): string;
|
|
15
|
-
/**
|
|
16
|
-
* Converts TMCL (Musician credits list) or TIPL (Involved people list)
|
|
17
|
-
* @param entries
|
|
18
|
-
*/
|
|
19
|
-
private static functionList;
|
|
20
|
-
/**
|
|
21
|
-
* id3v2.4 defines that multiple T* values are separated by 0x00
|
|
22
|
-
* id3v2.3 defines that TCOM, TEXT, TOLY, TOPE & TPE1 values are separated by /
|
|
23
|
-
* @param tag - Tag name
|
|
24
|
-
* @param text - Concatenated tag value
|
|
25
|
-
* @returns Split tag value
|
|
26
|
-
*/
|
|
27
|
-
private splitValue;
|
|
28
|
-
private static trimArray;
|
|
29
|
-
private static readIdentifierAndData;
|
|
30
|
-
private static getNullTerminatorLength;
|
|
31
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { INativeTagMap } from '../common/GenericTagTypes';
|
|
2
|
-
import { CaseInsensitiveTagMap } from '../common/CaseInsensitiveTagMap';
|
|
3
|
-
/**
|
|
4
|
-
* ID3v2.2 tag mappings
|
|
5
|
-
*/
|
|
6
|
-
export declare const id3v22TagMap: INativeTagMap;
|
|
7
|
-
export declare class ID3v22TagMapper extends CaseInsensitiveTagMap {
|
|
8
|
-
constructor();
|
|
9
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { INativeMetadataCollector } from '../common/MetadataCollector';
|
|
2
|
-
import { CaseInsensitiveTagMap } from '../common/CaseInsensitiveTagMap';
|
|
3
|
-
import { IRating, ITag } from '../type';
|
|
4
|
-
export declare class ID3v24TagMapper extends CaseInsensitiveTagMap {
|
|
5
|
-
static toRating(popm: any): IRating;
|
|
6
|
-
constructor();
|
|
7
|
-
/**
|
|
8
|
-
* Handle post mapping exceptions / correction
|
|
9
|
-
* @param tag to post map
|
|
10
|
-
* @param warnings Wil be used to register (collect) warnings
|
|
11
|
-
* @return Common value e.g. "Buena Vista Social Club"
|
|
12
|
-
*/
|
|
13
|
-
protected postMap(tag: ITag, warnings: INativeMetadataCollector): void;
|
|
14
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ITokenizer } from 'strtok3/lib/core';
|
|
2
|
-
import { IOptions } from '../type';
|
|
3
|
-
import { INativeMetadataCollector } from '../common/MetadataCollector';
|
|
4
|
-
export declare class ID3v2Parser {
|
|
5
|
-
static removeUnsyncBytes(buffer: Uint8Array): Uint8Array;
|
|
6
|
-
private static getFrameHeaderLength;
|
|
7
|
-
private static readFrameFlags;
|
|
8
|
-
private static readFrameData;
|
|
9
|
-
/**
|
|
10
|
-
* Create a combined tag key, of tag & description
|
|
11
|
-
* @param tag e.g.: COM
|
|
12
|
-
* @param description e.g. iTunPGAP
|
|
13
|
-
* @returns string e.g. COM:iTunPGAP
|
|
14
|
-
*/
|
|
15
|
-
private static makeDescriptionTagName;
|
|
16
|
-
private tokenizer;
|
|
17
|
-
private id3Header;
|
|
18
|
-
private metadata;
|
|
19
|
-
private headerType;
|
|
20
|
-
private options;
|
|
21
|
-
parse(metadata: INativeMetadataCollector, tokenizer: ITokenizer, options: IOptions): Promise<void>;
|
|
22
|
-
parseExtendedHeader(): Promise<void>;
|
|
23
|
-
parseExtendedHeaderData(dataRemaining: number, extendedHeaderSize: number): Promise<void>;
|
|
24
|
-
parseId3Data(dataLen: number): Promise<void>;
|
|
25
|
-
private addTag;
|
|
26
|
-
private parseMetadata;
|
|
27
|
-
private readFrameHeader;
|
|
28
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { IGetToken } from 'strtok3/lib/core';
|
|
2
|
-
import * as util from '../common/Util';
|
|
3
|
-
/**
|
|
4
|
-
* The picture type according to the ID3v2 APIC frame
|
|
5
|
-
* Ref: http://id3.org/id3v2.3.0#Attached_picture
|
|
6
|
-
*/
|
|
7
|
-
export declare enum AttachedPictureType {
|
|
8
|
-
'Other' = 0,
|
|
9
|
-
"32x32 pixels 'file icon' (PNG only)" = 1,
|
|
10
|
-
'Other file icon' = 2,
|
|
11
|
-
'Cover (front)' = 3,
|
|
12
|
-
'Cover (back)' = 4,
|
|
13
|
-
'Leaflet page' = 5,
|
|
14
|
-
'Media (e.g. label side of CD)' = 6,
|
|
15
|
-
'Lead artist/lead performer/soloist' = 7,
|
|
16
|
-
'Artist/performer' = 8,
|
|
17
|
-
'Conductor' = 9,
|
|
18
|
-
'Band/Orchestra' = 10,
|
|
19
|
-
'Composer' = 11,
|
|
20
|
-
'Lyricist/text writer' = 12,
|
|
21
|
-
'Recording Location' = 13,
|
|
22
|
-
'During recording' = 14,
|
|
23
|
-
'During performance' = 15,
|
|
24
|
-
'Movie/video screen capture' = 16,
|
|
25
|
-
'A bright coloured fish' = 17,
|
|
26
|
-
'Illustration' = 18,
|
|
27
|
-
'Band/artist logotype' = 19,
|
|
28
|
-
'Publisher/Studio logotype' = 20
|
|
29
|
-
}
|
|
30
|
-
export declare type ID3v2MajorVersion = 2 | 3 | 4;
|
|
31
|
-
export interface IExtendedHeader {
|
|
32
|
-
size: number;
|
|
33
|
-
extendedFlags: number;
|
|
34
|
-
sizeOfPadding: number;
|
|
35
|
-
crcDataPresent: boolean;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* 28 bits (representing up to 256MB) integer, the msb is 0 to avoid 'false syncsignals'.
|
|
39
|
-
* 4 * %0xxxxxxx
|
|
40
|
-
*/
|
|
41
|
-
export declare const UINT32SYNCSAFE: {
|
|
42
|
-
get: (buf: Uint8Array, off: number) => number;
|
|
43
|
-
len: number;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* ID3v2 tag header
|
|
47
|
-
*/
|
|
48
|
-
export interface IID3v2header {
|
|
49
|
-
fileIdentifier: string;
|
|
50
|
-
version: {
|
|
51
|
-
major: ID3v2MajorVersion;
|
|
52
|
-
revision: number;
|
|
53
|
-
};
|
|
54
|
-
flags: {
|
|
55
|
-
unsynchronisation: boolean;
|
|
56
|
-
isExtendedHeader: boolean;
|
|
57
|
-
expIndicator: boolean;
|
|
58
|
-
footer: boolean;
|
|
59
|
-
};
|
|
60
|
-
size: number;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* ID3v2 header
|
|
64
|
-
* Ref: http://id3.org/id3v2.3.0#ID3v2_header
|
|
65
|
-
* ToDo
|
|
66
|
-
*/
|
|
67
|
-
export declare const ID3v2Header: IGetToken<IID3v2header>;
|
|
68
|
-
export declare const ExtendedHeader: IGetToken<IExtendedHeader>;
|
|
69
|
-
export interface ITextEncoding {
|
|
70
|
-
encoding: util.StringEncoding;
|
|
71
|
-
bom?: boolean;
|
|
72
|
-
}
|
|
73
|
-
export declare const TextEncodingToken: IGetToken<ITextEncoding>;
|
package/lib/iff/index.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { IGetToken } from 'strtok3/lib/core';
|
|
2
|
-
/**
|
|
3
|
-
* "EA IFF 85" Standard for Interchange Format Files
|
|
4
|
-
* Ref: http://www.martinreddy.net/gfx/2d/IFF.txt
|
|
5
|
-
*/
|
|
6
|
-
export interface IChunkHeader {
|
|
7
|
-
/**
|
|
8
|
-
* A chunk ID (ie, 4 ASCII bytes)
|
|
9
|
-
*/
|
|
10
|
-
chunkID: string;
|
|
11
|
-
/**
|
|
12
|
-
* Number of data bytes following this data header
|
|
13
|
-
*/
|
|
14
|
-
chunkSize: number;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* "EA IFF 85" Standard for Interchange Format Files
|
|
18
|
-
* Ref: http://www.martinreddy.net/gfx/2d/IFF.txt
|
|
19
|
-
*/
|
|
20
|
-
export interface IChunkHeader64 {
|
|
21
|
-
/**
|
|
22
|
-
* A chunk ID (ie, 4 ASCII bytes)
|
|
23
|
-
*/
|
|
24
|
-
chunkID: string;
|
|
25
|
-
/**
|
|
26
|
-
* Number of data bytes following this data header
|
|
27
|
-
*/
|
|
28
|
-
chunkSize: bigint;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Common AIFF chunk header
|
|
32
|
-
*/
|
|
33
|
-
export declare const Header: IGetToken<IChunkHeader>;
|
package/lib/index.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import * as Stream from 'stream';
|
|
3
|
-
import * as strtok3 from 'strtok3';
|
|
4
|
-
import * as Core from './core';
|
|
5
|
-
import { IAudioMetadata, IOptions } from './type';
|
|
6
|
-
export { IAudioMetadata, IOptions, ITag, INativeTagDict, ICommonTagsResult, IFormat, IPicture, IRatio, IChapter } from './type';
|
|
7
|
-
export { parseFromTokenizer, parseBuffer, IFileInfo, selectCover } from './core';
|
|
8
|
-
/**
|
|
9
|
-
* Parse audio from Node Stream.Readable
|
|
10
|
-
* @param stream - Stream to read the audio track from
|
|
11
|
-
* @param fileInfo - File information object or MIME-type, e.g.: 'audio/mpeg'
|
|
12
|
-
* @param options - Parsing options
|
|
13
|
-
* @returns Metadata
|
|
14
|
-
*/
|
|
15
|
-
export declare function parseStream(stream: Stream.Readable, fileInfo?: strtok3.IFileInfo | string, options?: IOptions): Promise<IAudioMetadata>;
|
|
16
|
-
/**
|
|
17
|
-
* Parse audio from Node file
|
|
18
|
-
* @param filePath - Media file to read meta-data from
|
|
19
|
-
* @param options - Parsing options
|
|
20
|
-
* @returns Metadata
|
|
21
|
-
*/
|
|
22
|
-
export declare function parseFile(filePath: string, options?: IOptions): Promise<IAudioMetadata>;
|
|
23
|
-
/**
|
|
24
|
-
* Create a dictionary ordered by their tag id (key)
|
|
25
|
-
* @param nativeTags - List of tags
|
|
26
|
-
* @returns Tags indexed by id
|
|
27
|
-
*/
|
|
28
|
-
export declare const orderTags: typeof Core.orderTags;
|
|
29
|
-
/**
|
|
30
|
-
* Convert rating to 1-5 star rating
|
|
31
|
-
* @param rating - Normalized rating [0..1] (common.rating[n].rating)
|
|
32
|
-
* @returns Number of stars: 1, 2, 3, 4 or 5 stars
|
|
33
|
-
*/
|
|
34
|
-
export declare const ratingToStars: typeof Core.ratingToStars;
|
|
35
|
-
/**
|
|
36
|
-
* Define default module exports
|
|
37
|
-
*/
|
|
38
|
-
declare const _default: {
|
|
39
|
-
parseStream: typeof parseStream;
|
|
40
|
-
parseFile: typeof parseFile;
|
|
41
|
-
parseFromTokenizer: typeof Core.parseFromTokenizer;
|
|
42
|
-
parseBuffer: typeof Core.parseBuffer;
|
|
43
|
-
selectCover: typeof Core.selectCover;
|
|
44
|
-
};
|
|
45
|
-
export default _default;
|
package/lib/lyrics3/Lyrics3.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { IContainerType } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Elements of document type description
|
|
4
|
-
* Derived from https://github.com/tungol/EBML/blob/master/doctypes/matroska.dtd
|
|
5
|
-
* Extended with:
|
|
6
|
-
* - https://www.matroska.org/technical/specs/index.html
|
|
7
|
-
*/
|
|
8
|
-
export declare const elements: IContainerType;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ITokenizer } from 'strtok3/lib/core';
|
|
2
|
-
import { INativeMetadataCollector } from '../common/MetadataCollector';
|
|
3
|
-
import { IOptions } from '../type';
|
|
4
|
-
import { ITokenParser } from '../ParserFactory';
|
|
5
|
-
import { BasicParser } from '../common/BasicParser';
|
|
6
|
-
/**
|
|
7
|
-
* Extensible Binary Meta Language (EBML) parser
|
|
8
|
-
* https://en.wikipedia.org/wiki/Extensible_Binary_Meta_Language
|
|
9
|
-
* http://matroska.sourceforge.net/technical/specs/rfc/index.html
|
|
10
|
-
*
|
|
11
|
-
* WEBM VP8 AUDIO FILE
|
|
12
|
-
*/
|
|
13
|
-
export declare class MatroskaParser extends BasicParser {
|
|
14
|
-
private padding;
|
|
15
|
-
private parserMap;
|
|
16
|
-
private ebmlMaxIDLength;
|
|
17
|
-
private ebmlMaxSizeLength;
|
|
18
|
-
constructor();
|
|
19
|
-
/**
|
|
20
|
-
* Initialize parser with output (metadata), input (tokenizer) & parsing options (options).
|
|
21
|
-
* @param {INativeMetadataCollector} metadata Output
|
|
22
|
-
* @param {ITokenizer} tokenizer Input
|
|
23
|
-
* @param {IOptions} options Parsing options
|
|
24
|
-
*/
|
|
25
|
-
init(metadata: INativeMetadataCollector, tokenizer: ITokenizer, options: IOptions): ITokenParser;
|
|
26
|
-
parse(): Promise<void>;
|
|
27
|
-
private parseContainer;
|
|
28
|
-
private readVintData;
|
|
29
|
-
private readElement;
|
|
30
|
-
private isMaxValue;
|
|
31
|
-
private readFloat;
|
|
32
|
-
private readFlag;
|
|
33
|
-
private readUint;
|
|
34
|
-
private readString;
|
|
35
|
-
private readBuffer;
|
|
36
|
-
private addTag;
|
|
37
|
-
}
|