music-metadata 7.11.7 → 7.11.8

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 +433 -432
  2. package/lib/ParserFactory.d.ts +48 -49
  3. package/lib/ParserFactory.js +251 -251
  4. package/lib/aiff/AiffParser.d.ts +14 -15
  5. package/lib/aiff/AiffParser.js +84 -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 +161 -162
  10. package/lib/apev2/APEv2TagMapper.d.ts +4 -4
  11. package/lib/apev2/APEv2TagMapper.js +86 -86
  12. package/lib/apev2/APEv2Token.d.ts +100 -100
  13. package/lib/apev2/APEv2Token.js +126 -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 +95 -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 +84 -86
  23. package/lib/asf/GUID.js +121 -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 +21 -21
  28. package/lib/common/CombinedTagMapper.d.ts +19 -19
  29. package/lib/common/CombinedTagMapper.js +51 -51
  30. package/lib/common/FourCC.d.ts +6 -6
  31. package/lib/common/FourCC.js +28 -28
  32. package/lib/common/GenericTagMapper.d.ts +51 -51
  33. package/lib/common/GenericTagMapper.js +55 -55
  34. package/lib/common/GenericTagTypes.d.ts +33 -33
  35. package/lib/common/GenericTagTypes.js +131 -131
  36. package/lib/common/MetadataCollector.d.ts +76 -76
  37. package/lib/common/MetadataCollector.js +275 -275
  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 -58
  43. package/lib/common/Util.js +157 -162
  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 +22 -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 -329
  64. package/lib/id3v2/ID3v22TagMapper.d.ts +9 -9
  65. package/lib/id3v2/ID3v22TagMapper.js +55 -55
  66. package/lib/id3v2/ID3v24TagMapper.d.ts +14 -14
  67. package/lib/id3v2/ID3v24TagMapper.js +193 -193
  68. package/lib/id3v2/ID3v2Parser.d.ts +29 -29
  69. package/lib/id3v2/ID3v2Parser.js +184 -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 -45
  75. package/lib/index.js +74 -74
  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 -235
  82. package/lib/matroska/MatroskaTagMapper.d.ts +4 -4
  83. package/lib/matroska/MatroskaTagMapper.js +35 -35
  84. package/lib/matroska/types.d.ts +175 -175
  85. package/lib/matroska/types.js +33 -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 +115 -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 +524 -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 +69 -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 +132 -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 +37 -37
  142. package/lib/type.d.ts +592 -599
  143. package/lib/type.js +5 -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 +99 -105
  150. package/lib/wavpack/WavPackToken.d.ts +64 -64
  151. package/lib/wavpack/WavPackToken.js +76 -76
  152. package/package.json +150 -142
