music-metadata 7.12.2 → 7.12.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 (155) hide show
  1. package/LICENSE.txt +9 -9
  2. package/README.md +434 -434
  3. package/lib/ParserFactory.d.ts +48 -48
  4. package/lib/ParserFactory.js +252 -252
  5. package/lib/aiff/AiffParser.d.ts +14 -14
  6. package/lib/aiff/AiffParser.js +84 -84
  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 +164 -164
  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 +381 -381
  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 +38 -38
  23. package/lib/asf/GUID.d.ts +84 -84
  24. package/lib/asf/GUID.js +121 -121
  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 -22
  40. package/lib/common/RandomFileReader.js +34 -34
  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 -57
  44. package/lib/common/Util.js +157 -157
  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 +31 -31
  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 +28 -28
  70. package/lib/id3v2/ID3v2Parser.js +182 -182
  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 +32 -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 -524
  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 -69
  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 -592
  144. package/lib/type.js +5 -5
  145. package/lib/wav/BwfChunk.d.ts +17 -17
  146. package/lib/wav/BwfChunk.js +29 -28
  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 +158 -156
  151. package/lib/wavpack/WavPackParser.d.ts +14 -14
  152. package/lib/wavpack/WavPackParser.js +99 -99
  153. package/lib/wavpack/WavPackToken.d.ts +64 -64
  154. package/lib/wavpack/WavPackToken.js +76 -76
  155. package/package.json +152 -150
