music-metadata 7.11.3 → 7.11.7

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 +58 -57
  43. package/lib/common/Util.js +163 -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 +329 -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 +45 -34
  75. package/lib/index.js +74 -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 -30
  91. package/lib/mp4/MP4Parser.js +511 -511
  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
package/lib/type.d.ts CHANGED
@@ -1,599 +1,599 @@
1
- /// <reference types="node" />
2
- import { GenericTagId, TagType } from './common/GenericTagTypes';
3
- import { IFooter } from "./apev2/APEv2Token";
4
- /**
5
- * Attached picture, typically used for cover art
6
- */
7
- export interface IPicture {
8
- /**
9
- * Image mime type
10
- */
11
- format: string;
12
- /**
13
- * Image data
14
- */
15
- data: Buffer;
16
- /**
17
- * Optional description
18
- */
19
- description?: string;
20
- /**
21
- * Picture type
22
- */
23
- type?: string;
24
- /**
25
- * File name
26
- */
27
- name?: string;
28
- }
29
- /**
30
- * Abstract interface to access rating information
31
- */
32
- export interface IRating {
33
- /**
34
- * Rating source, could be an e-mail address
35
- */
36
- source?: string;
37
- /**
38
- * Rating [0..1]
39
- */
40
- rating: number;
41
- }
42
- export interface ICommonTagsResult {
43
- track: {
44
- no: number | null;
45
- of: number | null;
46
- };
47
- disk: {
48
- no: number | null;
49
- of: number | null;
50
- };
51
- /**
52
- * Release year
53
- */
54
- year?: number;
55
- /**
56
- * Track title
57
- */
58
- title?: string;
59
- /**
60
- * Track, maybe several artists written in a single string.
61
- */
62
- artist?: string;
63
- /**
64
- * Track artists, aims to capture every artist in a different string.
65
- */
66
- artists?: string[];
67
- /**
68
- * Track album artists
69
- */
70
- albumartist?: string;
71
- /**
72
- * Album title
73
- */
74
- album?: string;
75
- /**
76
- * Release data
77
- */
78
- date?: string;
79
- /**
80
- * Original release date
81
- */
82
- originaldate?: string;
83
- /**
84
- * Original release yeat
85
- */
86
- originalyear?: number;
87
- /**
88
- * List of comments
89
- */
90
- comment?: string[];
91
- /**
92
- * Genre
93
- */
94
- genre?: string[];
95
- /**
96
- * Embedded album art
97
- */
98
- picture?: IPicture[];
99
- /**
100
- * Track composer
101
- */
102
- composer?: string[];
103
- /**
104
- * Lyrics
105
- */
106
- lyrics?: string[];
107
- /**
108
- * Album title, formatted for alphabetic ordering
109
- */
110
- albumsort?: string;
111
- /**
112
- * Track title, formatted for alphabetic ordering
113
- */
114
- titlesort?: string;
115
- /**
116
- * The canonical title of the work
117
- */
118
- work?: string;
119
- /**
120
- * Track artist, formatted for alphabetic ordering
121
- */
122
- artistsort?: string;
123
- /**
124
- * Album artist, formatted for alphabetic ordering
125
- */
126
- albumartistsort?: string;
127
- /**
128
- * Composer, formatted for alphabetic ordering
129
- */
130
- composersort?: string;
131
- /**
132
- * Lyricist(s)
133
- */
134
- lyricist?: string[];
135
- /**
136
- * Writer(s)
137
- */
138
- writer?: string[];
139
- /**
140
- * Conductor(s)
141
- */
142
- conductor?: string[];
143
- /**
144
- * Remixer(s)
145
- */
146
- remixer?: string[];
147
- /**
148
- * Arranger(s)
149
- */
150
- arranger?: string[];
151
- /**
152
- * Engineer(s)
153
- */
154
- engineer?: string[];
155
- /**
156
- * Producer(s)
157
- */
158
- producer?: string[];
159
- /**
160
- * Mix-DJ(s)
161
- */
162
- djmixer?: string[];
163
- /**
164
- * Mixed by
165
- */
166
- mixer?: string[];
167
- technician?: string[];
168
- label?: string[];
169
- grouping?: string;
170
- subtitle?: string[];
171
- description?: string[];
172
- longDescription?: string;
173
- discsubtitle?: string[];
174
- totaltracks?: string;
175
- totaldiscs?: string;
176
- movementTotal?: number;
177
- compilation?: boolean;
178
- rating?: IRating[];
179
- bpm?: number;
180
- /**
181
- * Keywords to reflect the mood of the audio, e.g. 'Romantic' or 'Sad'
182
- */
183
- mood?: string;
184
- /**
185
- * Release format, e.g. 'CD'
186
- */
187
- media?: string;
188
- /**
189
- * Release catalog number(s)
190
- */
191
- catalognumber?: string[];
192
- /**
193
- * TV show title
194
- */
195
- tvShow?: string;
196
- /**
197
- * TV show title, formatted for alphabetic ordering
198
- */
199
- tvShowSort?: string;
200
- /**
201
- * TV season title sequence number
202
- */
203
- tvSeason?: number;
204
- /**
205
- * TV Episode sequence number
206
- */
207
- tvEpisode?: number;
208
- /**
209
- * TV episode ID
210
- */
211
- tvEpisodeId?: string;
212
- /**
213
- * TV network
214
- */
215
- tvNetwork?: string;
216
- podcast?: boolean;
217
- podcasturl?: string;
218
- releasestatus?: string;
219
- releasetype?: string[];
220
- releasecountry?: string;
221
- script?: string;
222
- language?: string;
223
- copyright?: string;
224
- license?: string;
225
- encodedby?: string;
226
- encodersettings?: string;
227
- gapless?: boolean;
228
- barcode?: string;
229
- isrc?: string[];
230
- asin?: string;
231
- musicbrainz_recordingid?: string;
232
- musicbrainz_trackid?: string;
233
- musicbrainz_albumid?: string;
234
- musicbrainz_artistid?: string[];
235
- musicbrainz_albumartistid?: string[];
236
- musicbrainz_releasegroupid?: string;
237
- musicbrainz_workid?: string;
238
- musicbrainz_trmid?: string;
239
- musicbrainz_discid?: string;
240
- acoustid_id?: string;
241
- acoustid_fingerprint?: string;
242
- musicip_puid?: string;
243
- musicip_fingerprint?: string;
244
- website?: string;
245
- 'performer:instrument'?: string[];
246
- averageLevel?: number;
247
- peakLevel?: number;
248
- notes?: string[];
249
- originalalbum?: string;
250
- originalartist?: string;
251
- discogs_artist_id?: number[];
252
- discogs_release_id?: number;
253
- discogs_label_id?: number;
254
- discogs_master_release_id?: number;
255
- discogs_votes?: number;
256
- discogs_rating?: number;
257
- /**
258
- * Track gain ratio [0..1]
259
- */
260
- replaygain_track_gain_ratio?: number;
261
- /**
262
- * Track peak ratio [0..1]
263
- */
264
- replaygain_track_peak_ratio?: number;
265
- /**
266
- * Track gain ratio
267
- */
268
- replaygain_track_gain?: IRatio;
269
- /**
270
- * Track peak ratio
271
- */
272
- replaygain_track_peak?: IRatio;
273
- /**
274
- * Album gain ratio
275
- */
276
- replaygain_album_gain?: IRatio;
277
- /**
278
- * Album peak ratio
279
- */
280
- replaygain_album_peak?: IRatio;
281
- /**
282
- * minimum & maximum global gain values across a set of files scanned as an album
283
- */
284
- replaygain_undo?: {
285
- leftChannel: number;
286
- rightChannel: number;
287
- };
288
- /**
289
- * minimum & maximum global gain values across a set of files scanned as an album
290
- */
291
- replaygain_track_minmax?: number[];
292
- /**
293
- * The initial key of the music in the file, e.g. "A Minor".
294
- * Ref: https://docs.microsoft.com/en-us/windows/win32/wmformat/wm-initialkey
295
- */
296
- key?: string;
297
- /**
298
- * Podcast Category
299
- */
300
- category?: string[];
301
- /**
302
- * iTunes Video Quality
303
- *
304
- * 2: Full HD
305
- * 1: HD
306
- * 0: SD
307
- */
308
- hdVideo?: number;
309
- /**
310
- * Podcast Keywords
311
- */
312
- keywords?: string[];
313
- /**
314
- * Movement
315
- */
316
- movement?: string;
317
- /**
318
- * Movement Index/Total
319
- */
320
- movementIndex: {
321
- no?: number;
322
- of?: number;
323
- };
324
- /**
325
- * Podcast Identifier
326
- */
327
- podcastId?: string;
328
- /**
329
- * Show Movement
330
- */
331
- showMovement?: boolean;
332
- /**
333
- * iTunes Media Type
334
- *
335
- * 1: Normal
336
- * 2: Audiobook
337
- * 6: Music Video
338
- * 9: Movie
339
- * 10: TV Show
340
- * 11: Booklet
341
- * 14: Ringtone
342
- *
343
- * https://github.com/sergiomb2/libmp4v2/wiki/iTunesMetadata#user-content-media-type-stik
344
- */
345
- stik?: number;
346
- }
347
- export interface IRatio {
348
- /**
349
- * [0..1]
350
- */
351
- ratio: number;
352
- /**
353
- * Decibel
354
- */
355
- dB: number;
356
- }
357
- export declare type FormatId = 'container' | 'duration' | 'bitrate' | 'sampleRate' | 'bitsPerSample' | 'codec' | 'tool' | 'codecProfile' | 'lossless' | 'numberOfChannels' | 'numberOfSamples' | 'audioMD5' | 'chapters' | 'modificationTime' | 'creationTime' | 'trackPeakLevel' | 'trackGain' | 'albumGain';
358
- export interface IAudioTrack {
359
- samplingFrequency?: number;
360
- outputSamplingFrequency?: number;
361
- channels?: number;
362
- channelPositions?: Buffer;
363
- bitDepth?: number;
364
- }
365
- export interface IVideoTrack {
366
- flagInterlaced?: boolean;
367
- stereoMode?: number;
368
- pixelWidth?: number;
369
- pixelHeight?: number;
370
- displayWidth?: number;
371
- displayHeight?: number;
372
- displayUnit?: number;
373
- aspectRatioType?: number;
374
- colourSpace?: Buffer;
375
- gammaValue?: number;
376
- }
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
- export interface ITrackInfo {
387
- type?: TrackType;
388
- codecName?: string;
389
- codecSettings?: string;
390
- flagEnabled?: boolean;
391
- flagDefault?: boolean;
392
- flagLacing?: boolean;
393
- name?: string;
394
- language?: string;
395
- audio?: IAudioTrack;
396
- video?: IVideoTrack;
397
- }
398
- export interface IFormat {
399
- readonly trackInfo: ITrackInfo[];
400
- /**
401
- * E.g.: 'flac'
402
- */
403
- readonly container?: string;
404
- /**
405
- * List of tags found in parsed audio file
406
- */
407
- readonly tagTypes?: TagType[];
408
- /**
409
- * Duration in seconds
410
- */
411
- readonly duration?: number;
412
- /**
413
- * Number bits per second of encoded audio file
414
- */
415
- readonly bitrate?: number;
416
- /**
417
- * Sampling rate in Samples per second (S/s)
418
- */
419
- readonly sampleRate?: number;
420
- /**
421
- * Audio bit depth
422
- */
423
- readonly bitsPerSample?: number;
424
- /**
425
- * Encoder brand, e.g.: LAME3.99r
426
- */
427
- readonly tool?: string;
428
- /**
429
- * Encoder name / compressionType, e.g.: 'PCM', 'ITU-T G.711 mu-law'
430
- */
431
- readonly codec?: string;
432
- /**
433
- * Codec profile
434
- */
435
- readonly codecProfile?: string;
436
- readonly lossless?: boolean;
437
- /**
438
- * Number of audio channels
439
- */
440
- readonly numberOfChannels?: number;
441
- /**
442
- * Number of samples frames.
443
- * One sample contains all channels
444
- * The duration is: numberOfSamples / sampleRate
445
- */
446
- readonly numberOfSamples?: number;
447
- /**
448
- * 16-byte MD5 of raw audio
449
- */
450
- readonly audioMD5?: Buffer;
451
- /**
452
- * Chapters in audio stream
453
- */
454
- readonly chapters?: IChapter[];
455
- /**
456
- * Time file was created
457
- */
458
- readonly creationTime?: Date;
459
- /**
460
- * Time file was modified
461
- */
462
- readonly modificationTime?: Date;
463
- readonly trackGain?: number;
464
- readonly trackPeakLevel?: number;
465
- readonly albumGain?: number;
466
- }
467
- export interface ITag {
468
- id: string;
469
- value: any;
470
- }
471
- export interface IChapter {
472
- /**
473
- * Chapter title
474
- */
475
- title: string;
476
- /**
477
- * Audio offset in sample number, 0 is the first sample.
478
- * Duration offset is sampleOffset / format.sampleRate
479
- */
480
- sampleOffset: number;
481
- }
482
- /**
483
- * Flat list of tags
484
- */
485
- export interface INativeTags {
486
- [tagType: string]: ITag[];
487
- }
488
- /**
489
- * Tags ordered by tag-ID
490
- */
491
- export interface INativeTagDict {
492
- [tagId: string]: any[];
493
- }
494
- export interface INativeAudioMetadata {
495
- format: IFormat;
496
- native: INativeTags;
497
- quality: IQualityInformation;
498
- }
499
- export interface IQualityInformation {
500
- /**
501
- * Warnings
502
- */
503
- warnings: IParserWarning[];
504
- }
505
- export interface IParserWarning {
506
- message: string;
507
- }
508
- export interface IAudioMetadata extends INativeAudioMetadata {
509
- /**
510
- * Metadata, form independent interface
511
- */
512
- common: ICommonTagsResult;
513
- }
514
- /**
515
- * Corresponds with parser module name
516
- */
517
- export declare type ParserType = 'mpeg' | 'apev2' | 'mp4' | 'asf' | 'flac' | 'ogg' | 'aiff' | 'wavpack' | 'riff' | 'musepack' | 'dsf' | 'dsdiff' | 'adts' | 'matroska';
518
- export interface IOptions {
519
- /**
520
- * default: `false`, if set to `true`, it will parse the whole media file if required to determine the duration.
521
- */
522
- duration?: boolean;
523
- /**
524
- * default: `false`, if set to `true`, it will skip parsing covers.
525
- */
526
- skipCovers?: boolean;
527
- /**
528
- * default: `false`, if set to `true`, it will not search all the entire track for additional headers.
529
- * Only recommenced to use in combination with streams.
530
- */
531
- skipPostHeaders?: boolean;
532
- /**
533
- * default: `false`, if set to `true`, it will include MP4 chapters
534
- */
535
- includeChapters?: boolean;
536
- /**
537
- * Set observer for async callbacks to common or format.
538
- */
539
- observer?: Observer;
540
- }
541
- export interface IApeHeader extends IOptions {
542
- /**
543
- * Offset of APE-header
544
- */
545
- offset: number;
546
- /**
547
- * APEv1 / APEv2 header offset
548
- */
549
- footer: IFooter;
550
- }
551
- export interface IPrivateOptions extends IOptions {
552
- apeHeader?: IApeHeader;
553
- }
554
- /**
555
- * Event definition send after each change to common/format metadata change to observer.
556
- */
557
- export interface IMetadataEvent {
558
- /**
559
- * Tag which has been updated.
560
- */
561
- tag: {
562
- /**
563
- * Either 'common' if it a generic tag event, or 'format' for format related updates
564
- */
565
- type: 'common' | 'format';
566
- /**
567
- * Tag id
568
- */
569
- id: GenericTagId | FormatId;
570
- /**
571
- * Tag value
572
- */
573
- value: any;
574
- };
575
- /**
576
- * Metadata model including the attached tag
577
- */
578
- metadata: IAudioMetadata;
579
- }
580
- export declare type Observer = (update: IMetadataEvent) => void;
581
- /**
582
- * Provides random data read access
583
- * Used read operations on file of buffers
584
- */
585
- export interface IRandomReader {
586
- /**
587
- * Total length of file or buffer
588
- */
589
- fileSize: number;
590
- /**
591
- * Read from a given position of an abstracted file or buffer.
592
- * @param buffer {Buffer} is the buffer that the data will be written to.
593
- * @param offset {number} is the offset in the buffer to start writing at.
594
- * @param length {number}is an integer specifying the number of bytes to read.
595
- * @param position {number} is an argument specifying where to begin reading from in the file.
596
- * @return {Promise<number>} bytes read
597
- */
598
- randomRead(buffer: Buffer, offset: number, length: number, position: number): Promise<number>;
599
- }
1
+ /// <reference types="node" />
2
+ import { GenericTagId, TagType } from './common/GenericTagTypes';
3
+ import { IFooter } from './apev2/APEv2Token';
4
+ /**
5
+ * Attached picture, typically used for cover art
6
+ */
7
+ export interface IPicture {
8
+ /**
9
+ * Image mime type
10
+ */
11
+ format: string;
12
+ /**
13
+ * Image data
14
+ */
15
+ data: Buffer;
16
+ /**
17
+ * Optional description
18
+ */
19
+ description?: string;
20
+ /**
21
+ * Picture type
22
+ */
23
+ type?: string;
24
+ /**
25
+ * File name
26
+ */
27
+ name?: string;
28
+ }
29
+ /**
30
+ * Abstract interface to access rating information
31
+ */
32
+ export interface IRating {
33
+ /**
34
+ * Rating source, could be an e-mail address
35
+ */
36
+ source?: string;
37
+ /**
38
+ * Rating [0..1]
39
+ */
40
+ rating: number;
41
+ }
42
+ export interface ICommonTagsResult {
43
+ track: {
44
+ no: number | null;
45
+ of: number | null;
46
+ };
47
+ disk: {
48
+ no: number | null;
49
+ of: number | null;
50
+ };
51
+ /**
52
+ * Release year
53
+ */
54
+ year?: number;
55
+ /**
56
+ * Track title
57
+ */
58
+ title?: string;
59
+ /**
60
+ * Track, maybe several artists written in a single string.
61
+ */
62
+ artist?: string;
63
+ /**
64
+ * Track artists, aims to capture every artist in a different string.
65
+ */
66
+ artists?: string[];
67
+ /**
68
+ * Track album artists
69
+ */
70
+ albumartist?: string;
71
+ /**
72
+ * Album title
73
+ */
74
+ album?: string;
75
+ /**
76
+ * Release data
77
+ */
78
+ date?: string;
79
+ /**
80
+ * Original release date
81
+ */
82
+ originaldate?: string;
83
+ /**
84
+ * Original release yeat
85
+ */
86
+ originalyear?: number;
87
+ /**
88
+ * List of comments
89
+ */
90
+ comment?: string[];
91
+ /**
92
+ * Genre
93
+ */
94
+ genre?: string[];
95
+ /**
96
+ * Embedded album art
97
+ */
98
+ picture?: IPicture[];
99
+ /**
100
+ * Track composer
101
+ */
102
+ composer?: string[];
103
+ /**
104
+ * Lyrics
105
+ */
106
+ lyrics?: string[];
107
+ /**
108
+ * Album title, formatted for alphabetic ordering
109
+ */
110
+ albumsort?: string;
111
+ /**
112
+ * Track title, formatted for alphabetic ordering
113
+ */
114
+ titlesort?: string;
115
+ /**
116
+ * The canonical title of the work
117
+ */
118
+ work?: string;
119
+ /**
120
+ * Track artist, formatted for alphabetic ordering
121
+ */
122
+ artistsort?: string;
123
+ /**
124
+ * Album artist, formatted for alphabetic ordering
125
+ */
126
+ albumartistsort?: string;
127
+ /**
128
+ * Composer, formatted for alphabetic ordering
129
+ */
130
+ composersort?: string;
131
+ /**
132
+ * Lyricist(s)
133
+ */
134
+ lyricist?: string[];
135
+ /**
136
+ * Writer(s)
137
+ */
138
+ writer?: string[];
139
+ /**
140
+ * Conductor(s)
141
+ */
142
+ conductor?: string[];
143
+ /**
144
+ * Remixer(s)
145
+ */
146
+ remixer?: string[];
147
+ /**
148
+ * Arranger(s)
149
+ */
150
+ arranger?: string[];
151
+ /**
152
+ * Engineer(s)
153
+ */
154
+ engineer?: string[];
155
+ /**
156
+ * Producer(s)
157
+ */
158
+ producer?: string[];
159
+ /**
160
+ * Mix-DJ(s)
161
+ */
162
+ djmixer?: string[];
163
+ /**
164
+ * Mixed by
165
+ */
166
+ mixer?: string[];
167
+ technician?: string[];
168
+ label?: string[];
169
+ grouping?: string;
170
+ subtitle?: string[];
171
+ description?: string[];
172
+ longDescription?: string;
173
+ discsubtitle?: string[];
174
+ totaltracks?: string;
175
+ totaldiscs?: string;
176
+ movementTotal?: number;
177
+ compilation?: boolean;
178
+ rating?: IRating[];
179
+ bpm?: number;
180
+ /**
181
+ * Keywords to reflect the mood of the audio, e.g. 'Romantic' or 'Sad'
182
+ */
183
+ mood?: string;
184
+ /**
185
+ * Release format, e.g. 'CD'
186
+ */
187
+ media?: string;
188
+ /**
189
+ * Release catalog number(s)
190
+ */
191
+ catalognumber?: string[];
192
+ /**
193
+ * TV show title
194
+ */
195
+ tvShow?: string;
196
+ /**
197
+ * TV show title, formatted for alphabetic ordering
198
+ */
199
+ tvShowSort?: string;
200
+ /**
201
+ * TV season title sequence number
202
+ */
203
+ tvSeason?: number;
204
+ /**
205
+ * TV Episode sequence number
206
+ */
207
+ tvEpisode?: number;
208
+ /**
209
+ * TV episode ID
210
+ */
211
+ tvEpisodeId?: string;
212
+ /**
213
+ * TV network
214
+ */
215
+ tvNetwork?: string;
216
+ podcast?: boolean;
217
+ podcasturl?: string;
218
+ releasestatus?: string;
219
+ releasetype?: string[];
220
+ releasecountry?: string;
221
+ script?: string;
222
+ language?: string;
223
+ copyright?: string;
224
+ license?: string;
225
+ encodedby?: string;
226
+ encodersettings?: string;
227
+ gapless?: boolean;
228
+ barcode?: string;
229
+ isrc?: string[];
230
+ asin?: string;
231
+ musicbrainz_recordingid?: string;
232
+ musicbrainz_trackid?: string;
233
+ musicbrainz_albumid?: string;
234
+ musicbrainz_artistid?: string[];
235
+ musicbrainz_albumartistid?: string[];
236
+ musicbrainz_releasegroupid?: string;
237
+ musicbrainz_workid?: string;
238
+ musicbrainz_trmid?: string;
239
+ musicbrainz_discid?: string;
240
+ acoustid_id?: string;
241
+ acoustid_fingerprint?: string;
242
+ musicip_puid?: string;
243
+ musicip_fingerprint?: string;
244
+ website?: string;
245
+ 'performer:instrument'?: string[];
246
+ averageLevel?: number;
247
+ peakLevel?: number;
248
+ notes?: string[];
249
+ originalalbum?: string;
250
+ originalartist?: string;
251
+ discogs_artist_id?: number[];
252
+ discogs_release_id?: number;
253
+ discogs_label_id?: number;
254
+ discogs_master_release_id?: number;
255
+ discogs_votes?: number;
256
+ discogs_rating?: number;
257
+ /**
258
+ * Track gain ratio [0..1]
259
+ */
260
+ replaygain_track_gain_ratio?: number;
261
+ /**
262
+ * Track peak ratio [0..1]
263
+ */
264
+ replaygain_track_peak_ratio?: number;
265
+ /**
266
+ * Track gain ratio
267
+ */
268
+ replaygain_track_gain?: IRatio;
269
+ /**
270
+ * Track peak ratio
271
+ */
272
+ replaygain_track_peak?: IRatio;
273
+ /**
274
+ * Album gain ratio
275
+ */
276
+ replaygain_album_gain?: IRatio;
277
+ /**
278
+ * Album peak ratio
279
+ */
280
+ replaygain_album_peak?: IRatio;
281
+ /**
282
+ * minimum & maximum global gain values across a set of files scanned as an album
283
+ */
284
+ replaygain_undo?: {
285
+ leftChannel: number;
286
+ rightChannel: number;
287
+ };
288
+ /**
289
+ * minimum & maximum global gain values across a set of files scanned as an album
290
+ */
291
+ replaygain_track_minmax?: number[];
292
+ /**
293
+ * The initial key of the music in the file, e.g. "A Minor".
294
+ * Ref: https://docs.microsoft.com/en-us/windows/win32/wmformat/wm-initialkey
295
+ */
296
+ key?: string;
297
+ /**
298
+ * Podcast Category
299
+ */
300
+ category?: string[];
301
+ /**
302
+ * iTunes Video Quality
303
+ *
304
+ * 2: Full HD
305
+ * 1: HD
306
+ * 0: SD
307
+ */
308
+ hdVideo?: number;
309
+ /**
310
+ * Podcast Keywords
311
+ */
312
+ keywords?: string[];
313
+ /**
314
+ * Movement
315
+ */
316
+ movement?: string;
317
+ /**
318
+ * Movement Index/Total
319
+ */
320
+ movementIndex: {
321
+ no?: number;
322
+ of?: number;
323
+ };
324
+ /**
325
+ * Podcast Identifier
326
+ */
327
+ podcastId?: string;
328
+ /**
329
+ * Show Movement
330
+ */
331
+ showMovement?: boolean;
332
+ /**
333
+ * iTunes Media Type
334
+ *
335
+ * 1: Normal
336
+ * 2: Audiobook
337
+ * 6: Music Video
338
+ * 9: Movie
339
+ * 10: TV Show
340
+ * 11: Booklet
341
+ * 14: Ringtone
342
+ *
343
+ * https://github.com/sergiomb2/libmp4v2/wiki/iTunesMetadata#user-content-media-type-stik
344
+ */
345
+ stik?: number;
346
+ }
347
+ export interface IRatio {
348
+ /**
349
+ * [0..1]
350
+ */
351
+ ratio: number;
352
+ /**
353
+ * Decibel
354
+ */
355
+ dB: number;
356
+ }
357
+ export declare type FormatId = 'container' | 'duration' | 'bitrate' | 'sampleRate' | 'bitsPerSample' | 'codec' | 'tool' | 'codecProfile' | 'lossless' | 'numberOfChannels' | 'numberOfSamples' | 'audioMD5' | 'chapters' | 'modificationTime' | 'creationTime' | 'trackPeakLevel' | 'trackGain' | 'albumGain';
358
+ export interface IAudioTrack {
359
+ samplingFrequency?: number;
360
+ outputSamplingFrequency?: number;
361
+ channels?: number;
362
+ channelPositions?: Buffer;
363
+ bitDepth?: number;
364
+ }
365
+ export interface IVideoTrack {
366
+ flagInterlaced?: boolean;
367
+ stereoMode?: number;
368
+ pixelWidth?: number;
369
+ pixelHeight?: number;
370
+ displayWidth?: number;
371
+ displayHeight?: number;
372
+ displayUnit?: number;
373
+ aspectRatioType?: number;
374
+ colourSpace?: Buffer;
375
+ gammaValue?: number;
376
+ }
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
+ export interface ITrackInfo {
387
+ type?: TrackType;
388
+ codecName?: string;
389
+ codecSettings?: string;
390
+ flagEnabled?: boolean;
391
+ flagDefault?: boolean;
392
+ flagLacing?: boolean;
393
+ name?: string;
394
+ language?: string;
395
+ audio?: IAudioTrack;
396
+ video?: IVideoTrack;
397
+ }
398
+ export interface IFormat {
399
+ readonly trackInfo: ITrackInfo[];
400
+ /**
401
+ * E.g.: 'flac'
402
+ */
403
+ readonly container?: string;
404
+ /**
405
+ * List of tags found in parsed audio file
406
+ */
407
+ readonly tagTypes?: TagType[];
408
+ /**
409
+ * Duration in seconds
410
+ */
411
+ readonly duration?: number;
412
+ /**
413
+ * Number bits per second of encoded audio file
414
+ */
415
+ readonly bitrate?: number;
416
+ /**
417
+ * Sampling rate in Samples per second (S/s)
418
+ */
419
+ readonly sampleRate?: number;
420
+ /**
421
+ * Audio bit depth
422
+ */
423
+ readonly bitsPerSample?: number;
424
+ /**
425
+ * Encoder brand, e.g.: LAME3.99r
426
+ */
427
+ readonly tool?: string;
428
+ /**
429
+ * Encoder name / compressionType, e.g.: 'PCM', 'ITU-T G.711 mu-law'
430
+ */
431
+ readonly codec?: string;
432
+ /**
433
+ * Codec profile
434
+ */
435
+ readonly codecProfile?: string;
436
+ readonly lossless?: boolean;
437
+ /**
438
+ * Number of audio channels
439
+ */
440
+ readonly numberOfChannels?: number;
441
+ /**
442
+ * Number of samples frames.
443
+ * One sample contains all channels
444
+ * The duration is: numberOfSamples / sampleRate
445
+ */
446
+ readonly numberOfSamples?: number;
447
+ /**
448
+ * 16-byte MD5 of raw audio
449
+ */
450
+ readonly audioMD5?: Buffer;
451
+ /**
452
+ * Chapters in audio stream
453
+ */
454
+ readonly chapters?: IChapter[];
455
+ /**
456
+ * Time file was created
457
+ */
458
+ readonly creationTime?: Date;
459
+ /**
460
+ * Time file was modified
461
+ */
462
+ readonly modificationTime?: Date;
463
+ readonly trackGain?: number;
464
+ readonly trackPeakLevel?: number;
465
+ readonly albumGain?: number;
466
+ }
467
+ export interface ITag {
468
+ id: string;
469
+ value: any;
470
+ }
471
+ export interface IChapter {
472
+ /**
473
+ * Chapter title
474
+ */
475
+ title: string;
476
+ /**
477
+ * Audio offset in sample number, 0 is the first sample.
478
+ * Duration offset is sampleOffset / format.sampleRate
479
+ */
480
+ sampleOffset: number;
481
+ }
482
+ /**
483
+ * Flat list of tags
484
+ */
485
+ export interface INativeTags {
486
+ [tagType: string]: ITag[];
487
+ }
488
+ /**
489
+ * Tags ordered by tag-ID
490
+ */
491
+ export interface INativeTagDict {
492
+ [tagId: string]: any[];
493
+ }
494
+ export interface INativeAudioMetadata {
495
+ format: IFormat;
496
+ native: INativeTags;
497
+ quality: IQualityInformation;
498
+ }
499
+ export interface IQualityInformation {
500
+ /**
501
+ * Warnings
502
+ */
503
+ warnings: IParserWarning[];
504
+ }
505
+ export interface IParserWarning {
506
+ message: string;
507
+ }
508
+ export interface IAudioMetadata extends INativeAudioMetadata {
509
+ /**
510
+ * Metadata, form independent interface
511
+ */
512
+ common: ICommonTagsResult;
513
+ }
514
+ /**
515
+ * Corresponds with parser module name
516
+ */
517
+ export declare type ParserType = 'mpeg' | 'apev2' | 'mp4' | 'asf' | 'flac' | 'ogg' | 'aiff' | 'wavpack' | 'riff' | 'musepack' | 'dsf' | 'dsdiff' | 'adts' | 'matroska';
518
+ export interface IOptions {
519
+ /**
520
+ * default: `false`, if set to `true`, it will parse the whole media file if required to determine the duration.
521
+ */
522
+ duration?: boolean;
523
+ /**
524
+ * default: `false`, if set to `true`, it will skip parsing covers.
525
+ */
526
+ skipCovers?: boolean;
527
+ /**
528
+ * default: `false`, if set to `true`, it will not search all the entire track for additional headers.
529
+ * Only recommenced to use in combination with streams.
530
+ */
531
+ skipPostHeaders?: boolean;
532
+ /**
533
+ * default: `false`, if set to `true`, it will include MP4 chapters
534
+ */
535
+ includeChapters?: boolean;
536
+ /**
537
+ * Set observer for async callbacks to common or format.
538
+ */
539
+ observer?: Observer;
540
+ }
541
+ export interface IApeHeader extends IOptions {
542
+ /**
543
+ * Offset of APE-header
544
+ */
545
+ offset: number;
546
+ /**
547
+ * APEv1 / APEv2 header offset
548
+ */
549
+ footer: IFooter;
550
+ }
551
+ export interface IPrivateOptions extends IOptions {
552
+ apeHeader?: IApeHeader;
553
+ }
554
+ /**
555
+ * Event definition send after each change to common/format metadata change to observer.
556
+ */
557
+ export interface IMetadataEvent {
558
+ /**
559
+ * Tag which has been updated.
560
+ */
561
+ tag: {
562
+ /**
563
+ * Either 'common' if it a generic tag event, or 'format' for format related updates
564
+ */
565
+ type: 'common' | 'format';
566
+ /**
567
+ * Tag id
568
+ */
569
+ id: GenericTagId | FormatId;
570
+ /**
571
+ * Tag value
572
+ */
573
+ value: any;
574
+ };
575
+ /**
576
+ * Metadata model including the attached tag
577
+ */
578
+ metadata: IAudioMetadata;
579
+ }
580
+ export declare type Observer = (update: IMetadataEvent) => void;
581
+ /**
582
+ * Provides random data read access
583
+ * Used read operations on file of buffers
584
+ */
585
+ export interface IRandomReader {
586
+ /**
587
+ * Total length of file or buffer
588
+ */
589
+ fileSize: number;
590
+ /**
591
+ * Read from a given position of an abstracted file or buffer.
592
+ * @param buffer {Buffer} is the buffer that the data will be written to.
593
+ * @param offset {number} is the offset in the buffer to start writing at.
594
+ * @param length {number}is an integer specifying the number of bytes to read.
595
+ * @param position {number} is an argument specifying where to begin reading from in the file.
596
+ * @return {Promise<number>} bytes read
597
+ */
598
+ randomRead(buffer: Buffer, offset: number, length: number, position: number): Promise<number>;
599
+ }