@@ -1,319 +1,319 @@
1
- /// <reference types="node" />
2
- import { IGetToken, ITokenizer } from 'strtok3/lib/core';
3
- import { IPicture, ITag } from '../type';
4
- import GUID from './GUID';
5
- /**
6
- * Data Type: Specifies the type of information being stored. The following values are recognized.
7
- */
8
- export declare enum DataType {
9
- /**
10
- * Unicode string. The data consists of a sequence of Unicode characters.
11
- */
12
- UnicodeString = 0,
13
- /**
14
- * BYTE array. The type of data is implementation-specific.
15
- */
16
- ByteArray = 1,
17
- /**
18
- * BOOL. The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer. Only 0x0000 or 0x0001 are permitted values.
19
- */
20
- Bool = 2,
21
- /**
22
- * DWORD. The data is 4 bytes long and should be interpreted as a 32-bit unsigned integer.
23
- */
24
- DWord = 3,
25
- /**
26
- * QWORD. The data is 8 bytes long and should be interpreted as a 64-bit unsigned integer.
27
- */
28
- QWord = 4,
29
- /**
30
- * WORD. The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer.
31
- */
32
- Word = 5
33
- }
34
- /**
35
- * Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/ee663575
36
- */
37
- export interface IAsfObjectHeader {
38
- /**
39
- * A GUID that identifies the object. 128 bits
40
- */
41
- objectId: GUID;
42
- /**
43
- * The size of the object (64-bits)
44
- */
45
- objectSize: number;
46
- }
47
- /**
48
- * Interface for: 3. ASF top-level Header Object
49
- * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3
50
- */
51
- export interface IAsfTopLevelObjectHeader extends IAsfObjectHeader {
52
- numberOfHeaderObjects: number;
53
- }
54
- /**
55
- * Token for: 3. ASF top-level Header Object
56
- * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3
57
- */
58
- export declare const TopLevelHeaderObjectToken: IGetToken<IAsfTopLevelObjectHeader, Buffer>;
59
- /**
60
- * Token for: 3.1 Header Object (mandatory, one only)
61
- * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_1
62
- */
63
- export declare const HeaderObjectToken: IGetToken<IAsfObjectHeader, Buffer>;
64
- export declare abstract class State<T> implements IGetToken<T> {
65
- len: number;
66
- constructor(header: IAsfObjectHeader);
67
- abstract get(buf: Buffer, off: number): T;
68
- protected postProcessTag(tags: ITag[], name: string, valueType: number, data: any): void;
69
- }
70
- export declare class IgnoreObjectState extends State<any> {
71
- constructor(header: IAsfObjectHeader);
72
- get(buf: Buffer, off: number): null;
73
- }
74
- /**
75
- * Interface for: 3.2: File Properties Object (mandatory, one only)
76
- *
77
- * The File Properties Object defines the global characteristics of the combined digital media streams found within the Data Object.
78
- */
79
- export interface IFilePropertiesObject {
80
- /**
81
- * Specifies the unique identifier for this file.
82
- * The value of this field shall be regenerated every time the file is modified in any way.
83
- * The value of this field shall be identical to the value of the File ID field of the Data Object.
84
- */
85
- fileId: GUID;
86
- /**
87
- * Specifies the size, in bytes, of the entire file.
88
- * The value of this field is invalid if the Broadcast Flag bit in the Flags field is set to 1.
89
- */
90
- fileSize: bigint;
91
- /**
92
- * Specifies the date and time of the initial creation of the file. The value is given as the number of 100-nanosecond
93
- * intervals since January 1, 1601, according to Coordinated Universal Time (Greenwich Mean Time). The value of this
94
- * field may be invalid if the Broadcast Flag bit in the Flags field is set to 1.
95
- */
96
- creationDate: bigint;
97
- /**
98
- * Specifies the number of Data Packet entries that exist within the Data Object. The value of this field is invalid
99
- * if the Broadcast Flag bit in the Flags field is set to 1.
100
- */
101
- dataPacketsCount: bigint;
102
- /**
103
- * Specifies the time needed to play the file in 100-nanosecond units.
104
- * This value should include the duration (estimated, if an exact value is unavailable) of the the last media object
105
- * in the presentation. The value of this field is invalid if the Broadcast Flag bit in the Flags field is set to 1.
106
- */
107
- playDuration: bigint;
108
- /**
109
- * Specifies the time needed to send the file in 100-nanosecond units.
110
- * This value should include the duration of the last packet in the content.
111
- * The value of this field is invalid if the Broadcast Flag bit in the Flags field is set to 1.
112
- * Players can ignore this value.
113
- */
114
- sendDuration: bigint;
115
- /**
116
- * Specifies the amount of time to buffer data before starting to play the file, in millisecond units.
117
- * If this value is nonzero, the Play Duration field and all of the payload Presentation Time fields have been offset
118
- * by this amount. Therefore, player software must subtract the value in the preroll field from the play duration and
119
- * presentation times to calculate their actual values. It follows that all payload Presentation Time fields need to
120
- * be at least this value.
121
- */
122
- preroll: bigint;
123
- /**
124
- * The flags
125
- */
126
- flags: {
127
- /**
128
- * Specifies, if set, that a file is in the process of being created (for example, for recording applications),
129
- * and thus that various values stored in the header objects are invalid. It is highly recommended that
130
- * post-processing be performed to remove this condition at the earliest opportunity.
131
- */
132
- broadcast: boolean;
133
- /**
134
- * Specifies, if set, that a file is seekable.
135
- * Note that for files containing a single audio stream and a Minimum Data Packet Size field equal to the Maximum
136
- * Data Packet Size field, this flag shall always be set to 1.
137
- * For files containing a single audio stream and a video stream or mutually exclusive video streams,
138
- * this flag is only set to 1 if the file contains a matching Simple Index Object for each regular video stream
139
- * (that is, video streams that are not hidden according to the method described in section 8.2.2).
140
- */
141
- seekable: boolean;
142
- };
143
- /**
144
- * Specifies the minimum Data Packet size in bytes. In general, the value of this field is invalid if the Broadcast
145
- * Flag bit in the Flags field is set to 1.
146
- * However, for the purposes of this specification, the values for the Minimum Data Packet Size and Maximum Data
147
- * Packet Size fields shall be set to the same value, and this value should be set to the packet size, even when the
148
- * Broadcast Flag in the Flags field is set to 1.
149
- */
150
- minimumDataPacketSize: number;
151
- /**
152
- * Specifies the maximum Data Packet size in bytes.
153
- * In general, the value of this field is invalid if the Broadcast Flag bit in the Flags field is set to 1.
154
- * However, for the purposes of this specification, the values of the Minimum Data Packet Size and Maximum Data Packet
155
- * Size fields shall be set to the same value,
156
- * and this value should be set to the packet size, even when the Broadcast Flag field is set to 1.
157
- */
158
- maximumDataPacketSize: number;
159
- /**
160
- * Specifies the maximum instantaneous bit rate in bits per second for the entire file.
161
- * This shall equal the sum of the bit rates of the individual digital media streams.
162
- * It shall be noted that the digital media stream includes ASF data packetization overhead as well as digital media
163
- * data in payloads.
164
- * Only those streams that have a free-standing Stream Properties Object in the header shall have their bit rates
165
- * included in the sum;
166
- * streams whose Stream Properties Object exists as part of an Extended Stream Properties Object in the Header
167
- * Extension Object shall not have their bit rates included in this sum, except when this value would otherwise be 0.
168
- */
169
- maximumBitrate: number;
170
- }
171
- /**
172
- * Token for: 3.2: File Properties Object (mandatory, one only)
173
- * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_2
174
- */
175
- export declare class FilePropertiesObject extends State<IFilePropertiesObject> {
176
- static guid: GUID;
177
- constructor(header: IAsfObjectHeader);
178
- get(buf: Buffer, off: number): IFilePropertiesObject;
179
- }
180
- /**
181
- * Interface for: 3.3 Stream Properties Object (mandatory, one per stream)
182
- */
183
- export interface IStreamPropertiesObject {
184
- /**
185
- * Stream Type
186
- */
187
- streamType: string;
188
- /**
189
- * Error Correction Type
190
- */
191
- errorCorrectionType: GUID;
192
- }
193
- /**
194
- * Token for: 3.3 Stream Properties Object (mandatory, one per stream)
195
- * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_3
196
- */
197
- export declare class StreamPropertiesObject extends State<IStreamPropertiesObject> {
198
- static guid: GUID;
199
- constructor(header: IAsfObjectHeader);
200
- get(buf: Buffer, off: number): IStreamPropertiesObject;
201
- }
202
- export interface IHeaderExtensionObject {
203
- reserved1: GUID;
204
- reserved2: number;
205
- extensionDataSize: number;
206
- }
207
- /**
208
- * 3.4: Header Extension Object (mandatory, one only)
209
- * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_4
210
- */
211
- export declare class HeaderExtensionObject implements IGetToken<IHeaderExtensionObject> {
212
- static guid: GUID;
213
- len: number;
214
- constructor();
215
- get(buf: Buffer, off: number): IHeaderExtensionObject;
216
- }
217
- export interface ICodecEntry {
218
- type: {
219
- videoCodec: boolean;
220
- audioCodec: boolean;
221
- };
222
- codecName: string;
223
- description: string;
224
- information: Buffer;
225
- }
226
- /**
227
- * 3.5: Read the Codec-List-Object, which provides user-friendly information about the codecs and formats used to encode the content found in the ASF file.
228
- * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_5
229
- */
230
- export declare function readCodecEntries(tokenizer: ITokenizer): Promise<ICodecEntry[]>;
231
- /**
232
- * 3.10 Content Description Object (optional, one only)
233
- * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_10
234
- */
235
- export declare class ContentDescriptionObjectState extends State<ITag[]> {
236
- static guid: GUID;
237
- private static contentDescTags;
238
- constructor(header: IAsfObjectHeader);
239
- get(buf: Buffer, off: number): ITag[];
240
- }
241
- /**
242
- * 3.11 Extended Content Description Object (optional, one only)
243
- * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_11
244
- */
245
- export declare class ExtendedContentDescriptionObjectState extends State<ITag[]> {
246
- static guid: GUID;
247
- constructor(header: IAsfObjectHeader);
248
- get(buf: Buffer, off: number): ITag[];
249
- }
250
- export interface IStreamName {
251
- streamLanguageId: number;
252
- streamName: string;
253
- }
254
- /**
255
- * 4.1 Extended Stream Properties Object (optional, 1 per media stream)
256
- * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/04_objects_in_the_asf_header_extension_object.html#4_1
257
- */
258
- export interface IExtendedStreamPropertiesObject {
259
- startTime: bigint;
260
- endTime: bigint;
261
- dataBitrate: number;
262
- bufferSize: number;
263
- initialBufferFullness: number;
264
- alternateDataBitrate: number;
265
- alternateBufferSize: number;
266
- alternateInitialBufferFullness: number;
267
- maximumObjectSize: number;
268
- flags: {
269
- reliableFlag: boolean;
270
- seekableFlag: boolean;
271
- resendLiveCleanpointsFlag: boolean;
272
- };
273
- streamNumber: number;
274
- streamLanguageId: number;
275
- averageTimePerFrame: number;
276
- streamNameCount: number;
277
- payloadExtensionSystems: number;
278
- streamNames: IStreamName[];
279
- streamPropertiesObject: number;
280
- }
281
- /**
282
- * 4.1 Extended Stream Properties Object (optional, 1 per media stream)
283
- * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/04_objects_in_the_asf_header_extension_object.html#4_1
284
- */
285
- export declare class ExtendedStreamPropertiesObjectState extends State<IExtendedStreamPropertiesObject> {
286
- static guid: GUID;
287
- constructor(header: IAsfObjectHeader);
288
- get(buf: Buffer, off: number): IExtendedStreamPropertiesObject;
289
- }
290
- /**
291
- * 4.7 Metadata Object (optional, 0 or 1)
292
- * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/04_objects_in_the_asf_header_extension_object.html#4_7
293
- */
294
- export declare class MetadataObjectState extends State<ITag[]> {
295
- static guid: GUID;
296
- constructor(header: IAsfObjectHeader);
297
- get(buf: Buffer, off: number): ITag[];
298
- }
299
- export declare class MetadataLibraryObjectState extends MetadataObjectState {
300
- static guid: GUID;
301
- constructor(header: IAsfObjectHeader);
302
- }
303
- export interface IWmPicture extends IPicture {
304
- type: string;
305
- format: string;
306
- description: string;
307
- size: number;
308
- data: Buffer;
309
- }
310
- /**
311
- * Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd757977(v=vs.85).aspx
312
- */
313
- export declare class WmPictureToken implements IGetToken<IWmPicture> {
314
- len: any;
315
- static fromBase64(base64str: string): IPicture;
316
- static fromBuffer(buffer: Buffer): IWmPicture;
317
- constructor(len: any);
318
- get(buffer: Buffer, offset: number): IWmPicture;
319
- }
1
+ /// <reference types="node" />
2
+ import { IGetToken, ITokenizer } from 'strtok3/lib/core';
3
+ import { IPicture, ITag } from '../type';
4
+ import GUID from './GUID';
5
+ /**
6
+ * Data Type: Specifies the type of information being stored. The following values are recognized.
7
+ */
8
+ export declare enum DataType {
9
+ /**
10
+ * Unicode string. The data consists of a sequence of Unicode characters.
11
+ */
12
+ UnicodeString = 0,
13
+ /**
14
+ * BYTE array. The type of data is implementation-specific.
15
+ */
16
+ ByteArray = 1,
17
+ /**
18
+ * BOOL. The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer. Only 0x0000 or 0x0001 are permitted values.
19
+ */
20
+ Bool = 2,
21
+ /**
22
+ * DWORD. The data is 4 bytes long and should be interpreted as a 32-bit unsigned integer.
23
+ */
24
+ DWord = 3,
25
+ /**
26
+ * QWORD. The data is 8 bytes long and should be interpreted as a 64-bit unsigned integer.
27
+ */
28
+ QWord = 4,
29
+ /**
30
+ * WORD. The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer.
31
+ */
32
+ Word = 5
33
+ }
34
+ /**
35
+ * Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/ee663575
36
+ */
37
+ export interface IAsfObjectHeader {
38
+ /**
39
+ * A GUID that identifies the object. 128 bits
40
+ */
41
+ objectId: GUID;
42
+ /**
43
+ * The size of the object (64-bits)
44
+ */
45
+ objectSize: number;
46
+ }
47
+ /**
48
+ * Interface for: 3. ASF top-level Header Object
49
+ * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3
50
+ */
51
+ export interface IAsfTopLevelObjectHeader extends IAsfObjectHeader {
52
+ numberOfHeaderObjects: number;
53
+ }
54
+ /**
55
+ * Token for: 3. ASF top-level Header Object
56
+ * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3
57
+ */
58
+ export declare const TopLevelHeaderObjectToken: IGetToken<IAsfTopLevelObjectHeader, Buffer>;
59
+ /**
60
+ * Token for: 3.1 Header Object (mandatory, one only)
61
+ * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_1
62
+ */
63
+ export declare const HeaderObjectToken: IGetToken<IAsfObjectHeader, Buffer>;
64
+ export declare abstract class State<T> implements IGetToken<T> {
65
+ len: number;
66
+ constructor(header: IAsfObjectHeader);
67
+ abstract get(buf: Buffer, off: number): T;
68
+ protected postProcessTag(tags: ITag[], name: string, valueType: number, data: any): void;
69
+ }
70
+ export declare class IgnoreObjectState extends State<any> {
71
+ constructor(header: IAsfObjectHeader);
72
+ get(buf: Buffer, off: number): null;
73
+ }
74
+ /**
75
+ * Interface for: 3.2: File Properties Object (mandatory, one only)
76
+ *
77
+ * The File Properties Object defines the global characteristics of the combined digital media streams found within the Data Object.
78
+ */
79
+ export interface IFilePropertiesObject {
80
+ /**
81
+ * Specifies the unique identifier for this file.
82
+ * The value of this field shall be regenerated every time the file is modified in any way.
83
+ * The value of this field shall be identical to the value of the File ID field of the Data Object.
84
+ */
85
+ fileId: GUID;
86
+ /**
87
+ * Specifies the size, in bytes, of the entire file.
88
+ * The value of this field is invalid if the Broadcast Flag bit in the Flags field is set to 1.
89
+ */
90
+ fileSize: bigint;
91
+ /**
92
+ * Specifies the date and time of the initial creation of the file. The value is given as the number of 100-nanosecond
93
+ * intervals since January 1, 1601, according to Coordinated Universal Time (Greenwich Mean Time). The value of this
94
+ * field may be invalid if the Broadcast Flag bit in the Flags field is set to 1.
95
+ */
96
+ creationDate: bigint;
97
+ /**
98
+ * Specifies the number of Data Packet entries that exist within the Data Object. The value of this field is invalid
99
+ * if the Broadcast Flag bit in the Flags field is set to 1.
100
+ */
101
+ dataPacketsCount: bigint;
102
+ /**
103
+ * Specifies the time needed to play the file in 100-nanosecond units.
104
+ * This value should include the duration (estimated, if an exact value is unavailable) of the the last media object
105
+ * in the presentation. The value of this field is invalid if the Broadcast Flag bit in the Flags field is set to 1.
106
+ */
107
+ playDuration: bigint;
108
+ /**
109
+ * Specifies the time needed to send the file in 100-nanosecond units.
110
+ * This value should include the duration of the last packet in the content.
111
+ * The value of this field is invalid if the Broadcast Flag bit in the Flags field is set to 1.
112
+ * Players can ignore this value.
113
+ */
114
+ sendDuration: bigint;
115
+ /**
116
+ * Specifies the amount of time to buffer data before starting to play the file, in millisecond units.
117
+ * If this value is nonzero, the Play Duration field and all of the payload Presentation Time fields have been offset
118
+ * by this amount. Therefore, player software must subtract the value in the preroll field from the play duration and
119
+ * presentation times to calculate their actual values. It follows that all payload Presentation Time fields need to
120
+ * be at least this value.
121
+ */
122
+ preroll: bigint;
123
+ /**
124
+ * The flags
125
+ */
126
+ flags: {
127
+ /**
128
+ * Specifies, if set, that a file is in the process of being created (for example, for recording applications),
129
+ * and thus that various values stored in the header objects are invalid. It is highly recommended that
130
+ * post-processing be performed to remove this condition at the earliest opportunity.
131
+ */
132
+ broadcast: boolean;
133
+ /**
134
+ * Specifies, if set, that a file is seekable.
135
+ * Note that for files containing a single audio stream and a Minimum Data Packet Size field equal to the Maximum
136
+ * Data Packet Size field, this flag shall always be set to 1.
137
+ * For files containing a single audio stream and a video stream or mutually exclusive video streams,
138
+ * this flag is only set to 1 if the file contains a matching Simple Index Object for each regular video stream
139
+ * (that is, video streams that are not hidden according to the method described in section 8.2.2).
140
+ */
141
+ seekable: boolean;
142
+ };
143
+ /**
144
+ * Specifies the minimum Data Packet size in bytes. In general, the value of this field is invalid if the Broadcast
145
+ * Flag bit in the Flags field is set to 1.
146
+ * However, for the purposes of this specification, the values for the Minimum Data Packet Size and Maximum Data
147
+ * Packet Size fields shall be set to the same value, and this value should be set to the packet size, even when the
148
+ * Broadcast Flag in the Flags field is set to 1.
149
+ */
150
+ minimumDataPacketSize: number;
151
+ /**
152
+ * Specifies the maximum Data Packet size in bytes.
153
+ * In general, the value of this field is invalid if the Broadcast Flag bit in the Flags field is set to 1.
154
+ * However, for the purposes of this specification, the values of the Minimum Data Packet Size and Maximum Data Packet
155
+ * Size fields shall be set to the same value,
156
+ * and this value should be set to the packet size, even when the Broadcast Flag field is set to 1.
157
+ */
158
+ maximumDataPacketSize: number;
159
+ /**
160
+ * Specifies the maximum instantaneous bit rate in bits per second for the entire file.
161
+ * This shall equal the sum of the bit rates of the individual digital media streams.
162
+ * It shall be noted that the digital media stream includes ASF data packetization overhead as well as digital media
163
+ * data in payloads.
164
+ * Only those streams that have a free-standing Stream Properties Object in the header shall have their bit rates
165
+ * included in the sum;
166
+ * streams whose Stream Properties Object exists as part of an Extended Stream Properties Object in the Header
167
+ * Extension Object shall not have their bit rates included in this sum, except when this value would otherwise be 0.
168
+ */
169
+ maximumBitrate: number;
170
+ }
171
+ /**
172
+ * Token for: 3.2: File Properties Object (mandatory, one only)
173
+ * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_2
174
+ */
175
+ export declare class FilePropertiesObject extends State<IFilePropertiesObject> {
176
+ static guid: GUID;
177
+ constructor(header: IAsfObjectHeader);
178
+ get(buf: Buffer, off: number): IFilePropertiesObject;
179
+ }
180
+ /**
181
+ * Interface for: 3.3 Stream Properties Object (mandatory, one per stream)
182
+ */
183
+ export interface IStreamPropertiesObject {
184
+ /**
185
+ * Stream Type
186
+ */
187
+ streamType: string;
188
+ /**
189
+ * Error Correction Type
190
+ */
191
+ errorCorrectionType: GUID;
192
+ }
193
+ /**
194
+ * Token for: 3.3 Stream Properties Object (mandatory, one per stream)
195
+ * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_3
196
+ */
197
+ export declare class StreamPropertiesObject extends State<IStreamPropertiesObject> {
198
+ static guid: GUID;
199
+ constructor(header: IAsfObjectHeader);
200
+ get(buf: Buffer, off: number): IStreamPropertiesObject;
201
+ }
202
+ export interface IHeaderExtensionObject {
203
+ reserved1: GUID;
204
+ reserved2: number;
205
+ extensionDataSize: number;
206
+ }
207
+ /**
208
+ * 3.4: Header Extension Object (mandatory, one only)
209
+ * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_4
210
+ */
211
+ export declare class HeaderExtensionObject implements IGetToken<IHeaderExtensionObject> {
212
+ static guid: GUID;
213
+ len: number;
214
+ constructor();
215
+ get(buf: Buffer, off: number): IHeaderExtensionObject;
216
+ }
217
+ export interface ICodecEntry {
218
+ type: {
219
+ videoCodec: boolean;
220
+ audioCodec: boolean;
221
+ };
222
+ codecName: string;
223
+ description: string;
224
+ information: Buffer;
225
+ }
226
+ /**
227
+ * 3.5: Read the Codec-List-Object, which provides user-friendly information about the codecs and formats used to encode the content found in the ASF file.
228
+ * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_5
229
+ */
230
+ export declare function readCodecEntries(tokenizer: ITokenizer): Promise<ICodecEntry[]>;
231
+ /**
232
+ * 3.10 Content Description Object (optional, one only)
233
+ * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_10
234
+ */
235
+ export declare class ContentDescriptionObjectState extends State<ITag[]> {
236
+ static guid: GUID;
237
+ private static contentDescTags;
238
+ constructor(header: IAsfObjectHeader);
239
+ get(buf: Buffer, off: number): ITag[];
240
+ }
241
+ /**
242
+ * 3.11 Extended Content Description Object (optional, one only)
243
+ * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/03_asf_top_level_header_object.html#3_11
244
+ */
245
+ export declare class ExtendedContentDescriptionObjectState extends State<ITag[]> {
246
+ static guid: GUID;
247
+ constructor(header: IAsfObjectHeader);
248
+ get(buf: Buffer, off: number): ITag[];
249
+ }
250
+ export interface IStreamName {
251
+ streamLanguageId: number;
252
+ streamName: string;
253
+ }
254
+ /**
255
+ * 4.1 Extended Stream Properties Object (optional, 1 per media stream)
256
+ * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/04_objects_in_the_asf_header_extension_object.html#4_1
257
+ */
258
+ export interface IExtendedStreamPropertiesObject {
259
+ startTime: bigint;
260
+ endTime: bigint;
261
+ dataBitrate: number;
262
+ bufferSize: number;
263
+ initialBufferFullness: number;
264
+ alternateDataBitrate: number;
265
+ alternateBufferSize: number;
266
+ alternateInitialBufferFullness: number;
267
+ maximumObjectSize: number;
268
+ flags: {
269
+ reliableFlag: boolean;
270
+ seekableFlag: boolean;
271
+ resendLiveCleanpointsFlag: boolean;
272
+ };
273
+ streamNumber: number;
274
+ streamLanguageId: number;
275
+ averageTimePerFrame: number;
276
+ streamNameCount: number;
277
+ payloadExtensionSystems: number;
278
+ streamNames: IStreamName[];
279
+ streamPropertiesObject: number;
280
+ }
281
+ /**
282
+ * 4.1 Extended Stream Properties Object (optional, 1 per media stream)
283
+ * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/04_objects_in_the_asf_header_extension_object.html#4_1
284
+ */
285
+ export declare class ExtendedStreamPropertiesObjectState extends State<IExtendedStreamPropertiesObject> {
286
+ static guid: GUID;
287
+ constructor(header: IAsfObjectHeader);
288
+ get(buf: Buffer, off: number): IExtendedStreamPropertiesObject;
289
+ }
290
+ /**
291
+ * 4.7 Metadata Object (optional, 0 or 1)
292
+ * Ref: http://drang.s4.xrea.com/program/tips/id3tag/wmp/04_objects_in_the_asf_header_extension_object.html#4_7
293
+ */
294
+ export declare class MetadataObjectState extends State<ITag[]> {
295
+ static guid: GUID;
296
+ constructor(header: IAsfObjectHeader);
297
+ get(buf: Buffer, off: number): ITag[];
298
+ }
299
+ export declare class MetadataLibraryObjectState extends MetadataObjectState {
300
+ static guid: GUID;
301
+ constructor(header: IAsfObjectHeader);
302
+ }
303
+ export interface IWmPicture extends IPicture {
304
+ type: string;
305
+ format: string;
306
+ description: string;
307
+ size: number;
308
+ data: Buffer;
309
+ }
310
+ /**
311
+ * Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd757977(v=vs.85).aspx
312
+ */
313
+ export declare class WmPictureToken implements IGetToken<IWmPicture> {
314
+ len: any;
315
+ static fromBase64(base64str: string): IPicture;
316
+ static fromBuffer(buffer: Buffer): IWmPicture;
317
+ constructor(len: any);
318
+ get(buffer: Buffer, offset: number): IWmPicture;
319
+ }