music-metadata 7.11.4 → 7.11.8
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 +2 -1
- package/lib/ParserFactory.d.ts +0 -1
- package/lib/ParserFactory.js +8 -8
- package/lib/aiff/AiffParser.d.ts +2 -3
- package/lib/aiff/AiffParser.js +2 -3
- package/lib/aiff/AiffToken.d.ts +1 -1
- package/lib/apev2/APEv2Parser.js +2 -3
- package/lib/apev2/APEv2TagMapper.js +1 -0
- package/lib/apev2/APEv2Token.d.ts +5 -5
- package/lib/apev2/APEv2Token.js +1 -0
- package/lib/asf/AsfObject.d.ts +1 -1
- package/lib/asf/AsfParser.d.ts +5 -5
- package/lib/asf/AsfParser.js +7 -7
- package/lib/asf/AsfTagMapper.js +1 -0
- package/lib/asf/AsfUtil.d.ts +1 -1
- package/lib/asf/AsfUtil.js +1 -1
- package/lib/asf/GUID.d.ts +14 -16
- package/lib/asf/GUID.js +13 -15
- package/lib/common/CaseInsensitiveTagMap.js +1 -0
- package/lib/common/CombinedTagMapper.d.ts +3 -3
- package/lib/common/CombinedTagMapper.js +2 -1
- package/lib/common/FourCC.d.ts +1 -1
- package/lib/common/FourCC.js +2 -1
- package/lib/common/GenericTagMapper.d.ts +2 -2
- package/lib/common/GenericTagMapper.js +3 -2
- package/lib/common/GenericTagTypes.js +1 -0
- package/lib/common/MetadataCollector.d.ts +4 -4
- package/lib/common/MetadataCollector.js +5 -3
- package/lib/common/Util.d.ts +5 -4
- package/lib/common/Util.js +13 -24
- package/lib/dsdiff/DsdiffParser.d.ts +1 -1
- package/lib/dsdiff/DsdiffParser.js +3 -3
- package/lib/dsdiff/DsdiffToken.d.ts +1 -1
- package/lib/dsf/DsfParser.d.ts +1 -1
- package/lib/dsf/DsfParser.js +3 -3
- package/lib/flac/FlacParser.d.ts +2 -2
- package/lib/flac/FlacParser.js +13 -13
- package/lib/id3v1/ID3v1Parser.js +39 -39
- package/lib/id3v1/ID3v1TagMap.d.ts +1 -1
- package/lib/id3v1/ID3v1TagMap.js +1 -0
- package/lib/id3v2/AbstractID3Parser.d.ts +1 -1
- package/lib/id3v2/AbstractID3Parser.js +6 -6
- package/lib/id3v2/FrameParser.js +7 -1
- package/lib/id3v2/ID3v22TagMapper.js +3 -1
- package/lib/id3v2/ID3v24TagMapper.d.ts +3 -3
- package/lib/id3v2/ID3v24TagMapper.js +4 -3
- package/lib/id3v2/ID3v2Parser.d.ts +3 -3
- package/lib/id3v2/ID3v2Parser.js +5 -15
- package/lib/id3v2/ID3v2Token.d.ts +1 -1
- package/lib/iff/index.d.ts +3 -3
- package/lib/iff/index.js +1 -1
- package/lib/index.d.ts +11 -0
- package/lib/index.js +10 -0
- package/lib/matroska/MatroskaDtd.d.ts +1 -1
- package/lib/matroska/MatroskaDtd.js +1 -1
- package/lib/matroska/MatroskaParser.d.ts +1 -1
- package/lib/matroska/MatroskaParser.js +9 -9
- package/lib/matroska/MatroskaTagMapper.js +1 -0
- package/lib/matroska/types.d.ts +2 -2
- package/lib/matroska/types.js +1 -0
- package/lib/mp4/AtomToken.d.ts +6 -6
- package/lib/mp4/AtomToken.js +3 -3
- package/lib/mp4/MP4Parser.js +5 -5
- package/lib/mp4/MP4TagMapper.js +1 -0
- package/lib/mpeg/MpegParser.d.ts +1 -1
- package/lib/mpeg/MpegParser.js +4 -9
- package/lib/mpeg/XingTag.d.ts +1 -1
- package/lib/musepack/index.d.ts +1 -1
- package/lib/musepack/index.js +2 -2
- package/lib/musepack/sv7/MpcSv7Parser.js +2 -2
- package/lib/musepack/sv8/MpcSv8Parser.js +1 -1
- package/lib/musepack/sv8/StreamVersion8.js +1 -1
- package/lib/ogg/OggParser.d.ts +2 -2
- package/lib/ogg/OggParser.js +2 -2
- package/lib/ogg/opus/OpusParser.js +1 -1
- package/lib/ogg/speex/SpeexParser.d.ts +2 -2
- package/lib/ogg/speex/SpeexParser.js +3 -3
- package/lib/ogg/theora/TheoraParser.d.ts +1 -1
- package/lib/ogg/theora/TheoraParser.js +1 -1
- package/lib/ogg/vorbis/Vorbis.d.ts +2 -12
- package/lib/ogg/vorbis/VorbisTagMapper.js +1 -0
- package/lib/riff/RiffChunk.d.ts +1 -1
- package/lib/riff/RiffInfoTagMap.js +1 -0
- package/lib/type.d.ts +3 -10
- package/lib/type.js +3 -10
- package/lib/wav/WaveChunk.d.ts +1 -1
- package/lib/wav/WaveParser.d.ts +3 -3
- package/lib/wav/WaveParser.js +3 -3
- package/lib/wavpack/WavPackParser.js +1 -7
- package/lib/wavpack/WavPackToken.d.ts +2 -2
- package/lib/wavpack/WavPackToken.js +1 -1
- package/package.json +27 -19
package/lib/matroska/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface IHeader {
|
|
|
4
4
|
len: number;
|
|
5
5
|
}
|
|
6
6
|
export declare enum DataType {
|
|
7
|
-
string = 0,
|
|
7
|
+
'string' = 0,
|
|
8
8
|
uint = 1,
|
|
9
9
|
uid = 2,
|
|
10
10
|
bool = 3,
|
|
@@ -99,7 +99,7 @@ export interface ICueReference {
|
|
|
99
99
|
}
|
|
100
100
|
export interface ISimpleTag {
|
|
101
101
|
name?: string;
|
|
102
|
-
string?: string;
|
|
102
|
+
'string'?: string;
|
|
103
103
|
binary?: Buffer;
|
|
104
104
|
language?: string;
|
|
105
105
|
default?: boolean;
|
package/lib/matroska/types.js
CHANGED
package/lib/mp4/AtomToken.d.ts
CHANGED
|
@@ -58,9 +58,9 @@ export interface IAtomMvhd extends IAtomMxhd {
|
|
|
58
58
|
* Reserved: Ten bytes reserved for use by Apple. Set to 0.
|
|
59
59
|
*/
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
61
|
+
* Matrix structure: The matrix structure associated with this movie.
|
|
62
|
+
* A matrix shows how to map points from one coordinate space into another.
|
|
63
|
+
* See Matrices for a discussion of how display matrices are used in QuickTime.
|
|
64
64
|
*/
|
|
65
65
|
/**
|
|
66
66
|
* Preview time: The time value in the movie at which the preview begins.
|
|
@@ -143,8 +143,8 @@ export interface IAtomMdhd extends IAtomMxhd {
|
|
|
143
143
|
/**
|
|
144
144
|
* Token: Media Header Atom
|
|
145
145
|
* Ref:
|
|
146
|
-
*
|
|
147
|
-
*
|
|
146
|
+
* - https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-SW34
|
|
147
|
+
* - https://wiki.multimedia.cx/index.php/QuickTime_container#mdhd
|
|
148
148
|
*/
|
|
149
149
|
export declare class MdhdAtom extends FixedLengthAtom implements IGetToken<IAtomMdhd> {
|
|
150
150
|
len: number;
|
|
@@ -305,7 +305,7 @@ export declare const SoundSampleDescriptionVersion: IGetToken<ISoundSampleDescri
|
|
|
305
305
|
export interface ISoundSampleDescriptionV0 {
|
|
306
306
|
numAudioChannels: number;
|
|
307
307
|
/**
|
|
308
|
-
*
|
|
308
|
+
* Number of bits in each uncompressed sound sample
|
|
309
309
|
*/
|
|
310
310
|
sampleSize: number;
|
|
311
311
|
/**
|
package/lib/mp4/AtomToken.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChapterText = exports.StcoAtom = exports.StszAtom = exports.StscAtom = exports.SampleToChunkToken = exports.SttsAtom = exports.TimeToSampleToken = exports.SoundSampleDescriptionV0 = exports.SoundSampleDescriptionVersion = exports.StsdAtom = exports.TrackHeaderAtom = exports.NameAtom = exports.DataAtom = exports.MvhdAtom = exports.MdhdAtom = exports.FixedLengthAtom = exports.mhdr = exports.tkhd = exports.ftyp = exports.ExtendedSize = exports.Header = void 0;
|
|
4
4
|
const Token = require("token-types");
|
|
5
|
-
const FourCC_1 = require("../common/FourCC");
|
|
6
5
|
const initDebug = require("debug");
|
|
6
|
+
const FourCC_1 = require("../common/FourCC");
|
|
7
7
|
const debug = initDebug('music-metadata:parser:MP4:atom');
|
|
8
8
|
exports.Header = {
|
|
9
9
|
len: 8,
|
|
@@ -89,8 +89,8 @@ const SecondsSinceMacEpoch = {
|
|
|
89
89
|
/**
|
|
90
90
|
* Token: Media Header Atom
|
|
91
91
|
* Ref:
|
|
92
|
-
*
|
|
93
|
-
*
|
|
92
|
+
* - https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-SW34
|
|
93
|
+
* - https://wiki.multimedia.cx/index.php/QuickTime_container#mdhd
|
|
94
94
|
*/
|
|
95
95
|
class MdhdAtom extends FixedLengthAtom {
|
|
96
96
|
constructor(len) {
|
package/lib/mp4/MP4Parser.js
CHANGED
|
@@ -4,10 +4,10 @@ exports.MP4Parser = void 0;
|
|
|
4
4
|
const initDebug = require("debug");
|
|
5
5
|
const Token = require("token-types");
|
|
6
6
|
const BasicParser_1 = require("../common/BasicParser");
|
|
7
|
-
const Atom_1 = require("./Atom");
|
|
8
|
-
const AtomToken = require("./AtomToken");
|
|
9
7
|
const ID3v1Parser_1 = require("../id3v1/ID3v1Parser");
|
|
10
8
|
const type_1 = require("../type");
|
|
9
|
+
const Atom_1 = require("./Atom");
|
|
10
|
+
const AtomToken = require("./AtomToken");
|
|
11
11
|
const debug = initDebug('music-metadata:parser:MP4');
|
|
12
12
|
const tagFormat = 'iTunes';
|
|
13
13
|
const encoderDict = {
|
|
@@ -99,9 +99,9 @@ class MP4Parser extends BasicParser_1.BasicParser {
|
|
|
99
99
|
* Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-56313
|
|
100
100
|
*/
|
|
101
101
|
mvhd: async (len) => {
|
|
102
|
-
const
|
|
103
|
-
this.metadata.setFormat('creationTime',
|
|
104
|
-
this.metadata.setFormat('modificationTime',
|
|
102
|
+
const mvhd = await this.tokenizer.readToken(new AtomToken.MvhdAtom(len));
|
|
103
|
+
this.metadata.setFormat('creationTime', mvhd.creationTime);
|
|
104
|
+
this.metadata.setFormat('modificationTime', mvhd.modificationTime);
|
|
105
105
|
},
|
|
106
106
|
/**
|
|
107
107
|
* Parse media header (mdhd) atom
|
package/lib/mp4/MP4TagMapper.js
CHANGED
package/lib/mpeg/MpegParser.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare class MpegParser extends AbstractID3Parser {
|
|
|
20
20
|
/**
|
|
21
21
|
* Called after ID3 headers have been parsed
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
postId3v2Parse(): Promise<void>;
|
|
24
24
|
/**
|
|
25
25
|
* Called after file has been fully parsed, this allows, if present, to exclude the ID3v1.1 header length
|
|
26
26
|
*/
|
package/lib/mpeg/MpegParser.js
CHANGED
|
@@ -224,7 +224,7 @@ class MpegParser extends AbstractID3Parser_1.AbstractID3Parser {
|
|
|
224
224
|
/**
|
|
225
225
|
* Called after ID3 headers have been parsed
|
|
226
226
|
*/
|
|
227
|
-
async
|
|
227
|
+
async postId3v2Parse() {
|
|
228
228
|
this.metadata.setFormat('lossless', false);
|
|
229
229
|
try {
|
|
230
230
|
let quit = false;
|
|
@@ -334,12 +334,7 @@ class MpegParser extends AbstractID3Parser_1.AbstractID3Parser {
|
|
|
334
334
|
this.metadata.setFormat('lossless', false);
|
|
335
335
|
this.metadata.setFormat('sampleRate', header.samplingRate);
|
|
336
336
|
this.frameCount++;
|
|
337
|
-
|
|
338
|
-
return this.parseAdts(header); // ADTS, usually AAC
|
|
339
|
-
}
|
|
340
|
-
else {
|
|
341
|
-
return this.parseAudioFrameHeader(header); // MP3
|
|
342
|
-
}
|
|
337
|
+
return header.version >= 2 && header.layer === 0 ? this.parseAdts(header) : this.parseAudioFrameHeader(header);
|
|
343
338
|
}
|
|
344
339
|
/**
|
|
345
340
|
* @return {Promise<boolean>} true if parser should quit
|
|
@@ -485,9 +480,9 @@ class MpegParser extends AbstractID3Parser_1.AbstractID3Parser {
|
|
|
485
480
|
* @returns {Promise<string>}
|
|
486
481
|
*/
|
|
487
482
|
async readXingInfoHeader() {
|
|
488
|
-
const
|
|
483
|
+
const offset = this.tokenizer.position;
|
|
489
484
|
const infoTag = await (0, XingTag_1.readXingHeader)(this.tokenizer);
|
|
490
|
-
this.offset += this.tokenizer.position -
|
|
485
|
+
this.offset += this.tokenizer.position - offset;
|
|
491
486
|
if (infoTag.lame) {
|
|
492
487
|
this.metadata.setFormat('tool', 'LAME ' + common.stripNulls(infoTag.lame.version));
|
|
493
488
|
if (infoTag.lame.extended) {
|
package/lib/mpeg/XingTag.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import * as Token from
|
|
2
|
+
import * as Token from 'token-types';
|
|
3
3
|
import { IGetToken, ITokenizer } from 'strtok3/lib/core';
|
|
4
4
|
import { IExtendedLameHeader } from './ExtendedLameHeader';
|
|
5
5
|
export interface IXingHeaderFlags {
|
package/lib/musepack/index.d.ts
CHANGED
package/lib/musepack/index.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const initDebug = require("debug");
|
|
4
4
|
const Token = require("token-types");
|
|
5
|
+
const AbstractID3Parser_1 = require("../id3v2/AbstractID3Parser");
|
|
5
6
|
const MpcSv8Parser_1 = require("./sv8/MpcSv8Parser");
|
|
6
7
|
const MpcSv7Parser_1 = require("./sv7/MpcSv7Parser");
|
|
7
|
-
const AbstractID3Parser_1 = require("../id3v2/AbstractID3Parser");
|
|
8
8
|
const debug = initDebug('music-metadata:parser:musepack');
|
|
9
9
|
class MusepackParser extends AbstractID3Parser_1.AbstractID3Parser {
|
|
10
|
-
async
|
|
10
|
+
async postId3v2Parse() {
|
|
11
11
|
const signature = await this.tokenizer.peekToken(new Token.StringType(3, 'binary'));
|
|
12
12
|
let mpcParser;
|
|
13
13
|
switch (signature) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MpcSv7Parser = void 0;
|
|
4
4
|
const initDebug = require("debug");
|
|
5
5
|
const BasicParser_1 = require("../../common/BasicParser");
|
|
6
|
-
const SV7 = require("./StreamVersion7");
|
|
7
6
|
const APEv2Parser_1 = require("../../apev2/APEv2Parser");
|
|
8
7
|
const BitReader_1 = require("./BitReader");
|
|
8
|
+
const SV7 = require("./StreamVersion7");
|
|
9
9
|
const debug = initDebug('music-metadata:parser:musepack');
|
|
10
10
|
class MpcSv7Parser extends BasicParser_1.BasicParser {
|
|
11
11
|
constructor() {
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MpcSv8Parser = void 0;
|
|
4
4
|
const initDebug = require("debug");
|
|
5
5
|
const BasicParser_1 = require("../../common/BasicParser");
|
|
6
|
-
const SV8 = require("./StreamVersion8");
|
|
7
6
|
const APEv2Parser_1 = require("../../apev2/APEv2Parser");
|
|
8
7
|
const FourCC_1 = require("../../common/FourCC");
|
|
8
|
+
const SV8 = require("./StreamVersion8");
|
|
9
9
|
const debug = initDebug('music-metadata:parser:musepack');
|
|
10
10
|
class MpcSv8Parser extends BasicParser_1.BasicParser {
|
|
11
11
|
constructor() {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StreamReader = void 0;
|
|
4
4
|
const Token = require("token-types");
|
|
5
|
-
const util = require("../../common/Util");
|
|
6
5
|
const initDebug = require("debug");
|
|
6
|
+
const util = require("../../common/Util");
|
|
7
7
|
const debug = initDebug('music-metadata:parser:musepack:sv8');
|
|
8
8
|
const PacketKey = new Token.StringType(2, 'binary');
|
|
9
9
|
/**
|
package/lib/ogg/OggParser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as Ogg from './Ogg';
|
|
2
|
-
import { BasicParser } from '../common/BasicParser';
|
|
3
1
|
import { IGetToken } from 'strtok3/lib/core';
|
|
2
|
+
import { BasicParser } from '../common/BasicParser';
|
|
3
|
+
import * as Ogg from './Ogg';
|
|
4
4
|
export declare class SegmentTable implements IGetToken<Ogg.ISegmentTable> {
|
|
5
5
|
private static sum;
|
|
6
6
|
len: number;
|
package/lib/ogg/OggParser.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OggParser = exports.SegmentTable = void 0;
|
|
4
4
|
const Token = require("token-types");
|
|
5
|
+
const core_1 = require("strtok3/lib/core");
|
|
5
6
|
const initDebug = require("debug");
|
|
6
7
|
const util = require("../common/Util");
|
|
7
8
|
const FourCC_1 = require("../common/FourCC");
|
|
9
|
+
const BasicParser_1 = require("../common/BasicParser");
|
|
8
10
|
const VorbisParser_1 = require("./vorbis/VorbisParser");
|
|
9
11
|
const OpusParser_1 = require("./opus/OpusParser");
|
|
10
12
|
const SpeexParser_1 = require("./speex/SpeexParser");
|
|
11
|
-
const BasicParser_1 = require("../common/BasicParser");
|
|
12
13
|
const TheoraParser_1 = require("./theora/TheoraParser");
|
|
13
|
-
const core_1 = require("strtok3/lib/core");
|
|
14
14
|
const debug = initDebug('music-metadata:parser:ogg');
|
|
15
15
|
class SegmentTable {
|
|
16
16
|
constructor(header) {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OpusParser = void 0;
|
|
4
4
|
const Token = require("token-types");
|
|
5
|
-
const Opus = require("./Opus");
|
|
6
5
|
const VorbisParser_1 = require("../vorbis/VorbisParser");
|
|
6
|
+
const Opus = require("./Opus");
|
|
7
7
|
/**
|
|
8
8
|
* Opus parser
|
|
9
9
|
* Internet Engineering Task Force (IETF) - RFC 6716
|
|
@@ -7,8 +7,8 @@ import { INativeMetadataCollector } from '../../common/MetadataCollector';
|
|
|
7
7
|
/**
|
|
8
8
|
* Speex, RFC 5574
|
|
9
9
|
* Ref:
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* - https://www.speex.org/docs/manual/speex-manual/
|
|
11
|
+
* - https://tools.ietf.org/html/rfc5574
|
|
12
12
|
*/
|
|
13
13
|
export declare class SpeexParser extends VorbisParser {
|
|
14
14
|
private tokenizer;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SpeexParser = void 0;
|
|
4
4
|
const initDebug = require("debug");
|
|
5
|
-
const Speex = require("./Speex");
|
|
6
5
|
const VorbisParser_1 = require("../vorbis/VorbisParser");
|
|
6
|
+
const Speex = require("./Speex");
|
|
7
7
|
const debug = initDebug('music-metadata:parser:ogg:speex');
|
|
8
8
|
/**
|
|
9
9
|
* Speex, RFC 5574
|
|
10
10
|
* Ref:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* - https://www.speex.org/docs/manual/speex-manual/
|
|
12
|
+
* - https://tools.ietf.org/html/rfc5574
|
|
13
13
|
*/
|
|
14
14
|
class SpeexParser extends VorbisParser_1.VorbisParser {
|
|
15
15
|
constructor(metadata, options, tokenizer) {
|
|
@@ -5,7 +5,7 @@ import { INativeMetadataCollector } from '../../common/MetadataCollector';
|
|
|
5
5
|
import * as Ogg from '../Ogg';
|
|
6
6
|
/**
|
|
7
7
|
* Ref:
|
|
8
|
-
*
|
|
8
|
+
* - https://theora.org/doc/Theora.pdf
|
|
9
9
|
*/
|
|
10
10
|
export declare class TheoraParser implements Ogg.IPageConsumer {
|
|
11
11
|
private metadata;
|
|
@@ -6,7 +6,7 @@ const Theora_1 = require("./Theora");
|
|
|
6
6
|
const debug = initDebug('music-metadata:parser:ogg:theora');
|
|
7
7
|
/**
|
|
8
8
|
* Ref:
|
|
9
|
-
*
|
|
9
|
+
* - https://theora.org/doc/Theora.pdf
|
|
10
10
|
*/
|
|
11
11
|
class TheoraParser {
|
|
12
12
|
constructor(metadata, options, tokenizer) {
|
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { IPicture } from '../../type';
|
|
3
2
|
import { IGetToken } from 'strtok3/lib/core';
|
|
4
|
-
|
|
5
|
-
type: string;
|
|
6
|
-
description: string;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
colour_depth: number;
|
|
10
|
-
indexed_color: number;
|
|
11
|
-
}
|
|
3
|
+
import { IPicture } from '../../type';
|
|
12
4
|
/**
|
|
13
5
|
* Interface to parsed result of METADATA_BLOCK_PICTURE
|
|
14
6
|
* Ref: https://wiki.xiph.org/VorbisComment#METADATA_BLOCK_PICTURE
|
|
15
7
|
* Ref: https://xiph.org/flac/format.html#metadata_block_picture
|
|
16
8
|
*/
|
|
17
|
-
export interface IVorbisPicture {
|
|
9
|
+
export interface IVorbisPicture extends IPicture {
|
|
18
10
|
type: string;
|
|
19
|
-
format: string;
|
|
20
11
|
description: string;
|
|
21
12
|
width: number;
|
|
22
13
|
height: number;
|
|
23
14
|
colour_depth: number;
|
|
24
15
|
indexed_color: number;
|
|
25
|
-
data: Buffer;
|
|
26
16
|
}
|
|
27
17
|
/**
|
|
28
18
|
* Parse the METADATA_BLOCK_PICTURE
|
package/lib/riff/RiffChunk.d.ts
CHANGED
package/lib/type.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { GenericTagId, TagType } from './common/GenericTagTypes';
|
|
3
|
-
import { IFooter } from
|
|
3
|
+
import { IFooter } from './apev2/APEv2Token';
|
|
4
|
+
import { TrackType } from './matroska/types';
|
|
5
|
+
export { TrackType } from './matroska/types';
|
|
4
6
|
/**
|
|
5
7
|
* Attached picture, typically used for cover art
|
|
6
8
|
*/
|
|
@@ -374,15 +376,6 @@ export interface IVideoTrack {
|
|
|
374
376
|
colourSpace?: Buffer;
|
|
375
377
|
gammaValue?: number;
|
|
376
378
|
}
|
|
377
|
-
export declare enum TrackType {
|
|
378
|
-
video = 1,
|
|
379
|
-
audio = 2,
|
|
380
|
-
complex = 3,
|
|
381
|
-
logo = 4,
|
|
382
|
-
subtitle = 17,
|
|
383
|
-
button = 18,
|
|
384
|
-
control = 32
|
|
385
|
-
}
|
|
386
379
|
export interface ITrackInfo {
|
|
387
380
|
type?: TrackType;
|
|
388
381
|
codecName?: string;
|
package/lib/type.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TrackType = void 0;
|
|
4
|
-
var
|
|
5
|
-
(function (
|
|
6
|
-
|
|
7
|
-
TrackType[TrackType["audio"] = 2] = "audio";
|
|
8
|
-
TrackType[TrackType["complex"] = 3] = "complex";
|
|
9
|
-
TrackType[TrackType["logo"] = 4] = "logo";
|
|
10
|
-
TrackType[TrackType["subtitle"] = 17] = "subtitle";
|
|
11
|
-
TrackType[TrackType["button"] = 18] = "button";
|
|
12
|
-
TrackType[TrackType["control"] = 32] = "control";
|
|
13
|
-
})(TrackType = exports.TrackType || (exports.TrackType = {}));
|
|
4
|
+
var types_1 = require("./matroska/types");
|
|
5
|
+
Object.defineProperty(exports, "TrackType", { enumerable: true, get: function () { return types_1.TrackType; } });
|
|
6
|
+
//# sourceMappingURL=type.js.map
|
package/lib/wav/WaveChunk.d.ts
CHANGED
package/lib/wav/WaveParser.d.ts
CHANGED
|
@@ -6,10 +6,10 @@ import { BasicParser } from '../common/BasicParser';
|
|
|
6
6
|
* WAVE PCM soundfile format
|
|
7
7
|
*
|
|
8
8
|
* Ref:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* - http://www.johnloomis.org/cpe102/asgn/asgn1/riff.html
|
|
10
|
+
* - http://soundfile.sapp.org/doc/WaveFormat
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* ToDo: Split WAVE part from RIFF parser
|
|
13
13
|
*/
|
|
14
14
|
export declare class WaveParser extends BasicParser {
|
|
15
15
|
private fact;
|
package/lib/wav/WaveParser.js
CHANGED
|
@@ -17,10 +17,10 @@ const debug = initDebug('music-metadata:parser:RIFF');
|
|
|
17
17
|
* WAVE PCM soundfile format
|
|
18
18
|
*
|
|
19
19
|
* Ref:
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* - http://www.johnloomis.org/cpe102/asgn/asgn1/riff.html
|
|
21
|
+
* - http://soundfile.sapp.org/doc/WaveFormat
|
|
22
22
|
*
|
|
23
|
-
*
|
|
23
|
+
* ToDo: Split WAVE part from RIFF parser
|
|
24
24
|
*/
|
|
25
25
|
class WaveParser extends BasicParser_1.BasicParser {
|
|
26
26
|
async parse() {
|
|
@@ -43,13 +43,7 @@ class WavPackParser extends BasicParser_1.BasicParser {
|
|
|
43
43
|
this.metadata.setFormat('codec', header.flags.isDSD ? 'DSD' : 'PCM');
|
|
44
44
|
}
|
|
45
45
|
const ignoreBytes = header.blockSize - (WavPackToken_1.WavPack.BlockHeaderToken.len - 8);
|
|
46
|
-
|
|
47
|
-
// Meta-data block
|
|
48
|
-
await this.parseMetadataSubBlock(header, ignoreBytes);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
await this.tokenizer.ignore(ignoreBytes);
|
|
52
|
-
}
|
|
46
|
+
await (header.blockIndex === 0 ? this.parseMetadataSubBlock(header, ignoreBytes) : this.tokenizer.ignore(ignoreBytes));
|
|
53
47
|
if (header.blockSamples > 0) {
|
|
54
48
|
this.audioDataSize += header.blockSize; // Count audio data for bit-rate calculation
|
|
55
49
|
}
|
|
@@ -5,7 +5,7 @@ import { IGetToken } from 'strtok3/lib/core';
|
|
|
5
5
|
* 32-byte little-endian header at the front of every WavPack block
|
|
6
6
|
*
|
|
7
7
|
* Ref:
|
|
8
|
-
*
|
|
8
|
+
* - http://www.wavpack.com/WavPack5FileFormat.pdf (page 2/6: 2.0 "Block Header")
|
|
9
9
|
*/
|
|
10
10
|
export interface IBlockHeader {
|
|
11
11
|
BlockID: string;
|
|
@@ -56,7 +56,7 @@ export declare class WavPack {
|
|
|
56
56
|
static BlockHeaderToken: IGetToken<IBlockHeader>;
|
|
57
57
|
/**
|
|
58
58
|
* 3.0 Metadata Sub-Blocks
|
|
59
|
-
*
|
|
59
|
+
* Ref: http://www.wavpack.com/WavPack5FileFormat.pdf (page 4/6: 3.0 "Metadata Sub-Block")
|
|
60
60
|
*/
|
|
61
61
|
static MetadataIdToken: IGetToken<IMetadataId>;
|
|
62
62
|
private static isBitSet;
|
|
@@ -61,7 +61,7 @@ WavPack.BlockHeaderToken = {
|
|
|
61
61
|
};
|
|
62
62
|
/**
|
|
63
63
|
* 3.0 Metadata Sub-Blocks
|
|
64
|
-
*
|
|
64
|
+
* Ref: http://www.wavpack.com/WavPack5FileFormat.pdf (page 4/6: 3.0 "Metadata Sub-Block")
|
|
65
65
|
*/
|
|
66
66
|
WavPack.MetadataIdToken = {
|
|
67
67
|
len: 1,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "music-metadata",
|
|
3
3
|
"description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
|
|
4
|
-
"version": "7.11.
|
|
4
|
+
"version": "7.11.8",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Borewit",
|
|
7
7
|
"url": "https://github.com/Borewit"
|
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
"lib/**/*.d.ts"
|
|
67
67
|
],
|
|
68
68
|
"scripts": {
|
|
69
|
-
"clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts src/**/*.d.ts test/**/*.js test/**/*.js.map",
|
|
69
|
+
"clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts src/**/*.d.ts test/**/*.js test/**/*.js.map test/**/*.js test/**/*.js.map doc-gen/**/*.js doc-gen/**/*.js.map",
|
|
70
70
|
"compile-src": "tsc -p lib",
|
|
71
71
|
"compile-test": "tsc -p test",
|
|
72
72
|
"compile-doc": "tsc -p doc-gen",
|
|
73
73
|
"compile": "npm run compile-src && npm run compile-test && npm run compile-doc",
|
|
74
|
-
"
|
|
74
|
+
"eslint": "eslint lib/**/*.ts --ignore-pattern lib/**/*.d.ts example/typescript/**/*.ts test/**/*.ts doc-gen/**/*.ts",
|
|
75
75
|
"lint-md": "remark -u preset-lint-recommended .",
|
|
76
|
-
"lint": "npm run lint-md && npm run
|
|
76
|
+
"lint": "npm run lint-md && npm run eslint",
|
|
77
77
|
"test": "mocha --require ts-node/register --require source-map-support/register --full-trace test/test-*.ts",
|
|
78
78
|
"build": "npm run clean && npm run compile && npm run doc-gen",
|
|
79
79
|
"start": "npm-run-all compile lint cover-test",
|
|
@@ -83,34 +83,42 @@
|
|
|
83
83
|
"doc-gen": "node doc-gen/gen.js"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
+
"@tokenizer/token": "^0.3.0",
|
|
86
87
|
"content-type": "^1.0.4",
|
|
87
|
-
"debug": "^4.3.
|
|
88
|
+
"debug": "^4.3.3",
|
|
88
89
|
"file-type": "16.5.3",
|
|
89
90
|
"media-typer": "^1.1.0",
|
|
90
91
|
"strtok3": "^6.2.4",
|
|
91
92
|
"token-types": "^4.1.1"
|
|
92
93
|
},
|
|
93
94
|
"devDependencies": {
|
|
94
|
-
"@
|
|
95
|
-
"@types/chai": "^4.2.21",
|
|
95
|
+
"@types/chai": "^4.3.0",
|
|
96
96
|
"@types/debug": "^4.1.7",
|
|
97
97
|
"@types/file-type": "^10.9.1",
|
|
98
|
-
"@types/mocha": "^9.
|
|
99
|
-
"@types/node": "^
|
|
100
|
-
"
|
|
98
|
+
"@types/mocha": "^9.1.0",
|
|
99
|
+
"@types/node": "^17.0.12",
|
|
100
|
+
"@typescript-eslint/eslint-plugin": "^5.10.1",
|
|
101
|
+
"@typescript-eslint/parser": "^5.10.1",
|
|
102
|
+
"chai": "^4.3.6",
|
|
101
103
|
"coveralls": "^3.1.1",
|
|
102
104
|
"del-cli": "4.0.1",
|
|
103
|
-
"eslint": "
|
|
104
|
-
"
|
|
105
|
-
"
|
|
105
|
+
"eslint": "^8.8.0",
|
|
106
|
+
"eslint-config-prettier": "^8.3.0",
|
|
107
|
+
"eslint-import-resolver-typescript": "^2.5.0",
|
|
108
|
+
"eslint-plugin-import": "^2.25.4",
|
|
109
|
+
"eslint-plugin-jsdoc": "^37.7.0",
|
|
110
|
+
"eslint-plugin-node": "^11.1.0",
|
|
111
|
+
"eslint-plugin-unicorn": "^40.1.0",
|
|
112
|
+
"mime": "^3.0.0",
|
|
113
|
+
"mocha": "^9.2.0",
|
|
106
114
|
"npm-run-all": "^4.1.5",
|
|
107
115
|
"nyc": "^15.1.0",
|
|
108
|
-
"
|
|
109
|
-
"remark-
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"typescript": "^4.
|
|
116
|
+
"prettier": "^2.5.1",
|
|
117
|
+
"remark-cli": "^10.0.1",
|
|
118
|
+
"remark-preset-lint-recommended": "^6.1.2",
|
|
119
|
+
"source-map-support": "^0.5.21",
|
|
120
|
+
"ts-node": "^10.3.0",
|
|
121
|
+
"typescript": "^4.5.5"
|
|
114
122
|
},
|
|
115
123
|
"engines": {
|
|
116
124
|
"node": ">=10"
|