music-metadata 7.11.1 → 7.11.5

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.
Files changed (152) hide show
  1. package/README.md +432 -432
  2. package/lib/ParserFactory.d.ts +49 -49
  3. package/lib/ParserFactory.js +251 -251
  4. package/lib/aiff/AiffParser.d.ts +15 -15
  5. package/lib/aiff/AiffParser.js +85 -85
  6. package/lib/aiff/AiffToken.d.ts +22 -22
  7. package/lib/aiff/AiffToken.js +43 -43
  8. package/lib/apev2/APEv2Parser.d.ts +30 -30
  9. package/lib/apev2/APEv2Parser.js +162 -162
  10. package/lib/apev2/APEv2TagMapper.d.ts +4 -4
  11. package/lib/apev2/APEv2TagMapper.js +87 -86
  12. package/lib/apev2/APEv2Token.d.ts +100 -100
  13. package/lib/apev2/APEv2Token.js +127 -126
  14. package/lib/asf/AsfObject.d.ts +319 -319
  15. package/lib/asf/AsfObject.js +384 -384
  16. package/lib/asf/AsfParser.d.ts +17 -17
  17. package/lib/asf/AsfParser.js +135 -135
  18. package/lib/asf/AsfTagMapper.d.ts +7 -7
  19. package/lib/asf/AsfTagMapper.js +96 -95
  20. package/lib/asf/AsfUtil.d.ts +13 -13
  21. package/lib/asf/AsfUtil.js +40 -40
  22. package/lib/asf/GUID.d.ts +86 -86
  23. package/lib/asf/GUID.js +123 -123
  24. package/lib/common/BasicParser.d.ts +17 -17
  25. package/lib/common/BasicParser.js +18 -18
  26. package/lib/common/CaseInsensitiveTagMap.d.ts +10 -10
  27. package/lib/common/CaseInsensitiveTagMap.js +22 -21
  28. package/lib/common/CombinedTagMapper.d.ts +19 -19
  29. package/lib/common/CombinedTagMapper.js +52 -51
  30. package/lib/common/FourCC.d.ts +6 -6
  31. package/lib/common/FourCC.js +29 -28
  32. package/lib/common/GenericTagMapper.d.ts +51 -51
  33. package/lib/common/GenericTagMapper.js +56 -55
  34. package/lib/common/GenericTagTypes.d.ts +33 -33
  35. package/lib/common/GenericTagTypes.js +132 -131
  36. package/lib/common/MetadataCollector.d.ts +76 -76
  37. package/lib/common/MetadataCollector.js +276 -274
  38. package/lib/common/RandomFileReader.d.ts +20 -20
  39. package/lib/common/RandomFileReader.js +37 -37
  40. package/lib/common/RandomUint8ArrayReader.d.ts +18 -18
  41. package/lib/common/RandomUint8ArrayReader.js +25 -25
  42. package/lib/common/Util.d.ts +57 -57
  43. package/lib/common/Util.js +170 -169
  44. package/lib/core.d.ts +48 -48
  45. package/lib/core.js +90 -90
  46. package/lib/dsdiff/DsdiffParser.d.ts +14 -14
  47. package/lib/dsdiff/DsdiffParser.js +143 -143
  48. package/lib/dsdiff/DsdiffToken.d.ts +9 -9
  49. package/lib/dsdiff/DsdiffToken.js +21 -21
  50. package/lib/dsf/DsfChunk.d.ts +86 -86
  51. package/lib/dsf/DsfChunk.js +54 -54
  52. package/lib/dsf/DsfParser.d.ts +9 -9
  53. package/lib/dsf/DsfParser.js +56 -56
  54. package/lib/flac/FlacParser.d.ts +28 -28
  55. package/lib/flac/FlacParser.js +175 -175
  56. package/lib/id3v1/ID3v1Parser.d.ts +13 -13
  57. package/lib/id3v1/ID3v1Parser.js +134 -134
  58. package/lib/id3v1/ID3v1TagMap.d.ts +4 -4
  59. package/lib/id3v1/ID3v1TagMap.js +23 -22
  60. package/lib/id3v2/AbstractID3Parser.d.ts +17 -17
  61. package/lib/id3v2/AbstractID3Parser.js +60 -60
  62. package/lib/id3v2/FrameParser.d.ts +32 -32
  63. package/lib/id3v2/FrameParser.js +323 -323
  64. package/lib/id3v2/ID3v22TagMapper.d.ts +9 -9
  65. package/lib/id3v2/ID3v22TagMapper.js +56 -54
  66. package/lib/id3v2/ID3v24TagMapper.d.ts +14 -14
  67. package/lib/id3v2/ID3v24TagMapper.js +194 -193
  68. package/lib/id3v2/ID3v2Parser.d.ts +29 -29
  69. package/lib/id3v2/ID3v2Parser.js +194 -194
  70. package/lib/id3v2/ID3v2Token.d.ts +73 -73
  71. package/lib/id3v2/ID3v2Token.js +106 -106
  72. package/lib/iff/index.d.ts +33 -33
  73. package/lib/iff/index.js +19 -19
  74. package/lib/index.d.ts +34 -34
  75. package/lib/index.js +64 -64
  76. package/lib/lyrics3/Lyrics3.d.ts +3 -3
  77. package/lib/lyrics3/Lyrics3.js +17 -17
  78. package/lib/matroska/MatroskaDtd.d.ts +8 -8
  79. package/lib/matroska/MatroskaDtd.js +279 -279
  80. package/lib/matroska/MatroskaParser.d.ts +37 -37
  81. package/lib/matroska/MatroskaParser.js +235 -234
  82. package/lib/matroska/MatroskaTagMapper.d.ts +4 -4
  83. package/lib/matroska/MatroskaTagMapper.js +36 -35
  84. package/lib/matroska/types.d.ts +175 -175
  85. package/lib/matroska/types.js +32 -32
  86. package/lib/mp4/Atom.d.ts +16 -16
  87. package/lib/mp4/Atom.js +70 -70
  88. package/lib/mp4/AtomToken.d.ts +395 -395
  89. package/lib/mp4/AtomToken.js +406 -406
  90. package/lib/mp4/MP4Parser.d.ts +30 -31
  91. package/lib/mp4/MP4Parser.js +511 -515
  92. package/lib/mp4/MP4TagMapper.d.ts +5 -5
  93. package/lib/mp4/MP4TagMapper.js +116 -115
  94. package/lib/mpeg/ExtendedLameHeader.d.ts +27 -27
  95. package/lib/mpeg/ExtendedLameHeader.js +31 -31
  96. package/lib/mpeg/MpegParser.d.ts +49 -49
  97. package/lib/mpeg/MpegParser.js +529 -529
  98. package/lib/mpeg/ReplayGainDataFormat.d.ts +55 -55
  99. package/lib/mpeg/ReplayGainDataFormat.js +69 -69
  100. package/lib/mpeg/XingTag.d.ts +45 -45
  101. package/lib/mpeg/XingTag.js +69 -69
  102. package/lib/musepack/index.d.ts +5 -5
  103. package/lib/musepack/index.js +32 -32
  104. package/lib/musepack/sv7/BitReader.d.ts +13 -13
  105. package/lib/musepack/sv7/BitReader.js +54 -54
  106. package/lib/musepack/sv7/MpcSv7Parser.d.ts +8 -8
  107. package/lib/musepack/sv7/MpcSv7Parser.js +46 -46
  108. package/lib/musepack/sv7/StreamVersion7.d.ts +28 -28
  109. package/lib/musepack/sv7/StreamVersion7.js +41 -41
  110. package/lib/musepack/sv8/MpcSv8Parser.d.ts +6 -6
  111. package/lib/musepack/sv8/MpcSv8Parser.js +55 -55
  112. package/lib/musepack/sv8/StreamVersion8.d.ts +40 -40
  113. package/lib/musepack/sv8/StreamVersion8.js +80 -80
  114. package/lib/ogg/Ogg.d.ts +72 -72
  115. package/lib/ogg/Ogg.js +2 -2
  116. package/lib/ogg/OggParser.d.ts +23 -23
  117. package/lib/ogg/OggParser.js +126 -126
  118. package/lib/ogg/opus/Opus.d.ts +48 -48
  119. package/lib/ogg/opus/Opus.js +28 -28
  120. package/lib/ogg/opus/OpusParser.d.ts +25 -25
  121. package/lib/ogg/opus/OpusParser.js +56 -56
  122. package/lib/ogg/speex/Speex.d.ts +36 -36
  123. package/lib/ogg/speex/Speex.js +31 -31
  124. package/lib/ogg/speex/SpeexParser.d.ts +22 -22
  125. package/lib/ogg/speex/SpeexParser.js +35 -35
  126. package/lib/ogg/theora/Theora.d.ts +20 -20
  127. package/lib/ogg/theora/Theora.js +23 -23
  128. package/lib/ogg/theora/TheoraParser.d.ts +28 -28
  129. package/lib/ogg/theora/TheoraParser.js +44 -44
  130. package/lib/ogg/vorbis/Vorbis.d.ts +79 -79
  131. package/lib/ogg/vorbis/Vorbis.js +78 -78
  132. package/lib/ogg/vorbis/VorbisDecoder.d.ts +12 -12
  133. package/lib/ogg/vorbis/VorbisDecoder.js +32 -32
  134. package/lib/ogg/vorbis/VorbisParser.d.ts +36 -36
  135. package/lib/ogg/vorbis/VorbisParser.js +128 -128
  136. package/lib/ogg/vorbis/VorbisTagMapper.d.ts +7 -7
  137. package/lib/ogg/vorbis/VorbisTagMapper.js +133 -132
  138. package/lib/riff/RiffChunk.d.ts +16 -16
  139. package/lib/riff/RiffChunk.js +32 -32
  140. package/lib/riff/RiffInfoTagMap.d.ts +10 -10
  141. package/lib/riff/RiffInfoTagMap.js +38 -37
  142. package/lib/type.d.ts +599 -599
  143. package/lib/type.js +14 -13
  144. package/lib/wav/WaveChunk.d.ts +64 -64
  145. package/lib/wav/WaveChunk.js +65 -65
  146. package/lib/wav/WaveParser.d.ts +24 -24
  147. package/lib/wav/WaveParser.js +144 -144
  148. package/lib/wavpack/WavPackParser.d.ts +14 -14
  149. package/lib/wavpack/WavPackParser.js +105 -105
  150. package/lib/wavpack/WavPackToken.d.ts +64 -64
  151. package/lib/wavpack/WavPackToken.js +76 -76
  152. package/package.json +142 -142