@@ -1,395 +1,395 @@
1
- /// <reference types="node" />
2
- import { IToken, IGetToken } from 'strtok3/lib/core';
3
- interface IVersionAndFlags {
4
- /**
5
- * A 1-byte specification of the version
6
- */
7
- version: number;
8
- /**
9
- * Three bytes of space for (future) flags.
10
- */
11
- flags: number;
12
- }
13
- export interface IAtomHeader {
14
- length: bigint;
15
- name: string;
16
- }
17
- export interface IAtomFtyp {
18
- type: string;
19
- }
20
- /**
21
- * Common interface for the mvhd (Movie Header) & mdhd (Media) atom
22
- */
23
- export interface IAtomMxhd extends IVersionAndFlags {
24
- /**
25
- * A 32-bit integer that specifies (in seconds since midnight, January 1, 1904) when the media atom was created.
26
- * It is strongly recommended that this value should be specified using coordinated universal time (UTC).
27
- */
28
- creationTime: Date;
29
- /**
30
- * A 32-bit integer that specifies (in seconds since midnight, January 1, 1904) when the media atom was changed.
31
- * It is strongly recommended that this value should be specified using coordinated universal time (UTC).
32
- */
33
- modificationTime: Date;
34
- /**
35
- * A time value that indicates the time scale for this media—that is, the number of time units that pass per second in its time coordinate system.
36
- */
37
- timeScale: number;
38
- /**
39
- * Duration: the duration of this media in units of its time scale.
40
- */
41
- duration: number;
42
- }
43
- /**
44
- * Interface for the parsed Movie Header Atom (mvhd)
45
- */
46
- export interface IAtomMvhd extends IAtomMxhd {
47
- /**
48
- * Preferred rate: a 32-bit fixed-point number that specifies the rate at which to play this movie.
49
- * A value of 1.0 indicates normal rate.
50
- */
51
- preferredRate: number;
52
- /**
53
- * Preferred volume: A 16-bit fixed-point number that specifies how loud to play this movie’s sound.
54
- * A value of 1.0 indicates full volume.
55
- */
56
- preferredVolume: number;
57
- /**
58
- * Reserved: Ten bytes reserved for use by Apple. Set to 0.
59
- */
60
- /**
61
- * Matrix structure: The matrix structure associated with this movie.
62
- * A matrix shows how to map points from one coordinate space into another.
63
- * See Matrices for a discussion of how display matrices are used in QuickTime.
64
- */
65
- /**
66
- * Preview time: The time value in the movie at which the preview begins.
67
- */
68
- previewTime: number;
69
- /**
70
- * Preview duration: The duration of the movie preview in movie time scale units.
71
- */
72
- previewDuration: number;
73
- /**
74
- * Poster time: The time value of the time of the movie poster.
75
- */
76
- posterTime: number;
77
- /**
78
- * selection time: The time value for the start time of the current selection.
79
- */
80
- selectionTime: number;
81
- /**
82
- * Selection duration: The duration of the current selection in movie time scale units.
83
- */
84
- selectionDuration: number;
85
- /**
86
- * Current time: The time value for current time position within the movie.
87
- */
88
- currentTime: number;
89
- /**
90
- * Next track ID: A 32-bit integer that indicates a value to use for the track ID number of the next track added to this movie. Note that 0 is not a valid track ID value.
91
- */
92
- nextTrackID: number;
93
- }
94
- /**
95
- * Interface for the metadata header atom: 'mhdr'
96
- * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW13
97
- */
98
- export interface IMovieHeaderAtom extends IVersionAndFlags {
99
- /**
100
- * A 32-bit unsigned integer indicating the value to use for the item ID of the next item created or assigned an item ID.
101
- * If the value is all ones, it indicates that future additions will require a search for an unused item ID.
102
- */
103
- nextItemID: number;
104
- }
105
- export declare const Header: IToken<IAtomHeader>;
106
- /**
107
- * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap1/qtff1.html#//apple_ref/doc/uid/TP40000939-CH203-38190
108
- */
109
- export declare const ExtendedSize: IToken<bigint>;
110
- export declare const ftyp: IGetToken<IAtomFtyp>;
111
- export declare const tkhd: IGetToken<IAtomFtyp>;
112
- /**
113
- * Token: Movie Header Atom
114
- */
115
- export declare const mhdr: IGetToken<IMovieHeaderAtom>;
116
- /**
117
- * Base class for 'fixed' length atoms.
118
- * In some cases these atoms are longer then the sum of the described fields.
119
- * Issue: https://github.com/Borewit/music-metadata/issues/120
120
- */
121
- export declare abstract class FixedLengthAtom {
122
- len: number;
123
- /**
124
- *
125
- * @param {number} len Length as specified in the size field
126
- * @param {number} expLen Total length of sum of specified fields in the standard
127
- */
128
- protected constructor(len: number, expLen: number, atomId: string);
129
- }
130
- /**
131
- * Interface for the parsed Movie Header Atom (mdhd)
132
- */
133
- export interface IAtomMdhd extends IAtomMxhd {
134
- /**
135
- * A 16-bit integer that specifies the language code for this media.
136
- * See Language Code Values for valid language codes.
137
- * Also see Extended Language Tag Atom for the preferred code to use here if an extended language tag is also included in the media atom.
138
- * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap4/qtff4.html#//apple_ref/doc/uid/TP40000939-CH206-34353
139
- */
140
- language: number;
141
- quality: number;
142
- }
143
- /**
144
- * Token: Media Header Atom
145
- * Ref:
146
- * - https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-SW34
147
- * - https://wiki.multimedia.cx/index.php/QuickTime_container#mdhd
148
- */
149
- export declare class MdhdAtom extends FixedLengthAtom implements IGetToken<IAtomMdhd> {
150
- len: number;
151
- constructor(len: number);
152
- get(buf: Buffer, off: number): IAtomMdhd;
153
- }
154
- /**
155
- * Token: Movie Header Atom
156
- */
157
- export declare class MvhdAtom extends FixedLengthAtom implements IGetToken<IAtomMvhd> {
158
- len: number;
159
- constructor(len: number);
160
- get(buf: Buffer, off: number): IAtomMvhd;
161
- }
162
- /**
163
- * Data Atom Structure ('data')
164
- * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW32
165
- */
166
- export interface IDataAtom {
167
- /**
168
- * Type Indicator
169
- * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW28
170
- */
171
- type: {
172
- /**
173
- * The set of types from which the type is drawn
174
- * If 0, type is drawn from the well-known set of types.
175
- */
176
- set: number;
177
- type: number;
178
- };
179
- /**
180
- * Locale Indicator
181
- */
182
- locale: number;
183
- /**
184
- * An array of bytes containing the value of the metadata.
185
- */
186
- value: Buffer;
187
- }
188
- /**
189
- * Data Atom Structure
190
- */
191
- export declare class DataAtom implements IGetToken<IDataAtom> {
192
- len: number;
193
- constructor(len: number);
194
- get(buf: Uint8Array, off: number): IDataAtom;
195
- }
196
- /**
197
- * Data Atom Structure ('data')
198
- * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW32
199
- */
200
- export interface INameAtom extends IVersionAndFlags {
201
- /**
202
- * An array of bytes containing the value of the metadata.
203
- */
204
- name: string;
205
- }
206
- /**
207
- * Data Atom Structure
208
- * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW31
209
- */
210
- export declare class NameAtom implements IGetToken<INameAtom> {
211
- len: number;
212
- constructor(len: number);
213
- get(buf: Buffer, off: number): INameAtom;
214
- }
215
- /**
216
- * Track Header Atoms interface
217
- * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25550
218
- */
219
- export interface ITrackHeaderAtom extends IVersionAndFlags {
220
- /**
221
- * Creation Time
222
- */
223
- creationTime: Date;
224
- /**
225
- * Modification Time
226
- */
227
- modificationTime: Date;
228
- /**
229
- * TrackID
230
- */
231
- trackId: number;
232
- /**
233
- * A time value that indicates the duration of this track (in the movie’s time coordinate system).
234
- * Note that this property is derived from the track’s edits. The value of this field is equal to the sum of the
235
- * durations of all of the track’s edits. If there is no edit list, then the duration is the sum of the sample
236
- * durations, converted into the movie timescale.
237
- */
238
- duration: number;
239
- /**
240
- * A 16-bit integer that indicates this track’s spatial priority in its movie.
241
- * The QuickTime Movie Toolbox uses this value to determine how tracks overlay one another.
242
- * Tracks with lower layer values are displayed in front of tracks with higher layer values.
243
- */
244
- layer: number;
245
- /**
246
- * A 16-bit integer that identifies a collection of movie tracks that contain alternate data for one another.
247
- * This same identifier appears in each 'tkhd' atom of the other tracks in the group.
248
- * QuickTime chooses one track from the group to be used when the movie is played.
249
- * The choice may be based on such considerations as playback quality, language, or the capabilities of the computer.
250
- * A value of zero indicates that the track is not in an alternate track group.
251
- */
252
- alternateGroup: number;
253
- /**
254
- * A 16-bit fixed-point value that indicates how loudly this track’s sound is to be played.
255
- * A value of 1.0 indicates normal volume.
256
- */
257
- volume: number;
258
- }
259
- /**
260
- * Track Header Atoms structure
261
- * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25550
262
- */
263
- export declare class TrackHeaderAtom implements IGetToken<ITrackHeaderAtom> {
264
- len: number;
265
- constructor(len: number);
266
- get(buf: Buffer, off: number): ITrackHeaderAtom;
267
- }
268
- /**
269
- * Atom: Sample Description Atom ('stsd')
270
- */
271
- interface IAtomStsdHeader extends IVersionAndFlags {
272
- numberOfEntries: number;
273
- }
274
- /**
275
- * Atom: Sample Description Atom ('stsd')
276
- */
277
- export interface ISampleDescription {
278
- dataFormat: string;
279
- dataReferenceIndex: number;
280
- description: Uint8Array;
281
- }
282
- export interface IAtomStsd {
283
- header: IAtomStsdHeader;
284
- table: ISampleDescription[];
285
- }
286
- /**
287
- * Atom: Sample-description Atom ('stsd')
288
- * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25691
289
- */
290
- export declare class StsdAtom implements IGetToken<IAtomStsd> {
291
- len: number;
292
- constructor(len: number);
293
- get(buf: Buffer, off: number): IAtomStsd;
294
- }
295
- export interface ISoundSampleDescriptionVersion {
296
- version: number;
297
- revision: number;
298
- vendor: number;
299
- }
300
- /**
301
- * Common Sound Sample Description (version & revision)
302
- * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-57317
303
- */
304
- export declare const SoundSampleDescriptionVersion: IGetToken<ISoundSampleDescriptionVersion>;
305
- export interface ISoundSampleDescriptionV0 {
306
- numAudioChannels: number;
307
- /**
308
- * Number of bits in each uncompressed sound sample
309
- */
310
- sampleSize: number;
311
- /**
312
- * Compression ID
313
- */
314
- compressionId: number;
315
- packetSize: number;
316
- sampleRate: number;
317
- }
318
- /**
319
- * Sound Sample Description (Version 0)
320
- * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-130736
321
- */
322
- export declare const SoundSampleDescriptionV0: IGetToken<ISoundSampleDescriptionV0>;
323
- export interface ITableAtom<T> extends IVersionAndFlags {
324
- numberOfEntries: number;
325
- entries: T[];
326
- }
327
- declare class SimpleTableAtom<T> implements IGetToken<ITableAtom<T>> {
328
- len: number;
329
- private token;
330
- constructor(len: number, token: IGetToken<T>);
331
- get(buf: Buffer, off: number): ITableAtom<T>;
332
- }
333
- export interface ITimeToSampleToken {
334
- count: number;
335
- duration: number;
336
- }
337
- export declare const TimeToSampleToken: IGetToken<ITimeToSampleToken>;
338
- /**
339
- * Time-to-sample('stts') atom.
340
- * Store duration information for a media’s samples.
341
- * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25696
342
- */
343
- export declare class SttsAtom extends SimpleTableAtom<ITimeToSampleToken> {
344
- len: number;
345
- constructor(len: number);
346
- }
347
- /**
348
- * Sample-to-Chunk ('stsc') atom table entry interface
349
- */
350
- export interface ISampleToChunk {
351
- firstChunk: number;
352
- samplesPerChunk: number;
353
- sampleDescriptionId: number;
354
- }
355
- export declare const SampleToChunkToken: IGetToken<ISampleToChunk>;
356
- /**
357
- * Sample-to-Chunk ('stsc') atom interface
358
- * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25706
359
- */
360
- export declare class StscAtom extends SimpleTableAtom<ISampleToChunk> {
361
- len: number;
362
- constructor(len: number);
363
- }
364
- /**
365
- * Sample-size ('stsz') atom interface
366
- */
367
- export interface IStszAtom extends ITableAtom<number> {
368
- sampleSize: number;
369
- }
370
- /**
371
- * Sample-size ('stsz') atom
372
- * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25710
373
- */
374
- export declare class StszAtom implements IGetToken<IStszAtom> {
375
- len: number;
376
- constructor(len: number);
377
- get(buf: Buffer, off: number): IStszAtom;
378
- }
379
- /**
380
- * Chunk offset atom, 'stco'
381
- * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25715
382
- */
383
- export declare class StcoAtom extends SimpleTableAtom<number> {
384
- len: number;
385
- constructor(len: number);
386
- }
387
- /**
388
- * Token used to decode text-track from 'mdat' atom (raw data stream)
389
- */
390
- export declare class ChapterText implements IGetToken<string> {
391
- len: number;
392
- constructor(len: number);
393
- get(buf: Buffer, off: number): string;
394
- }
395
- export {};
1
+ /// <reference types="node" />
2
+ import { IToken, IGetToken } from 'strtok3/lib/core';
3
+ interface IVersionAndFlags {
4
+ /**
5
+ * A 1-byte specification of the version
6
+ */
7
+ version: number;
8
+ /**
9
+ * Three bytes of space for (future) flags.
10
+ */
11
+ flags: number;
12
+ }
13
+ export interface IAtomHeader {
14
+ length: bigint;
15
+ name: string;
16
+ }
17
+ export interface IAtomFtyp {
18
+ type: string;
19
+ }
20
+ /**
21
+ * Common interface for the mvhd (Movie Header) & mdhd (Media) atom
22
+ */
23
+ export interface IAtomMxhd extends IVersionAndFlags {
24
+ /**
25
+ * A 32-bit integer that specifies (in seconds since midnight, January 1, 1904) when the media atom was created.
26
+ * It is strongly recommended that this value should be specified using coordinated universal time (UTC).
27
+ */
28
+ creationTime: Date;
29
+ /**
30
+ * A 32-bit integer that specifies (in seconds since midnight, January 1, 1904) when the media atom was changed.
31
+ * It is strongly recommended that this value should be specified using coordinated universal time (UTC).
32
+ */
33
+ modificationTime: Date;
34
+ /**
35
+ * A time value that indicates the time scale for this media—that is, the number of time units that pass per second in its time coordinate system.
36
+ */
37
+ timeScale: number;
38
+ /**
39
+ * Duration: the duration of this media in units of its time scale.
40
+ */
41
+ duration: number;
42
+ }
43
+ /**
44
+ * Interface for the parsed Movie Header Atom (mvhd)
45
+ */
46
+ export interface IAtomMvhd extends IAtomMxhd {
47
+ /**
48
+ * Preferred rate: a 32-bit fixed-point number that specifies the rate at which to play this movie.
49
+ * A value of 1.0 indicates normal rate.
50
+ */
51
+ preferredRate: number;
52
+ /**
53
+ * Preferred volume: A 16-bit fixed-point number that specifies how loud to play this movie’s sound.
54
+ * A value of 1.0 indicates full volume.
55
+ */
56
+ preferredVolume: number;
57
+ /**
58
+ * Reserved: Ten bytes reserved for use by Apple. Set to 0.
59
+ */
60
+ /**
61
+ * Matrix structure: The matrix structure associated with this movie.
62
+ * A matrix shows how to map points from one coordinate space into another.
63
+ * See Matrices for a discussion of how display matrices are used in QuickTime.
64
+ */
65
+ /**
66
+ * Preview time: The time value in the movie at which the preview begins.
67
+ */
68
+ previewTime: number;
69
+ /**
70
+ * Preview duration: The duration of the movie preview in movie time scale units.
71
+ */
72
+ previewDuration: number;
73
+ /**
74
+ * Poster time: The time value of the time of the movie poster.
75
+ */
76
+ posterTime: number;
77
+ /**
78
+ * selection time: The time value for the start time of the current selection.
79
+ */
80
+ selectionTime: number;
81
+ /**
82
+ * Selection duration: The duration of the current selection in movie time scale units.
83
+ */
84
+ selectionDuration: number;
85
+ /**
86
+ * Current time: The time value for current time position within the movie.
87
+ */
88
+ currentTime: number;
89
+ /**
90
+ * Next track ID: A 32-bit integer that indicates a value to use for the track ID number of the next track added to this movie. Note that 0 is not a valid track ID value.
91
+ */
92
+ nextTrackID: number;
93
+ }
94
+ /**
95
+ * Interface for the metadata header atom: 'mhdr'
96
+ * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW13
97
+ */
98
+ export interface IMovieHeaderAtom extends IVersionAndFlags {
99
+ /**
100
+ * A 32-bit unsigned integer indicating the value to use for the item ID of the next item created or assigned an item ID.
101
+ * If the value is all ones, it indicates that future additions will require a search for an unused item ID.
102
+ */
103
+ nextItemID: number;
104
+ }
105
+ export declare const Header: IToken<IAtomHeader>;
106
+ /**
107
+ * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap1/qtff1.html#//apple_ref/doc/uid/TP40000939-CH203-38190
108
+ */
109
+ export declare const ExtendedSize: IToken<bigint>;
110
+ export declare const ftyp: IGetToken<IAtomFtyp>;
111
+ export declare const tkhd: IGetToken<IAtomFtyp>;
112
+ /**
113
+ * Token: Movie Header Atom
114
+ */
115
+ export declare const mhdr: IGetToken<IMovieHeaderAtom>;
116
+ /**
117
+ * Base class for 'fixed' length atoms.
118
+ * In some cases these atoms are longer then the sum of the described fields.
119
+ * Issue: https://github.com/Borewit/music-metadata/issues/120
120
+ */
121
+ export declare abstract class FixedLengthAtom {
122
+ len: number;
123
+ /**
124
+ *
125
+ * @param {number} len Length as specified in the size field
126
+ * @param {number} expLen Total length of sum of specified fields in the standard
127
+ */
128
+ protected constructor(len: number, expLen: number, atomId: string);
129
+ }
130
+ /**
131
+ * Interface for the parsed Movie Header Atom (mdhd)
132
+ */
133
+ export interface IAtomMdhd extends IAtomMxhd {
134
+ /**
135
+ * A 16-bit integer that specifies the language code for this media.
136
+ * See Language Code Values for valid language codes.
137
+ * Also see Extended Language Tag Atom for the preferred code to use here if an extended language tag is also included in the media atom.
138
+ * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap4/qtff4.html#//apple_ref/doc/uid/TP40000939-CH206-34353
139
+ */
140
+ language: number;
141
+ quality: number;
142
+ }
143
+ /**
144
+ * Token: Media Header Atom
145
+ * Ref:
146
+ * - https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-SW34
147
+ * - https://wiki.multimedia.cx/index.php/QuickTime_container#mdhd
148
+ */
149
+ export declare class MdhdAtom extends FixedLengthAtom implements IGetToken<IAtomMdhd> {
150
+ len: number;
151
+ constructor(len: number);
152
+ get(buf: Buffer, off: number): IAtomMdhd;
153
+ }
154
+ /**
155
+ * Token: Movie Header Atom
156
+ */
157
+ export declare class MvhdAtom extends FixedLengthAtom implements IGetToken<IAtomMvhd> {
158
+ len: number;
159
+ constructor(len: number);
160
+ get(buf: Buffer, off: number): IAtomMvhd;
161
+ }
162
+ /**
163
+ * Data Atom Structure ('data')
164
+ * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW32
165
+ */
166
+ export interface IDataAtom {
167
+ /**
168
+ * Type Indicator
169
+ * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW28
170
+ */
171
+ type: {
172
+ /**
173
+ * The set of types from which the type is drawn
174
+ * If 0, type is drawn from the well-known set of types.
175
+ */
176
+ set: number;
177
+ type: number;
178
+ };
179
+ /**
180
+ * Locale Indicator
181
+ */
182
+ locale: number;
183
+ /**
184
+ * An array of bytes containing the value of the metadata.
185
+ */
186
+ value: Buffer;
187
+ }
188
+ /**
189
+ * Data Atom Structure
190
+ */
191
+ export declare class DataAtom implements IGetToken<IDataAtom> {
192
+ len: number;
193
+ constructor(len: number);
194
+ get(buf: Uint8Array, off: number): IDataAtom;
195
+ }
196
+ /**
197
+ * Data Atom Structure ('data')
198
+ * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW32
199
+ */
200
+ export interface INameAtom extends IVersionAndFlags {
201
+ /**
202
+ * An array of bytes containing the value of the metadata.
203
+ */
204
+ name: string;
205
+ }
206
+ /**
207
+ * Data Atom Structure
208
+ * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW31
209
+ */
210
+ export declare class NameAtom implements IGetToken<INameAtom> {
211
+ len: number;
212
+ constructor(len: number);
213
+ get(buf: Buffer, off: number): INameAtom;
214
+ }
215
+ /**
216
+ * Track Header Atoms interface
217
+ * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25550
218
+ */
219
+ export interface ITrackHeaderAtom extends IVersionAndFlags {
220
+ /**
221
+ * Creation Time
222
+ */
223
+ creationTime: Date;
224
+ /**
225
+ * Modification Time
226
+ */
227
+ modificationTime: Date;
228
+ /**
229
+ * TrackID
230
+ */
231
+ trackId: number;
232
+ /**
233
+ * A time value that indicates the duration of this track (in the movie’s time coordinate system).
234
+ * Note that this property is derived from the track’s edits. The value of this field is equal to the sum of the
235
+ * durations of all of the track’s edits. If there is no edit list, then the duration is the sum of the sample
236
+ * durations, converted into the movie timescale.
237
+ */
238
+ duration: number;
239
+ /**
240
+ * A 16-bit integer that indicates this track’s spatial priority in its movie.
241
+ * The QuickTime Movie Toolbox uses this value to determine how tracks overlay one another.
242
+ * Tracks with lower layer values are displayed in front of tracks with higher layer values.
243
+ */
244
+ layer: number;
245
+ /**
246
+ * A 16-bit integer that identifies a collection of movie tracks that contain alternate data for one another.
247
+ * This same identifier appears in each 'tkhd' atom of the other tracks in the group.
248
+ * QuickTime chooses one track from the group to be used when the movie is played.
249
+ * The choice may be based on such considerations as playback quality, language, or the capabilities of the computer.
250
+ * A value of zero indicates that the track is not in an alternate track group.
251
+ */
252
+ alternateGroup: number;
253
+ /**
254
+ * A 16-bit fixed-point value that indicates how loudly this track’s sound is to be played.
255
+ * A value of 1.0 indicates normal volume.
256
+ */
257
+ volume: number;
258
+ }
259
+ /**
260
+ * Track Header Atoms structure
261
+ * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25550
262
+ */
263
+ export declare class TrackHeaderAtom implements IGetToken<ITrackHeaderAtom> {
264
+ len: number;
265
+ constructor(len: number);
266
+ get(buf: Buffer, off: number): ITrackHeaderAtom;
267
+ }
268
+ /**
269
+ * Atom: Sample Description Atom ('stsd')
270
+ */
271
+ interface IAtomStsdHeader extends IVersionAndFlags {
272
+ numberOfEntries: number;
273
+ }
274
+ /**
275
+ * Atom: Sample Description Atom ('stsd')
276
+ */
277
+ export interface ISampleDescription {
278
+ dataFormat: string;
279
+ dataReferenceIndex: number;
280
+ description: Uint8Array;
281
+ }
282
+ export interface IAtomStsd {
283
+ header: IAtomStsdHeader;
284
+ table: ISampleDescription[];
285
+ }
286
+ /**
287
+ * Atom: Sample-description Atom ('stsd')
288
+ * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25691
289
+ */
290
+ export declare class StsdAtom implements IGetToken<IAtomStsd> {
291
+ len: number;
292
+ constructor(len: number);
293
+ get(buf: Buffer, off: number): IAtomStsd;
294
+ }
295
+ export interface ISoundSampleDescriptionVersion {
296
+ version: number;
297
+ revision: number;
298
+ vendor: number;
299
+ }
300
+ /**
301
+ * Common Sound Sample Description (version & revision)
302
+ * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-57317
303
+ */
304
+ export declare const SoundSampleDescriptionVersion: IGetToken<ISoundSampleDescriptionVersion>;
305
+ export interface ISoundSampleDescriptionV0 {
306
+ numAudioChannels: number;
307
+ /**
308
+ * Number of bits in each uncompressed sound sample
309
+ */
310
+ sampleSize: number;
311
+ /**
312
+ * Compression ID
313
+ */
314
+ compressionId: number;
315
+ packetSize: number;
316
+ sampleRate: number;
317
+ }
318
+ /**
319
+ * Sound Sample Description (Version 0)
320
+ * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-130736
321
+ */
322
+ export declare const SoundSampleDescriptionV0: IGetToken<ISoundSampleDescriptionV0>;
323
+ export interface ITableAtom<T> extends IVersionAndFlags {
324
+ numberOfEntries: number;
325
+ entries: T[];
326
+ }
327
+ declare class SimpleTableAtom<T> implements IGetToken<ITableAtom<T>> {
328
+ len: number;
329
+ private token;
330
+ constructor(len: number, token: IGetToken<T>);
331
+ get(buf: Buffer, off: number): ITableAtom<T>;
332
+ }
333
+ export interface ITimeToSampleToken {
334
+ count: number;
335
+ duration: number;
336
+ }
337
+ export declare const TimeToSampleToken: IGetToken<ITimeToSampleToken>;
338
+ /**
339
+ * Time-to-sample('stts') atom.
340
+ * Store duration information for a media’s samples.
341
+ * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25696
342
+ */
343
+ export declare class SttsAtom extends SimpleTableAtom<ITimeToSampleToken> {
344
+ len: number;
345
+ constructor(len: number);
346
+ }
347
+ /**
348
+ * Sample-to-Chunk ('stsc') atom table entry interface
349
+ */
350
+ export interface ISampleToChunk {
351
+ firstChunk: number;
352
+ samplesPerChunk: number;
353
+ sampleDescriptionId: number;
354
+ }
355
+ export declare const SampleToChunkToken: IGetToken<ISampleToChunk>;
356
+ /**
357
+ * Sample-to-Chunk ('stsc') atom interface
358
+ * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25706
359
+ */
360
+ export declare class StscAtom extends SimpleTableAtom<ISampleToChunk> {
361
+ len: number;
362
+ constructor(len: number);
363
+ }
364
+ /**
365
+ * Sample-size ('stsz') atom interface
366
+ */
367
+ export interface IStszAtom extends ITableAtom<number> {
368
+ sampleSize: number;
369
+ }
370
+ /**
371
+ * Sample-size ('stsz') atom
372
+ * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25710
373
+ */
374
+ export declare class StszAtom implements IGetToken<IStszAtom> {
375
+ len: number;
376
+ constructor(len: number);
377
+ get(buf: Buffer, off: number): IStszAtom;
378
+ }
379
+ /**
380
+ * Chunk offset atom, 'stco'
381
+ * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25715
382
+ */
383
+ export declare class StcoAtom extends SimpleTableAtom<number> {
384
+ len: number;
385
+ constructor(len: number);
386
+ }
387
+ /**
388
+ * Token used to decode text-track from 'mdat' atom (raw data stream)
389
+ */
390
+ export declare class ChapterText implements IGetToken<string> {
391
+ len: number;
392
+ constructor(len: number);
393
+ get(buf: Buffer, off: number): string;
394
+ }
395
+ export {};