music-metadata 7.11.7 → 7.12.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.
Files changed (155) hide show
  1. package/LICENSE.txt +9 -0
  2. package/README.md +434 -432
  3. package/lib/ParserFactory.d.ts +48 -49
  4. package/lib/ParserFactory.js +252 -251
  5. package/lib/aiff/AiffParser.d.ts +14 -15
  6. package/lib/aiff/AiffParser.js +84 -85
  7. package/lib/aiff/AiffToken.d.ts +22 -22
  8. package/lib/aiff/AiffToken.js +43 -43
  9. package/lib/apev2/APEv2Parser.d.ts +30 -30
  10. package/lib/apev2/APEv2Parser.js +161 -162
  11. package/lib/apev2/APEv2TagMapper.d.ts +4 -4
  12. package/lib/apev2/APEv2TagMapper.js +86 -86
  13. package/lib/apev2/APEv2Token.d.ts +100 -100
  14. package/lib/apev2/APEv2Token.js +126 -126
  15. package/lib/asf/AsfObject.d.ts +319 -319
  16. package/lib/asf/AsfObject.js +384 -384
  17. package/lib/asf/AsfParser.d.ts +17 -17
  18. package/lib/asf/AsfParser.js +135 -135
  19. package/lib/asf/AsfTagMapper.d.ts +7 -7
  20. package/lib/asf/AsfTagMapper.js +95 -95
  21. package/lib/asf/AsfUtil.d.ts +13 -13
  22. package/lib/asf/AsfUtil.js +40 -40
  23. package/lib/asf/GUID.d.ts +84 -86
  24. package/lib/asf/GUID.js +121 -123
  25. package/lib/common/BasicParser.d.ts +17 -17
  26. package/lib/common/BasicParser.js +18 -18
  27. package/lib/common/CaseInsensitiveTagMap.d.ts +10 -10
  28. package/lib/common/CaseInsensitiveTagMap.js +21 -21
  29. package/lib/common/CombinedTagMapper.d.ts +19 -19
  30. package/lib/common/CombinedTagMapper.js +51 -51
  31. package/lib/common/FourCC.d.ts +6 -6
  32. package/lib/common/FourCC.js +28 -28
  33. package/lib/common/GenericTagMapper.d.ts +51 -51
  34. package/lib/common/GenericTagMapper.js +55 -55
  35. package/lib/common/GenericTagTypes.d.ts +33 -33
  36. package/lib/common/GenericTagTypes.js +131 -131
  37. package/lib/common/MetadataCollector.d.ts +76 -76
  38. package/lib/common/MetadataCollector.js +275 -275
  39. package/lib/common/RandomFileReader.d.ts +22 -20
  40. package/lib/common/RandomFileReader.js +34 -37
  41. package/lib/common/RandomUint8ArrayReader.d.ts +18 -18
  42. package/lib/common/RandomUint8ArrayReader.js +25 -25
  43. package/lib/common/Util.d.ts +57 -58
  44. package/lib/common/Util.js +157 -162
  45. package/lib/core.d.ts +48 -48
  46. package/lib/core.js +90 -90
  47. package/lib/dsdiff/DsdiffParser.d.ts +14 -14
  48. package/lib/dsdiff/DsdiffParser.js +143 -143
  49. package/lib/dsdiff/DsdiffToken.d.ts +9 -9
  50. package/lib/dsdiff/DsdiffToken.js +21 -21
  51. package/lib/dsf/DsfChunk.d.ts +86 -86
  52. package/lib/dsf/DsfChunk.js +54 -54
  53. package/lib/dsf/DsfParser.d.ts +9 -9
  54. package/lib/dsf/DsfParser.js +56 -56
  55. package/lib/flac/FlacParser.d.ts +28 -28
  56. package/lib/flac/FlacParser.js +175 -175
  57. package/lib/id3v1/ID3v1Parser.d.ts +13 -13
  58. package/lib/id3v1/ID3v1Parser.js +134 -134
  59. package/lib/id3v1/ID3v1TagMap.d.ts +4 -4
  60. package/lib/id3v1/ID3v1TagMap.js +22 -22
  61. package/lib/id3v2/AbstractID3Parser.d.ts +17 -17
  62. package/lib/id3v2/AbstractID3Parser.js +60 -60
  63. package/lib/id3v2/FrameParser.d.ts +32 -32
  64. package/lib/id3v2/FrameParser.js +329 -329
  65. package/lib/id3v2/ID3v22TagMapper.d.ts +9 -9
  66. package/lib/id3v2/ID3v22TagMapper.js +55 -55
  67. package/lib/id3v2/ID3v24TagMapper.d.ts +14 -14
  68. package/lib/id3v2/ID3v24TagMapper.js +193 -193
  69. package/lib/id3v2/ID3v2Parser.d.ts +29 -29
  70. package/lib/id3v2/ID3v2Parser.js +184 -194
  71. package/lib/id3v2/ID3v2Token.d.ts +73 -73
  72. package/lib/id3v2/ID3v2Token.js +106 -106
  73. package/lib/iff/index.d.ts +33 -33
  74. package/lib/iff/index.js +19 -19
  75. package/lib/index.d.ts +45 -45
  76. package/lib/index.js +74 -74
  77. package/lib/lyrics3/Lyrics3.d.ts +3 -3
  78. package/lib/lyrics3/Lyrics3.js +17 -17
  79. package/lib/matroska/MatroskaDtd.d.ts +8 -8
  80. package/lib/matroska/MatroskaDtd.js +279 -279
  81. package/lib/matroska/MatroskaParser.d.ts +37 -37
  82. package/lib/matroska/MatroskaParser.js +235 -235
  83. package/lib/matroska/MatroskaTagMapper.d.ts +4 -4
  84. package/lib/matroska/MatroskaTagMapper.js +35 -35
  85. package/lib/matroska/types.d.ts +175 -175
  86. package/lib/matroska/types.js +33 -32
  87. package/lib/mp4/Atom.d.ts +16 -16
  88. package/lib/mp4/Atom.js +70 -70
  89. package/lib/mp4/AtomToken.d.ts +395 -395
  90. package/lib/mp4/AtomToken.js +406 -406
  91. package/lib/mp4/MP4Parser.d.ts +30 -30
  92. package/lib/mp4/MP4Parser.js +511 -511
  93. package/lib/mp4/MP4TagMapper.d.ts +5 -5
  94. package/lib/mp4/MP4TagMapper.js +115 -115
  95. package/lib/mpeg/ExtendedLameHeader.d.ts +27 -27
  96. package/lib/mpeg/ExtendedLameHeader.js +31 -31
  97. package/lib/mpeg/MpegParser.d.ts +49 -49
  98. package/lib/mpeg/MpegParser.js +524 -529
  99. package/lib/mpeg/ReplayGainDataFormat.d.ts +55 -55
  100. package/lib/mpeg/ReplayGainDataFormat.js +69 -69
  101. package/lib/mpeg/XingTag.d.ts +45 -45
  102. package/lib/mpeg/XingTag.js +69 -69
  103. package/lib/musepack/index.d.ts +5 -5
  104. package/lib/musepack/index.js +32 -32
  105. package/lib/musepack/sv7/BitReader.d.ts +13 -13
  106. package/lib/musepack/sv7/BitReader.js +54 -54
  107. package/lib/musepack/sv7/MpcSv7Parser.d.ts +8 -8
  108. package/lib/musepack/sv7/MpcSv7Parser.js +46 -46
  109. package/lib/musepack/sv7/StreamVersion7.d.ts +28 -28
  110. package/lib/musepack/sv7/StreamVersion7.js +41 -41
  111. package/lib/musepack/sv8/MpcSv8Parser.d.ts +6 -6
  112. package/lib/musepack/sv8/MpcSv8Parser.js +55 -55
  113. package/lib/musepack/sv8/StreamVersion8.d.ts +40 -40
  114. package/lib/musepack/sv8/StreamVersion8.js +80 -80
  115. package/lib/ogg/Ogg.d.ts +72 -72
  116. package/lib/ogg/Ogg.js +2 -2
  117. package/lib/ogg/OggParser.d.ts +23 -23
  118. package/lib/ogg/OggParser.js +126 -126
  119. package/lib/ogg/opus/Opus.d.ts +48 -48
  120. package/lib/ogg/opus/Opus.js +28 -28
  121. package/lib/ogg/opus/OpusParser.d.ts +25 -25
  122. package/lib/ogg/opus/OpusParser.js +56 -56
  123. package/lib/ogg/speex/Speex.d.ts +36 -36
  124. package/lib/ogg/speex/Speex.js +31 -31
  125. package/lib/ogg/speex/SpeexParser.d.ts +22 -22
  126. package/lib/ogg/speex/SpeexParser.js +35 -35
  127. package/lib/ogg/theora/Theora.d.ts +20 -20
  128. package/lib/ogg/theora/Theora.js +23 -23
  129. package/lib/ogg/theora/TheoraParser.d.ts +28 -28
  130. package/lib/ogg/theora/TheoraParser.js +44 -44
  131. package/lib/ogg/vorbis/Vorbis.d.ts +69 -79
  132. package/lib/ogg/vorbis/Vorbis.js +78 -78
  133. package/lib/ogg/vorbis/VorbisDecoder.d.ts +12 -12
  134. package/lib/ogg/vorbis/VorbisDecoder.js +32 -32
  135. package/lib/ogg/vorbis/VorbisParser.d.ts +36 -36
  136. package/lib/ogg/vorbis/VorbisParser.js +128 -128
  137. package/lib/ogg/vorbis/VorbisTagMapper.d.ts +7 -7
  138. package/lib/ogg/vorbis/VorbisTagMapper.js +132 -132
  139. package/lib/riff/RiffChunk.d.ts +16 -16
  140. package/lib/riff/RiffChunk.js +32 -32
  141. package/lib/riff/RiffInfoTagMap.d.ts +10 -10
  142. package/lib/riff/RiffInfoTagMap.js +37 -37
  143. package/lib/type.d.ts +592 -599
  144. package/lib/type.js +5 -13
  145. package/lib/wav/BwfChunk.d.ts +17 -0
  146. package/lib/wav/BwfChunk.js +28 -0
  147. package/lib/wav/WaveChunk.d.ts +64 -64
  148. package/lib/wav/WaveChunk.js +65 -65
  149. package/lib/wav/WaveParser.d.ts +24 -24
  150. package/lib/wav/WaveParser.js +156 -144
  151. package/lib/wavpack/WavPackParser.d.ts +14 -14
  152. package/lib/wavpack/WavPackParser.js +99 -105
  153. package/lib/wavpack/WavPackToken.d.ts +64 -64
  154. package/lib/wavpack/WavPackToken.js +76 -76
  155. package/package.json +150 -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 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
+ "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 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
+ "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
+ };