@@ -1,48 +1,48 @@
1
- import { IGetToken } from 'strtok3/lib/core';
2
- /**
3
- * Opus ID Header interface
4
- * Ref: https://wiki.xiph.org/OggOpus#ID_Header
5
- */
6
- export interface IIdHeader {
7
- /**
8
- * Magic signature: "OpusHead" (64 bits)
9
- */
10
- magicSignature: string;
11
- /**
12
- * Version number (8 bits unsigned): 0x01 for this spec
13
- */
14
- version: number;
15
- /**
16
- * Channel count 'c' (8 bits unsigned): MUST be > 0
17
- */
18
- channelCount: number;
19
- /**
20
- * Pre-skip (16 bits unsigned, little endian)
21
- */
22
- preSkip: number;
23
- /**
24
- * Input sample rate (32 bits unsigned, little endian): informational only
25
- */
26
- inputSampleRate: number;
27
- /**
28
- * Output gain (16 bits, little endian, signed Q7.8 in dB) to apply when decoding
29
- */
30
- outputGain: number;
31
- /**
32
- * Channel mapping family (8 bits unsigned)
33
- * - 0 = one stream: mono or L,R stereo
34
- * - 1 = channels in vorbis spec order: mono or L,R stereo or ... or FL,C,FR,RL,RR,LFE, ...
35
- * - 2..254 = reserved (treat as 255)
36
- * - 255 = no defined channel meaning
37
- */
38
- channelMapping: number;
39
- }
40
- /**
41
- * Opus ID Header parser
42
- * Ref: https://wiki.xiph.org/OggOpus#ID_Header
43
- */
44
- export declare class IdHeader implements IGetToken<IIdHeader> {
45
- len: number;
46
- constructor(len: number);
47
- get(buf: any, off: any): IIdHeader;
48
- }
1
+ import { IGetToken } from 'strtok3/lib/core';
2
+ /**
3
+ * Opus ID Header interface
4
+ * Ref: https://wiki.xiph.org/OggOpus#ID_Header
5
+ */
6
+ export interface IIdHeader {
7
+ /**
8
+ * Magic signature: "OpusHead" (64 bits)
9
+ */
10
+ magicSignature: string;
11
+ /**
12
+ * Version number (8 bits unsigned): 0x01 for this spec
13
+ */
14
+ version: number;
15
+ /**
16
+ * Channel count 'c' (8 bits unsigned): MUST be > 0
17
+ */
18
+ channelCount: number;
19
+ /**
20
+ * Pre-skip (16 bits unsigned, little endian)
21
+ */
22
+ preSkip: number;
23
+ /**
24
+ * Input sample rate (32 bits unsigned, little endian): informational only
25
+ */
26
+ inputSampleRate: number;
27
+ /**
28
+ * Output gain (16 bits, little endian, signed Q7.8 in dB) to apply when decoding
29
+ */
30
+ outputGain: number;
31
+ /**
32
+ * Channel mapping family (8 bits unsigned)
33
+ * - 0 = one stream: mono or L,R stereo
34
+ * - 1 = channels in vorbis spec order: mono or L,R stereo or ... or FL,C,FR,RL,RR,LFE, ...
35
+ * - 2..254 = reserved (treat as 255)
36
+ * - 255 = no defined channel meaning
37
+ */
38
+ channelMapping: number;
39
+ }
40
+ /**
41
+ * Opus ID Header parser
42
+ * Ref: https://wiki.xiph.org/OggOpus#ID_Header
43
+ */
44
+ export declare class IdHeader implements IGetToken<IIdHeader> {
45
+ len: number;
46
+ constructor(len: number);
47
+ get(buf: any, off: any): IIdHeader;
48
+ }
@@ -1,28 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IdHeader = void 0;
4
- const Token = require("token-types");
5
- /**
6
- * Opus ID Header parser
7
- * Ref: https://wiki.xiph.org/OggOpus#ID_Header
8
- */
9
- class IdHeader {
10
- constructor(len) {
11
- this.len = len;
12
- if (len < 19) {
13
- throw new Error("ID-header-page 0 should be at least 19 bytes long");
14
- }
15
- }
16
- get(buf, off) {
17
- return {
18
- magicSignature: new Token.StringType(8, 'ascii').get(buf, off + 0),
19
- version: buf.readUInt8(off + 8),
20
- channelCount: buf.readUInt8(off + 9),
21
- preSkip: buf.readInt16LE(off + 10),
22
- inputSampleRate: buf.readInt32LE(off + 12),
23
- outputGain: buf.readInt16LE(off + 16),
24
- channelMapping: buf.readUInt8(off + 18)
25
- };
26
- }
27
- }
28
- exports.IdHeader = IdHeader;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IdHeader = void 0;
4
+ const Token = require("token-types");
5
+ /**
6
+ * Opus ID Header parser
7
+ * Ref: https://wiki.xiph.org/OggOpus#ID_Header
8
+ */
9
+ class IdHeader {
10
+ constructor(len) {
11
+ this.len = len;
12
+ if (len < 19) {
13
+ throw new Error("ID-header-page 0 should be at least 19 bytes long");
14
+ }
15
+ }
16
+ get(buf, off) {
17
+ return {
18
+ magicSignature: new Token.StringType(8, 'ascii').get(buf, off + 0),
19
+ version: buf.readUInt8(off + 8),
20
+ channelCount: buf.readUInt8(off + 9),
21
+ preSkip: buf.readInt16LE(off + 10),
22
+ inputSampleRate: buf.readInt32LE(off + 12),
23
+ outputGain: buf.readInt16LE(off + 16),
24
+ channelMapping: buf.readUInt8(off + 18)
25
+ };
26
+ }
27
+ }
28
+ exports.IdHeader = IdHeader;
@@ -1,25 +1,25 @@
1
- /// <reference types="node" />
2
- import { ITokenizer } from 'strtok3/lib/core';
3
- import { IPageHeader } from '../Ogg';
4
- import { VorbisParser } from '../vorbis/VorbisParser';
5
- import { IOptions } from '../../type';
6
- import { INativeMetadataCollector } from '../../common/MetadataCollector';
7
- /**
8
- * Opus parser
9
- * Internet Engineering Task Force (IETF) - RFC 6716
10
- * Used by OggParser
11
- */
12
- export declare class OpusParser extends VorbisParser {
13
- private tokenizer;
14
- private idHeader;
15
- private lastPos;
16
- constructor(metadata: INativeMetadataCollector, options: IOptions, tokenizer: ITokenizer);
17
- /**
18
- * Parse first Opus Ogg page
19
- * @param {IPageHeader} header
20
- * @param {Buffer} pageData
21
- */
22
- protected parseFirstPage(header: IPageHeader, pageData: Buffer): void;
23
- protected parseFullPage(pageData: Buffer): void;
24
- calculateDuration(header: IPageHeader): void;
25
- }
1
+ /// <reference types="node" />
2
+ import { ITokenizer } from 'strtok3/lib/core';
3
+ import { IPageHeader } from '../Ogg';
4
+ import { VorbisParser } from '../vorbis/VorbisParser';
5
+ import { IOptions } from '../../type';
6
+ import { INativeMetadataCollector } from '../../common/MetadataCollector';
7
+ /**
8
+ * Opus parser
9
+ * Internet Engineering Task Force (IETF) - RFC 6716
10
+ * Used by OggParser
11
+ */
12
+ export declare class OpusParser extends VorbisParser {
13
+ private tokenizer;
14
+ private idHeader;
15
+ private lastPos;
16
+ constructor(metadata: INativeMetadataCollector, options: IOptions, tokenizer: ITokenizer);
17
+ /**
18
+ * Parse first Opus Ogg page
19
+ * @param {IPageHeader} header
20
+ * @param {Buffer} pageData
21
+ */
22
+ protected parseFirstPage(header: IPageHeader, pageData: Buffer): void;
23
+ protected parseFullPage(pageData: Buffer): void;
24
+ calculateDuration(header: IPageHeader): void;
25
+ }
@@ -1,56 +1,56 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OpusParser = void 0;
4
- const Token = require("token-types");
5
- const Opus = require("./Opus");
6
- const VorbisParser_1 = require("../vorbis/VorbisParser");
7
- /**
8
- * Opus parser
9
- * Internet Engineering Task Force (IETF) - RFC 6716
10
- * Used by OggParser
11
- */
12
- class OpusParser extends VorbisParser_1.VorbisParser {
13
- constructor(metadata, options, tokenizer) {
14
- super(metadata, options);
15
- this.tokenizer = tokenizer;
16
- this.lastPos = -1;
17
- }
18
- /**
19
- * Parse first Opus Ogg page
20
- * @param {IPageHeader} header
21
- * @param {Buffer} pageData
22
- */
23
- parseFirstPage(header, pageData) {
24
- this.metadata.setFormat('codec', 'Opus');
25
- // Parse Opus ID Header
26
- this.idHeader = new Opus.IdHeader(pageData.length).get(pageData, 0);
27
- if (this.idHeader.magicSignature !== "OpusHead")
28
- throw new Error("Illegal ogg/Opus magic-signature");
29
- this.metadata.setFormat('sampleRate', this.idHeader.inputSampleRate);
30
- this.metadata.setFormat('numberOfChannels', this.idHeader.channelCount);
31
- }
32
- parseFullPage(pageData) {
33
- const magicSignature = new Token.StringType(8, 'ascii').get(pageData, 0);
34
- switch (magicSignature) {
35
- case 'OpusTags':
36
- this.parseUserCommentList(pageData, 8);
37
- this.lastPos = this.tokenizer.position - pageData.length;
38
- break;
39
- default:
40
- break;
41
- }
42
- }
43
- calculateDuration(header) {
44
- if (this.metadata.format.sampleRate && header.absoluteGranulePosition >= 0) {
45
- // Calculate duration
46
- const pos_48bit = header.absoluteGranulePosition - this.idHeader.preSkip;
47
- this.metadata.setFormat('numberOfSamples', pos_48bit);
48
- this.metadata.setFormat('duration', pos_48bit / 48000);
49
- if (this.lastPos !== -1 && this.tokenizer.fileInfo.size && this.metadata.format.duration) {
50
- const dataSize = this.tokenizer.fileInfo.size - this.lastPos;
51
- this.metadata.setFormat('bitrate', 8 * dataSize / this.metadata.format.duration);
52
- }
53
- }
54
- }
55
- }
56
- exports.OpusParser = OpusParser;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpusParser = void 0;
4
+ const Token = require("token-types");
5
+ const VorbisParser_1 = require("../vorbis/VorbisParser");
6
+ const Opus = require("./Opus");
7
+ /**
8
+ * Opus parser
9
+ * Internet Engineering Task Force (IETF) - RFC 6716
10
+ * Used by OggParser
11
+ */
12
+ class OpusParser extends VorbisParser_1.VorbisParser {
13
+ constructor(metadata, options, tokenizer) {
14
+ super(metadata, options);
15
+ this.tokenizer = tokenizer;
16
+ this.lastPos = -1;
17
+ }
18
+ /**
19
+ * Parse first Opus Ogg page
20
+ * @param {IPageHeader} header
21
+ * @param {Buffer} pageData
22
+ */
23
+ parseFirstPage(header, pageData) {
24
+ this.metadata.setFormat('codec', 'Opus');
25
+ // Parse Opus ID Header
26
+ this.idHeader = new Opus.IdHeader(pageData.length).get(pageData, 0);
27
+ if (this.idHeader.magicSignature !== "OpusHead")
28
+ throw new Error("Illegal ogg/Opus magic-signature");
29
+ this.metadata.setFormat('sampleRate', this.idHeader.inputSampleRate);
30
+ this.metadata.setFormat('numberOfChannels', this.idHeader.channelCount);
31
+ }
32
+ parseFullPage(pageData) {
33
+ const magicSignature = new Token.StringType(8, 'ascii').get(pageData, 0);
34
+ switch (magicSignature) {
35
+ case 'OpusTags':
36
+ this.parseUserCommentList(pageData, 8);
37
+ this.lastPos = this.tokenizer.position - pageData.length;
38
+ break;
39
+ default:
40
+ break;
41
+ }
42
+ }
43
+ calculateDuration(header) {
44
+ if (this.metadata.format.sampleRate && header.absoluteGranulePosition >= 0) {
45
+ // Calculate duration
46
+ const pos_48bit = header.absoluteGranulePosition - this.idHeader.preSkip;
47
+ this.metadata.setFormat('numberOfSamples', pos_48bit);
48
+ this.metadata.setFormat('duration', pos_48bit / 48000);
49
+ if (this.lastPos !== -1 && this.tokenizer.fileInfo.size && this.metadata.format.duration) {
50
+ const dataSize = this.tokenizer.fileInfo.size - this.lastPos;
51
+ this.metadata.setFormat('bitrate', 8 * dataSize / this.metadata.format.duration);
52
+ }
53
+ }
54
+ }
55
+ }
56
+ exports.OpusParser = OpusParser;
@@ -1,36 +1,36 @@
1
- import { IGetToken } from 'strtok3/lib/core';
2
- /**
3
- * Speex Header Packet
4
- * Ref: https://www.speex.org/docs/manual/speex-manual/node8.html#SECTION00830000000000000000
5
- */
6
- export interface IHeader {
7
- /**
8
- * speex_string, char[] 8
9
- */
10
- speex: string;
11
- /**
12
- * speex_version, char[] 20
13
- */
14
- version: string;
15
- /**
16
- * Version id
17
- */
18
- version_id: number;
19
- header_size: number;
20
- rate: number;
21
- mode: number;
22
- mode_bitstream_version: number;
23
- nb_channels: number;
24
- bitrate: number;
25
- frame_size: number;
26
- vbr: number;
27
- frames_per_packet: number;
28
- extra_headers: number;
29
- reserved1: number;
30
- reserved2: number;
31
- }
32
- /**
33
- * Speex Header Packet
34
- * Ref: https://www.speex.org/docs/manual/speex-manual/node8.html#SECTION00830000000000000000
35
- */
36
- export declare const Header: IGetToken<IHeader>;
1
+ import { IGetToken } from 'strtok3/lib/core';
2
+ /**
3
+ * Speex Header Packet
4
+ * Ref: https://www.speex.org/docs/manual/speex-manual/node8.html#SECTION00830000000000000000
5
+ */
6
+ export interface IHeader {
7
+ /**
8
+ * speex_string, char[] 8
9
+ */
10
+ speex: string;
11
+ /**
12
+ * speex_version, char[] 20
13
+ */
14
+ version: string;
15
+ /**
16
+ * Version id
17
+ */
18
+ version_id: number;
19
+ header_size: number;
20
+ rate: number;
21
+ mode: number;
22
+ mode_bitstream_version: number;
23
+ nb_channels: number;
24
+ bitrate: number;
25
+ frame_size: number;
26
+ vbr: number;
27
+ frames_per_packet: number;
28
+ extra_headers: number;
29
+ reserved1: number;
30
+ reserved2: number;
31
+ }
32
+ /**
33
+ * Speex Header Packet
34
+ * Ref: https://www.speex.org/docs/manual/speex-manual/node8.html#SECTION00830000000000000000
35
+ */
36
+ export declare const Header: IGetToken<IHeader>;
@@ -1,31 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Header = void 0;
4
- const Token = require("token-types");
5
- const util = require("../../common/Util");
6
- /**
7
- * Speex Header Packet
8
- * Ref: https://www.speex.org/docs/manual/speex-manual/node8.html#SECTION00830000000000000000
9
- */
10
- exports.Header = {
11
- len: 80,
12
- get: (buf, off) => {
13
- return {
14
- speex: new Token.StringType(8, 'ascii').get(buf, off + 0),
15
- version: util.trimRightNull(new Token.StringType(20, 'ascii').get(buf, off + 8)),
16
- version_id: buf.readInt32LE(off + 28),
17
- header_size: buf.readInt32LE(off + 32),
18
- rate: buf.readInt32LE(off + 36),
19
- mode: buf.readInt32LE(off + 40),
20
- mode_bitstream_version: buf.readInt32LE(off + 44),
21
- nb_channels: buf.readInt32LE(off + 48),
22
- bitrate: buf.readInt32LE(off + 52),
23
- frame_size: buf.readInt32LE(off + 56),
24
- vbr: buf.readInt32LE(off + 60),
25
- frames_per_packet: buf.readInt32LE(off + 64),
26
- extra_headers: buf.readInt32LE(off + 68),
27
- reserved1: buf.readInt32LE(off + 72),
28
- reserved2: buf.readInt32LE(off + 76)
29
- };
30
- }
31
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Header = void 0;
4
+ const Token = require("token-types");
5
+ const util = require("../../common/Util");
6
+ /**
7
+ * Speex Header Packet
8
+ * Ref: https://www.speex.org/docs/manual/speex-manual/node8.html#SECTION00830000000000000000
9
+ */
10
+ exports.Header = {
11
+ len: 80,
12
+ get: (buf, off) => {
13
+ return {
14
+ speex: new Token.StringType(8, 'ascii').get(buf, off + 0),
15
+ version: util.trimRightNull(new Token.StringType(20, 'ascii').get(buf, off + 8)),
16
+ version_id: buf.readInt32LE(off + 28),
17
+ header_size: buf.readInt32LE(off + 32),
18
+ rate: buf.readInt32LE(off + 36),
19
+ mode: buf.readInt32LE(off + 40),
20
+ mode_bitstream_version: buf.readInt32LE(off + 44),
21
+ nb_channels: buf.readInt32LE(off + 48),
22
+ bitrate: buf.readInt32LE(off + 52),
23
+ frame_size: buf.readInt32LE(off + 56),
24
+ vbr: buf.readInt32LE(off + 60),
25
+ frames_per_packet: buf.readInt32LE(off + 64),
26
+ extra_headers: buf.readInt32LE(off + 68),
27
+ reserved1: buf.readInt32LE(off + 72),
28
+ reserved2: buf.readInt32LE(off + 76)
29
+ };
30
+ }
31
+ };
@@ -1,22 +1,22 @@
1
- /// <reference types="node" />
2
- import { ITokenizer } from 'strtok3/lib/core';
3
- import { IPageHeader } from '../Ogg';
4
- import { VorbisParser } from '../vorbis/VorbisParser';
5
- import { IOptions } from '../../type';
6
- import { INativeMetadataCollector } from '../../common/MetadataCollector';
7
- /**
8
- * Speex, RFC 5574
9
- * Ref:
10
- * https://www.speex.org/docs/manual/speex-manual/
11
- * https://tools.ietf.org/html/rfc5574
12
- */
13
- export declare class SpeexParser extends VorbisParser {
14
- private tokenizer;
15
- constructor(metadata: INativeMetadataCollector, options: IOptions, tokenizer: ITokenizer);
16
- /**
17
- * Parse first Speex Ogg page
18
- * @param {IPageHeader} header
19
- * @param {Buffer} pageData
20
- */
21
- protected parseFirstPage(header: IPageHeader, pageData: Buffer): void;
22
- }
1
+ /// <reference types="node" />
2
+ import { ITokenizer } from 'strtok3/lib/core';
3
+ import { IPageHeader } from '../Ogg';
4
+ import { VorbisParser } from '../vorbis/VorbisParser';
5
+ import { IOptions } from '../../type';
6
+ import { INativeMetadataCollector } from '../../common/MetadataCollector';
7
+ /**
8
+ * Speex, RFC 5574
9
+ * Ref:
10
+ * https://www.speex.org/docs/manual/speex-manual/
11
+ * https://tools.ietf.org/html/rfc5574
12
+ */
13
+ export declare class SpeexParser extends VorbisParser {
14
+ private tokenizer;
15
+ constructor(metadata: INativeMetadataCollector, options: IOptions, tokenizer: ITokenizer);
16
+ /**
17
+ * Parse first Speex Ogg page
18
+ * @param {IPageHeader} header
19
+ * @param {Buffer} pageData
20
+ */
21
+ protected parseFirstPage(header: IPageHeader, pageData: Buffer): void;
22
+ }
@@ -1,35 +1,35 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SpeexParser = void 0;
4
- const initDebug = require("debug");
5
- const Speex = require("./Speex");
6
- const VorbisParser_1 = require("../vorbis/VorbisParser");
7
- const debug = initDebug('music-metadata:parser:ogg:speex');
8
- /**
9
- * Speex, RFC 5574
10
- * Ref:
11
- * https://www.speex.org/docs/manual/speex-manual/
12
- * https://tools.ietf.org/html/rfc5574
13
- */
14
- class SpeexParser extends VorbisParser_1.VorbisParser {
15
- constructor(metadata, options, tokenizer) {
16
- super(metadata, options);
17
- this.tokenizer = tokenizer;
18
- }
19
- /**
20
- * Parse first Speex Ogg page
21
- * @param {IPageHeader} header
22
- * @param {Buffer} pageData
23
- */
24
- parseFirstPage(header, pageData) {
25
- debug('First Ogg/Speex page');
26
- const speexHeader = Speex.Header.get(pageData, 0);
27
- this.metadata.setFormat('codec', `Speex ${speexHeader.version}`);
28
- this.metadata.setFormat('numberOfChannels', speexHeader.nb_channels);
29
- this.metadata.setFormat('sampleRate', speexHeader.rate);
30
- if (speexHeader.bitrate !== -1) {
31
- this.metadata.setFormat('bitrate', speexHeader.bitrate);
32
- }
33
- }
34
- }
35
- exports.SpeexParser = SpeexParser;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SpeexParser = void 0;
4
+ const initDebug = require("debug");
5
+ const VorbisParser_1 = require("../vorbis/VorbisParser");
6
+ const Speex = require("./Speex");
7
+ const debug = initDebug('music-metadata:parser:ogg:speex');
8
+ /**
9
+ * Speex, RFC 5574
10
+ * Ref:
11
+ * https://www.speex.org/docs/manual/speex-manual/
12
+ * https://tools.ietf.org/html/rfc5574
13
+ */
14
+ class SpeexParser extends VorbisParser_1.VorbisParser {
15
+ constructor(metadata, options, tokenizer) {
16
+ super(metadata, options);
17
+ this.tokenizer = tokenizer;
18
+ }
19
+ /**
20
+ * Parse first Speex Ogg page
21
+ * @param {IPageHeader} header
22
+ * @param {Buffer} pageData
23
+ */
24
+ parseFirstPage(header, pageData) {
25
+ debug('First Ogg/Speex page');
26
+ const speexHeader = Speex.Header.get(pageData, 0);
27
+ this.metadata.setFormat('codec', `Speex ${speexHeader.version}`);
28
+ this.metadata.setFormat('numberOfChannels', speexHeader.nb_channels);
29
+ this.metadata.setFormat('sampleRate', speexHeader.rate);
30
+ if (speexHeader.bitrate !== -1) {
31
+ this.metadata.setFormat('bitrate', speexHeader.bitrate);
32
+ }
33
+ }
34
+ }
35
+ exports.SpeexParser = SpeexParser;
@@ -1,20 +1,20 @@
1
- import { IGetToken } from 'strtok3/lib/core';
2
- /**
3
- * 6.2 Identification Header
4
- * Ref: https://theora.org/doc/Theora.pdf: 6.2 Identification Header Decode
5
- */
6
- export interface IIdentificationHeader {
7
- id: string;
8
- vmaj: number;
9
- vmin: number;
10
- vrev: number;
11
- vmbw: number;
12
- vmbh: number;
13
- nombr: number;
14
- nqual: number;
15
- }
16
- /**
17
- * 6.2 Identification Header
18
- * Ref: https://theora.org/doc/Theora.pdf: 6.2 Identification Header Decode
19
- */
20
- export declare const IdentificationHeader: IGetToken<IIdentificationHeader>;
1
+ import { IGetToken } from 'strtok3/lib/core';
2
+ /**
3
+ * 6.2 Identification Header
4
+ * Ref: https://theora.org/doc/Theora.pdf: 6.2 Identification Header Decode
5
+ */
6
+ export interface IIdentificationHeader {
7
+ id: string;
8
+ vmaj: number;
9
+ vmin: number;
10
+ vrev: number;
11
+ vmbw: number;
12
+ vmbh: number;
13
+ nombr: number;
14
+ nqual: number;
15
+ }
16
+ /**
17
+ * 6.2 Identification Header
18
+ * Ref: https://theora.org/doc/Theora.pdf: 6.2 Identification Header Decode
19
+ */
20
+ export declare const IdentificationHeader: IGetToken<IIdentificationHeader>;
@@ -1,23 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IdentificationHeader = void 0;
4
- const Token = require("token-types");
5
- /**
6
- * 6.2 Identification Header
7
- * Ref: https://theora.org/doc/Theora.pdf: 6.2 Identification Header Decode
8
- */
9
- exports.IdentificationHeader = {
10
- len: 42,
11
- get: (buf, off) => {
12
- return {
13
- id: new Token.StringType(7, 'ascii').get(buf, off),
14
- vmaj: buf.readUInt8(off + 7),
15
- vmin: buf.readUInt8(off + 8),
16
- vrev: buf.readUInt8(off + 9),
17
- vmbw: buf.readUInt16BE(off + 10),
18
- vmbh: buf.readUInt16BE(off + 17),
19
- nombr: Token.UINT24_BE.get(buf, off + 37),
20
- nqual: buf.readUInt8(off + 40)
21
- };
22
- }
23
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IdentificationHeader = void 0;
4
+ const Token = require("token-types");
5
+ /**
6
+ * 6.2 Identification Header
7
+ * Ref: https://theora.org/doc/Theora.pdf: 6.2 Identification Header Decode
8
+ */
9
+ exports.IdentificationHeader = {
10
+ len: 42,
11
+ get: (buf, off) => {
12
+ return {
13
+ id: new Token.StringType(7, 'ascii').get(buf, off),
14
+ vmaj: buf.readUInt8(off + 7),
15
+ vmin: buf.readUInt8(off + 8),
16
+ vrev: buf.readUInt8(off + 9),
17
+ vmbw: buf.readUInt16BE(off + 10),
18
+ vmbh: buf.readUInt16BE(off + 17),
19
+ nombr: Token.UINT24_BE.get(buf, off + 37),
20
+ nqual: buf.readUInt8(off + 40)
21
+ };
22
+ }
23
+ };