music-metadata 11.6.0 → 11.7.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/lib/core.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Primary entry point, Node.js specific entry point is MusepackParser.ts
3
3
  */
4
- import { fromWebStream, fromBuffer } from 'strtok3';
4
+ import { fromWebStream, fromBuffer, fromBlob } from 'strtok3';
5
5
  import { ParserFactory } from './ParserFactory.js';
6
6
  import { APEv2Parser } from './apev2/APEv2Parser.js';
7
7
  import { hasID3v1Header } from './id3v1/ID3v1Parser.js';
@@ -17,11 +17,13 @@ export * from './ParseError.js';
17
17
  * @returns Metadata
18
18
  */
19
19
  export async function parseBlob(blob, options = {}) {
20
- const fileInfo = { mimeType: blob.type, size: blob.size };
21
- if (blob instanceof File) {
22
- fileInfo.path = blob.name;
20
+ const tokenizer = fromBlob(blob);
21
+ try {
22
+ return await parseFromTokenizer(tokenizer, options);
23
+ }
24
+ finally {
25
+ await tokenizer.close();
23
26
  }
24
- return parseWebStream(blob.stream(), fileInfo, options);
25
27
  }
26
28
  /**
27
29
  * Parse audio from Web Stream.Readable
@@ -1,4 +1,6 @@
1
+ import { type IVorbisPicture } from '../ogg/vorbis/Vorbis.js';
1
2
  import { AbstractID3Parser } from '../id3v2/AbstractID3Parser.js';
3
+ import type { IBlockStreamInfo } from './FlacToken.js';
2
4
  export declare class FlacParser extends AbstractID3Parser {
3
5
  private vorbisParser;
4
6
  private padding;
@@ -7,11 +9,22 @@ export declare class FlacParser extends AbstractID3Parser {
7
9
  /**
8
10
  * Parse STREAMINFO
9
11
  */
10
- private parseBlockStreamInfo;
12
+ private readBlockStreamInfo;
13
+ /**
14
+ * Parse STREAMINFO
15
+ */
16
+ processsStreamInfo(streamInfo: IBlockStreamInfo): void;
17
+ /**
18
+ * Read VORBIS_COMMENT from tokenizer
19
+ * Ref: https://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-640004.2.3
20
+ */
21
+ private readComment;
11
22
  /**
12
23
  * Parse VORBIS_COMMENT
13
24
  * Ref: https://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-640004.2.3
14
25
  */
15
- private parseComment;
26
+ parseComment(data: Uint8Array): Promise<void>;
16
27
  private parsePicture;
28
+ addPictureTag(picture: IVorbisPicture): Promise<void>;
29
+ private addTag;
17
30
  }
@@ -1,28 +1,15 @@
1
- import { UINT16_BE, UINT24_BE, Uint8ArrayType } from 'token-types';
2
1
  import initDebug from 'debug';
3
- import * as util from '../common/Util.js';
2
+ import { Uint8ArrayType } from 'token-types';
4
3
  import { VorbisPictureToken } from '../ogg/vorbis/Vorbis.js';
5
4
  import { AbstractID3Parser } from '../id3v2/AbstractID3Parser.js';
6
5
  import { FourCcToken } from '../common/FourCC.js';
7
6
  import { VorbisStream } from '../ogg/vorbis/VorbisStream.js';
8
7
  import { VorbisDecoder } from '../ogg/vorbis/VorbisDecoder.js';
9
8
  import { makeUnexpectedFileContentError } from '../ParseError.js';
9
+ import * as Flac from './FlacToken.js';
10
10
  const debug = initDebug('music-metadata:parser:FLAC');
11
11
  class FlacContentError extends makeUnexpectedFileContentError('FLAC') {
12
12
  }
13
- /**
14
- * FLAC supports up to 128 kinds of metadata blocks; currently the following are defined:
15
- * ref: https://xiph.org/flac/format.html#metadata_block
16
- */
17
- const BlockType = {
18
- STREAMINFO: 0, // STREAMINFO
19
- PADDING: 1, // PADDING
20
- APPLICATION: 2, // APPLICATION
21
- SEEKTABLE: 3, // SEEKTABLE
22
- VORBIS_COMMENT: 4, // VORBIS_COMMENT
23
- CUESHEET: 5, // CUESHEET
24
- PICTURE: 6 // PICTURE
25
- };
26
13
  export class FlacParser extends AbstractID3Parser {
27
14
  constructor() {
28
15
  super(...arguments);
@@ -34,11 +21,10 @@ export class FlacParser extends AbstractID3Parser {
34
21
  if (fourCC.toString() !== 'fLaC') {
35
22
  throw new FlacContentError('Invalid FLAC preamble');
36
23
  }
37
- this.metadata.setAudioOnly();
38
24
  let blockHeader;
39
25
  do {
40
26
  // Read block header
41
- blockHeader = await this.tokenizer.readToken(BlockHeader);
27
+ blockHeader = await this.tokenizer.readToken(Flac.BlockHeader);
42
28
  // Parse block data
43
29
  await this.parseDataBlock(blockHeader);
44
30
  } while (!blockHeader.lastBlock);
@@ -50,20 +36,20 @@ export class FlacParser extends AbstractID3Parser {
50
36
  async parseDataBlock(blockHeader) {
51
37
  debug(`blockHeader type=${blockHeader.type}, length=${blockHeader.length}`);
52
38
  switch (blockHeader.type) {
53
- case BlockType.STREAMINFO:
54
- return this.parseBlockStreamInfo(blockHeader.length);
55
- case BlockType.PADDING:
39
+ case Flac.BlockType.STREAMINFO:
40
+ return this.readBlockStreamInfo(blockHeader.length);
41
+ case Flac.BlockType.PADDING:
56
42
  this.padding += blockHeader.length;
57
43
  break;
58
- case BlockType.APPLICATION:
44
+ case Flac.BlockType.APPLICATION:
59
45
  break;
60
- case BlockType.SEEKTABLE:
46
+ case Flac.BlockType.SEEKTABLE:
61
47
  break;
62
- case BlockType.VORBIS_COMMENT:
63
- return this.parseComment(blockHeader.length);
64
- case BlockType.CUESHEET:
48
+ case Flac.BlockType.VORBIS_COMMENT:
49
+ return this.readComment(blockHeader.length);
50
+ case Flac.BlockType.CUESHEET:
65
51
  break;
66
- case BlockType.PICTURE:
52
+ case Flac.BlockType.PICTURE:
67
53
  await this.parsePicture(blockHeader.length);
68
54
  return;
69
55
  default:
@@ -75,12 +61,19 @@ export class FlacParser extends AbstractID3Parser {
75
61
  /**
76
62
  * Parse STREAMINFO
77
63
  */
78
- async parseBlockStreamInfo(dataLen) {
79
- if (dataLen !== BlockStreamInfo.len)
64
+ async readBlockStreamInfo(dataLen) {
65
+ if (dataLen !== Flac.BlockStreamInfo.len)
80
66
  throw new FlacContentError('Unexpected block-stream-info length');
81
- const streamInfo = await this.tokenizer.readToken(BlockStreamInfo);
67
+ const streamInfo = await this.tokenizer.readToken(Flac.BlockStreamInfo);
82
68
  this.metadata.setFormat('container', 'FLAC');
69
+ this.processsStreamInfo(streamInfo);
70
+ }
71
+ /**
72
+ * Parse STREAMINFO
73
+ */
74
+ processsStreamInfo(streamInfo) {
83
75
  this.metadata.setFormat('codec', 'FLAC');
76
+ this.metadata.setFormat('hasAudio', true);
84
77
  this.metadata.setFormat('lossless', true);
85
78
  this.metadata.setFormat('numberOfChannels', streamInfo.channels);
86
79
  this.metadata.setFormat('bitsPerSample', streamInfo.bitsPerSample);
@@ -90,11 +83,18 @@ export class FlacParser extends AbstractID3Parser {
90
83
  }
91
84
  }
92
85
  /**
93
- * Parse VORBIS_COMMENT
86
+ * Read VORBIS_COMMENT from tokenizer
94
87
  * Ref: https://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-640004.2.3
95
88
  */
96
- async parseComment(dataLen) {
89
+ async readComment(dataLen) {
97
90
  const data = await this.tokenizer.readToken(new Uint8ArrayType(dataLen));
91
+ return this.parseComment(data);
92
+ }
93
+ /**
94
+ * Parse VORBIS_COMMENT
95
+ * Ref: https://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-640004.2.3
96
+ */
97
+ async parseComment(data) {
98
98
  const decoder = new VorbisDecoder(data, 0);
99
99
  decoder.readStringUtf8(); // vendor (skip)
100
100
  const commentListLength = decoder.readInt32();
@@ -102,62 +102,19 @@ export class FlacParser extends AbstractID3Parser {
102
102
  for (let i = 0; i < commentListLength; i++) {
103
103
  tags[i] = decoder.parseUserComment();
104
104
  }
105
- await Promise.all(tags.map(tag => this.vorbisParser.addTag(tag.key, tag.value)));
105
+ await Promise.all(tags.map(tag => this.addTag(tag.key, tag.value)));
106
106
  }
107
107
  async parsePicture(dataLen) {
108
108
  if (this.options.skipCovers) {
109
109
  return this.tokenizer.ignore(dataLen);
110
110
  }
111
- const picture = await this.tokenizer.readToken(new VorbisPictureToken(dataLen));
112
- this.vorbisParser.addTag('METADATA_BLOCK_PICTURE', picture);
111
+ return this.addPictureTag(await this.tokenizer.readToken(new VorbisPictureToken(dataLen)));
113
112
  }
114
- }
115
- const BlockHeader = {
116
- len: 4,
117
- get: (buf, off) => {
118
- return {
119
- lastBlock: util.getBit(buf, off, 7),
120
- type: util.getBitAllignedNumber(buf, off, 1, 7),
121
- length: UINT24_BE.get(buf, off + 1)
122
- };
113
+ addPictureTag(picture) {
114
+ return this.addTag('METADATA_BLOCK_PICTURE', picture);
123
115
  }
124
- };
125
- /**
126
- * METADATA_BLOCK_DATA
127
- * Ref: https://xiph.org/flac/format.html#metadata_block_streaminfo
128
- */
129
- const BlockStreamInfo = {
130
- len: 34,
131
- get: (buf, off) => {
132
- return {
133
- // The minimum block size (in samples) used in the stream.
134
- minimumBlockSize: UINT16_BE.get(buf, off),
135
- // The maximum block size (in samples) used in the stream.
136
- // (Minimum blocksize == maximum blocksize) implies a fixed-blocksize stream.
137
- maximumBlockSize: UINT16_BE.get(buf, off + 2) / 1000,
138
- // The minimum frame size (in bytes) used in the stream.
139
- // May be 0 to imply the value is not known.
140
- minimumFrameSize: UINT24_BE.get(buf, off + 4),
141
- // The maximum frame size (in bytes) used in the stream.
142
- // May be 0 to imply the value is not known.
143
- maximumFrameSize: UINT24_BE.get(buf, off + 7),
144
- // Sample rate in Hz. Though 20 bits are available,
145
- // the maximum sample rate is limited by the structure of frame headers to 655350Hz.
146
- // Also, a value of 0 is invalid.
147
- sampleRate: UINT24_BE.get(buf, off + 10) >> 4,
148
- // probably slower: sampleRate: common.getBitAllignedNumber(buf, off + 10, 0, 20),
149
- // (number of channels)-1. FLAC supports from 1 to 8 channels
150
- channels: util.getBitAllignedNumber(buf, off + 12, 4, 3) + 1,
151
- // bits per sample)-1.
152
- // FLAC supports from 4 to 32 bits per sample. Currently the reference encoder and decoders only support up to 24 bits per sample.
153
- bitsPerSample: util.getBitAllignedNumber(buf, off + 12, 7, 5) + 1,
154
- // Total samples in stream.
155
- // 'Samples' means inter-channel sample, i.e. one second of 44.1Khz audio will have 44100 samples regardless of the number of channels.
156
- // A value of zero here means the number of total samples is unknown.
157
- totalSamples: util.getBitAllignedNumber(buf, off + 13, 4, 36),
158
- // the MD5 hash of the file (see notes for usage... it's a littly tricky)
159
- fileMD5: new Uint8ArrayType(16).get(buf, off + 18)
160
- };
116
+ addTag(id, value) {
117
+ return this.vorbisParser.addTag(id, value);
161
118
  }
162
- };
119
+ }
163
120
  //# sourceMappingURL=FlacParser.js.map
@@ -0,0 +1,45 @@
1
+ import type { IGetToken } from 'strtok3';
2
+ /**
3
+ * FLAC supports up to 128 kinds of metadata blocks; currently the following are defined:
4
+ * ref: https://xiph.org/flac/format.html#metadata_block
5
+ */
6
+ export declare const BlockType: {
7
+ STREAMINFO: number;
8
+ PADDING: number;
9
+ APPLICATION: number;
10
+ SEEKTABLE: number;
11
+ VORBIS_COMMENT: number;
12
+ CUESHEET: number;
13
+ PICTURE: number;
14
+ };
15
+ export type BlockType = typeof BlockType[keyof typeof BlockType];
16
+ /**
17
+ * METADATA_BLOCK_DATA
18
+ * Ref: https://xiph.org/flac/format.html#metadata_block_streaminfo
19
+ */
20
+ export interface IBlockHeader {
21
+ lastBlock: boolean;
22
+ type: BlockType;
23
+ length: number;
24
+ }
25
+ export declare const BlockHeader: IGetToken<IBlockHeader>;
26
+ /**
27
+ * METADATA_BLOCK_DATA
28
+ * Ref: https://xiph.org/flac/format.html#metadata_block_streaminfo
29
+ */
30
+ export interface IBlockStreamInfo {
31
+ minimumBlockSize: number;
32
+ maximumBlockSize: number;
33
+ minimumFrameSize: number;
34
+ maximumFrameSize: number;
35
+ sampleRate: number;
36
+ channels: number;
37
+ bitsPerSample: number;
38
+ totalSamples: number;
39
+ fileMD5: Uint8Array;
40
+ }
41
+ /**
42
+ * METADATA_BLOCK_DATA
43
+ * Ref: https://xiph.org/flac/format.html#metadata_block_streaminfo
44
+ */
45
+ export declare const BlockStreamInfo: IGetToken<IBlockStreamInfo>;
@@ -0,0 +1,64 @@
1
+ import * as util from '../common/Util.js';
2
+ import { UINT16_BE, UINT24_BE, Uint8ArrayType } from 'token-types';
3
+ /**
4
+ * FLAC supports up to 128 kinds of metadata blocks; currently the following are defined:
5
+ * ref: https://xiph.org/flac/format.html#metadata_block
6
+ */
7
+ export const BlockType = {
8
+ STREAMINFO: 0, // STREAMINFO
9
+ PADDING: 1, // PADDING
10
+ APPLICATION: 2, // APPLICATION
11
+ SEEKTABLE: 3, // SEEKTABLE
12
+ VORBIS_COMMENT: 4, // VORBIS_COMMENT
13
+ CUESHEET: 5, // CUESHEET
14
+ PICTURE: 6 // PICTURE
15
+ };
16
+ export const BlockHeader = {
17
+ len: 4,
18
+ get: (buf, off) => {
19
+ return {
20
+ lastBlock: util.getBit(buf, off, 7),
21
+ type: util.getBitAllignedNumber(buf, off, 1, 7),
22
+ length: UINT24_BE.get(buf, off + 1)
23
+ };
24
+ }
25
+ };
26
+ /**
27
+ * METADATA_BLOCK_DATA
28
+ * Ref: https://xiph.org/flac/format.html#metadata_block_streaminfo
29
+ */
30
+ export const BlockStreamInfo = {
31
+ len: 34,
32
+ get: (buf, off) => {
33
+ return {
34
+ // The minimum block size (in samples) used in the stream.
35
+ minimumBlockSize: UINT16_BE.get(buf, off),
36
+ // The maximum block size (in samples) used in the stream.
37
+ // (Minimum blocksize == maximum blocksize) implies a fixed-blocksize stream.
38
+ maximumBlockSize: UINT16_BE.get(buf, off + 2) / 1000,
39
+ // The minimum frame size (in bytes) used in the stream.
40
+ // May be 0 to imply the value is not known.
41
+ minimumFrameSize: UINT24_BE.get(buf, off + 4),
42
+ // The maximum frame size (in bytes) used in the stream.
43
+ // May be 0 to imply the value is not known.
44
+ maximumFrameSize: UINT24_BE.get(buf, off + 7),
45
+ // Sample rate in Hz. Though 20 bits are available,
46
+ // the maximum sample rate is limited by the structure of frame headers to 655350Hz.
47
+ // Also, a value of 0 is invalid.
48
+ sampleRate: UINT24_BE.get(buf, off + 10) >> 4,
49
+ // probably slower: sampleRate: common.getBitAllignedNumber(buf, off + 10, 0, 20),
50
+ // (number of channels)-1. FLAC supports from 1 to 8 channels
51
+ channels: util.getBitAllignedNumber(buf, off + 12, 4, 3) + 1,
52
+ // bits per sample)-1.
53
+ // FLAC supports from 4 to 32 bits per sample. Currently the reference encoder and decoders only support up to 24 bits per sample.
54
+ bitsPerSample: util.getBitAllignedNumber(buf, off + 12, 7, 5) + 1,
55
+ // Total samples in stream.
56
+ // 'Samples' means inter-channel sample, i.e. one second of 44.1Khz audio will have 44100 samples regardless of the number of channels.
57
+ // A value of zero here means the number of total samples is unknown.
58
+ totalSamples: util.getBitAllignedNumber(buf, off + 13, 4, 36),
59
+ // the MD5 hash of the file (see notes for usage... it's a littly tricky)
60
+ fileMD5: new Uint8ArrayType(16).get(buf, off + 18)
61
+ };
62
+ }
63
+ };
64
+ //# sourceMappingURL=FlacToken.js.map
@@ -8,6 +8,7 @@ import { SpeexStream } from './speex/SpeexStream.js';
8
8
  import { TheoraStream } from './theora/TheoraStream.js';
9
9
  import { makeUnexpectedFileContentError } from '../ParseError.js';
10
10
  import { PageHeader, SegmentTable } from './OggToken.js';
11
+ import { FlacStream } from './flac/FlacStream.js';
11
12
  export class OggContentError extends makeUnexpectedFileContentError('Ogg') {
12
13
  }
13
14
  const debug = initDebug('music-metadata:parser:ogg');
@@ -28,15 +29,12 @@ class OggStream {
28
29
  debug('firstPage=%s, lastPage=%s, continued=%s', header.headerType.firstPage, header.headerType.lastPage, header.headerType.continued);
29
30
  if (header.headerType.firstPage) {
30
31
  const idData = pageData.slice(0, 7); // Copy this portion
31
- switch (idData[0]) {
32
- case 0x01:
33
- case 0x80:
34
- idData[0] = 0x5F; // underscore
35
- break;
36
- }
37
- const id = new TextDecoder('latin1').decode(idData);
38
- switch (id) {
39
- case '_vorbis': // Ogg/Vorbis
32
+ const asciiId = Array.from(idData)
33
+ .filter(b => b >= 32 && b <= 126) // Keep only printable ASCII
34
+ .map(b => String.fromCharCode(b))
35
+ .join('');
36
+ switch (asciiId) {
37
+ case 'vorbis': // Ogg/Vorbis
40
38
  debug(`Set Ogg stream serial ${header.streamSerialNumber}, codec=Vorbis`);
41
39
  this.pageConsumer = new VorbisStream(this.metadata, this.options);
42
40
  break;
@@ -49,12 +47,16 @@ class OggStream {
49
47
  this.pageConsumer = new SpeexStream(this.metadata, this.options, tokenizer);
50
48
  break;
51
49
  case 'fishead':
52
- case '_theora': // Ogg/Theora
50
+ case 'theora': // Ogg/Theora
53
51
  debug('Set page consumer to Ogg/Theora');
54
52
  this.pageConsumer = new TheoraStream(this.metadata, this.options, tokenizer);
55
53
  break;
54
+ case 'FLAC': // Ogg/Theora
55
+ debug('Set page consumer to Vorbis');
56
+ this.pageConsumer = new FlacStream(this.metadata, this.options, tokenizer);
57
+ break;
56
58
  default:
57
- throw new OggContentError(`Ogg codec not recognized (id=${id})`);
59
+ throw new OggContentError(`Ogg codec not recognized (id=${asciiId}`);
58
60
  }
59
61
  }
60
62
  if (header.headerType.lastPage) {
@@ -0,0 +1,28 @@
1
+ import type { ITokenizer } from 'strtok3';
2
+ import type * as Ogg from '../OggToken.js';
3
+ import type { IOptions } from '../../type.js';
4
+ import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
5
+ /**
6
+ * Ref:
7
+ * - https://xiph.org/flac/ogg_mapping.html
8
+ */
9
+ export declare class FlacStream implements Ogg.IPageConsumer {
10
+ private metadata;
11
+ private options;
12
+ private tokenizer;
13
+ private flacParser;
14
+ constructor(metadata: INativeMetadataCollector, options: IOptions, tokenizer: ITokenizer);
15
+ /**
16
+ * Vorbis 1 parser
17
+ * @param header Ogg Page Header
18
+ * @param pageData Page data
19
+ */
20
+ parsePage(header: Ogg.IPageHeader, pageData: Uint8Array): Promise<void>;
21
+ calculateDuration(): void;
22
+ /**
23
+ * Parse first Theora Ogg page. the initial identification header packet
24
+ */
25
+ protected parseFirstPage(_header: Ogg.IPageHeader, pageData: Uint8Array): Promise<void>;
26
+ private parseDataBlock;
27
+ flush(): Promise<void>;
28
+ }
@@ -0,0 +1,74 @@
1
+ import initDebug from 'debug';
2
+ import * as Flac from '../../flac/FlacToken.js';
3
+ import { FlacParser } from '../../flac/FlacParser.js';
4
+ import { FourCcToken } from '../../common/FourCC.js';
5
+ import { VorbisPictureToken } from '../vorbis/Vorbis.js';
6
+ const debug = initDebug('music-metadata:parser:ogg:theora');
7
+ /**
8
+ * Ref:
9
+ * - https://xiph.org/flac/ogg_mapping.html
10
+ */
11
+ export class FlacStream {
12
+ constructor(metadata, options, tokenizer) {
13
+ this.metadata = metadata;
14
+ this.options = options;
15
+ this.tokenizer = tokenizer;
16
+ this.flacParser = new FlacParser(this.metadata, this.tokenizer, options);
17
+ }
18
+ /**
19
+ * Vorbis 1 parser
20
+ * @param header Ogg Page Header
21
+ * @param pageData Page data
22
+ */
23
+ async parsePage(header, pageData) {
24
+ if (header.headerType.firstPage) {
25
+ await this.parseFirstPage(header, pageData);
26
+ }
27
+ }
28
+ calculateDuration() {
29
+ debug('duration calculation not implemented');
30
+ }
31
+ /**
32
+ * Parse first Theora Ogg page. the initial identification header packet
33
+ */
34
+ async parseFirstPage(_header, pageData) {
35
+ debug('First Ogg/FLAC page');
36
+ const fourCC = await FourCcToken.get(pageData, 9);
37
+ if (fourCC.toString() !== 'fLaC') {
38
+ throw new Error('Invalid FLAC preamble');
39
+ }
40
+ const blockHeader = await Flac.BlockHeader.get(pageData, 13);
41
+ await this.parseDataBlock(blockHeader, pageData.subarray(13 + Flac.BlockHeader.len));
42
+ }
43
+ async parseDataBlock(blockHeader, pageData) {
44
+ debug(`blockHeader type=${blockHeader.type}, length=${blockHeader.length}`);
45
+ switch (blockHeader.type) {
46
+ case Flac.BlockType.STREAMINFO: {
47
+ const streamInfo = Flac.BlockStreamInfo.get(pageData, 0);
48
+ return this.flacParser.processsStreamInfo(streamInfo);
49
+ }
50
+ case Flac.BlockType.PADDING:
51
+ break;
52
+ case Flac.BlockType.APPLICATION:
53
+ break;
54
+ case Flac.BlockType.SEEKTABLE:
55
+ break;
56
+ case Flac.BlockType.VORBIS_COMMENT:
57
+ return this.flacParser.parseComment(pageData);
58
+ case Flac.BlockType.PICTURE:
59
+ if (!this.options.skipCovers) {
60
+ const picture = new VorbisPictureToken(pageData.length).get(pageData, 0);
61
+ return this.flacParser.addPictureTag(picture);
62
+ }
63
+ break;
64
+ default:
65
+ this.metadata.addWarning(`Unknown block type: ${blockHeader.type}`);
66
+ }
67
+ // Ignore data block
68
+ return this.tokenizer.ignore(blockHeader.length).then();
69
+ }
70
+ flush() {
71
+ return Promise.resolve();
72
+ }
73
+ }
74
+ //# sourceMappingURL=FlacStream.js.map
@@ -39,7 +39,7 @@ export declare class VorbisStream implements IPageConsumer {
39
39
  calculateDuration(): void;
40
40
  /**
41
41
  * Parse first Ogg/Vorbis page
42
- * @param header
42
+ * @param _header
43
43
  * @param pageData
44
44
  */
45
45
  protected parseFirstPage(_header: IPageHeader, pageData: Uint8Array): void;
@@ -85,7 +85,7 @@ export class VorbisStream {
85
85
  }
86
86
  /**
87
87
  * Parse first Ogg/Vorbis page
88
- * @param header
88
+ * @param _header
89
89
  * @param pageData
90
90
  */
91
91
  parseFirstPage(_header, pageData) {