music-metadata 11.10.4 → 11.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/asf/GUID.js DELETED
@@ -1,118 +0,0 @@
1
- import { hexToUint8Array, uint8ArrayToHex } from 'uint8array-extras';
2
- /**
3
- * Ref:
4
- * - https://tools.ietf.org/html/draft-fleischman-asf-01, Appendix A: ASF GUIDs
5
- * - http://drang.s4.xrea.com/program/tips/id3tag/wmp/10_asf_guids.html
6
- * - http://drang.s4.xrea.com/program/tips/id3tag/wmp/index.html
7
- * - http://drang.s4.xrea.com/program/tips/id3tag/wmp/10_asf_guids.html
8
- *
9
- * ASF File Structure:
10
- * - https://msdn.microsoft.com/en-us/library/windows/desktop/ee663575(v=vs.85).aspx
11
- *
12
- * ASF GUIDs:
13
- * - http://drang.s4.xrea.com/program/tips/id3tag/wmp/10_asf_guids.html
14
- * - https://github.com/dji-sdk/FFmpeg/blob/master/libavformat/asf.c
15
- */
16
- class GUID {
17
- static fromBin(bin, offset = 0) {
18
- return new GUID(GUID.decode(bin, offset));
19
- }
20
- /**
21
- * Decode GUID in format like "B503BF5F-2EA9-CF11-8EE3-00C00C205365"
22
- * @param objectId Binary GUID
23
- * @param offset Read offset in bytes, default 0
24
- * @returns GUID as dashed hexadecimal representation
25
- */
26
- static decode(objectId, offset = 0) {
27
- const view = new DataView(objectId.buffer, offset);
28
- const guid = `${view.getUint32(0, true).toString(16)}-${view.getUint16(4, true).toString(16)}-${view.getUint16(6, true).toString(16)}-${view.getUint16(8).toString(16)}-${uint8ArrayToHex(objectId.subarray(offset + 10, offset + 16))}`;
29
- return guid.toUpperCase();
30
- }
31
- /**
32
- * Decode stream type
33
- * @param mediaType Media type GUID
34
- * @returns Media type
35
- */
36
- static decodeMediaType(mediaType) {
37
- switch (mediaType.str) {
38
- case GUID.AudioMedia.str: return 'audio';
39
- case GUID.VideoMedia.str: return 'video';
40
- case GUID.CommandMedia.str: return 'command';
41
- case GUID.Degradable_JPEG_Media.str: return 'degradable-jpeg';
42
- case GUID.FileTransferMedia.str: return 'file-transfer';
43
- case GUID.BinaryMedia.str: return 'binary';
44
- }
45
- }
46
- /**
47
- * Encode GUID
48
- * @param guid GUID like: "B503BF5F-2EA9-CF11-8EE3-00C00C205365"
49
- * @returns Encoded Binary GUID
50
- */
51
- static encode(str) {
52
- const bin = new Uint8Array(16);
53
- const view = new DataView(bin.buffer);
54
- view.setUint32(0, Number.parseInt(str.substring(0, 8), 16), true);
55
- view.setUint16(4, Number.parseInt(str.substring(9, 13), 16), true);
56
- view.setUint16(6, Number.parseInt(str.substring(14, 18), 16), true);
57
- bin.set(hexToUint8Array(str.substring(19, 23)), 8);
58
- bin.set(hexToUint8Array(str.substring(24)), 10);
59
- return bin;
60
- }
61
- constructor(str) {
62
- this.str = str;
63
- }
64
- equals(guid) {
65
- return this.str === guid.str;
66
- }
67
- toBin() {
68
- return GUID.encode(this.str);
69
- }
70
- }
71
- // 10.1 Top-level ASF object GUIDs
72
- GUID.HeaderObject = new GUID("75B22630-668E-11CF-A6D9-00AA0062CE6C");
73
- GUID.DataObject = new GUID("75B22636-668E-11CF-A6D9-00AA0062CE6C");
74
- GUID.SimpleIndexObject = new GUID("33000890-E5B1-11CF-89F4-00A0C90349CB");
75
- GUID.IndexObject = new GUID("D6E229D3-35DA-11D1-9034-00A0C90349BE");
76
- GUID.MediaObjectIndexObject = new GUID("FEB103F8-12AD-4C64-840F-2A1D2F7AD48C");
77
- GUID.TimecodeIndexObject = new GUID("3CB73FD0-0C4A-4803-953D-EDF7B6228F0C");
78
- // 10.2 Header Object GUIDs
79
- GUID.FilePropertiesObject = new GUID("8CABDCA1-A947-11CF-8EE4-00C00C205365");
80
- GUID.StreamPropertiesObject = new GUID("B7DC0791-A9B7-11CF-8EE6-00C00C205365");
81
- GUID.HeaderExtensionObject = new GUID("5FBF03B5-A92E-11CF-8EE3-00C00C205365");
82
- GUID.CodecListObject = new GUID("86D15240-311D-11D0-A3A4-00A0C90348F6");
83
- GUID.ScriptCommandObject = new GUID("1EFB1A30-0B62-11D0-A39B-00A0C90348F6");
84
- GUID.MarkerObject = new GUID("F487CD01-A951-11CF-8EE6-00C00C205365");
85
- GUID.BitrateMutualExclusionObject = new GUID("D6E229DC-35DA-11D1-9034-00A0C90349BE");
86
- GUID.ErrorCorrectionObject = new GUID("75B22635-668E-11CF-A6D9-00AA0062CE6C");
87
- GUID.ContentDescriptionObject = new GUID("75B22633-668E-11CF-A6D9-00AA0062CE6C");
88
- GUID.ExtendedContentDescriptionObject = new GUID("D2D0A440-E307-11D2-97F0-00A0C95EA850");
89
- GUID.ContentBrandingObject = new GUID("2211B3FA-BD23-11D2-B4B7-00A0C955FC6E");
90
- GUID.StreamBitratePropertiesObject = new GUID("7BF875CE-468D-11D1-8D82-006097C9A2B2");
91
- GUID.ContentEncryptionObject = new GUID("2211B3FB-BD23-11D2-B4B7-00A0C955FC6E");
92
- GUID.ExtendedContentEncryptionObject = new GUID("298AE614-2622-4C17-B935-DAE07EE9289C");
93
- GUID.DigitalSignatureObject = new GUID("2211B3FC-BD23-11D2-B4B7-00A0C955FC6E");
94
- GUID.PaddingObject = new GUID("1806D474-CADF-4509-A4BA-9AABCB96AAE8");
95
- // 10.3 Header Extension Object GUIDs
96
- GUID.ExtendedStreamPropertiesObject = new GUID("14E6A5CB-C672-4332-8399-A96952065B5A");
97
- GUID.AdvancedMutualExclusionObject = new GUID("A08649CF-4775-4670-8A16-6E35357566CD");
98
- GUID.GroupMutualExclusionObject = new GUID("D1465A40-5A79-4338-B71B-E36B8FD6C249");
99
- GUID.StreamPrioritizationObject = new GUID("D4FED15B-88D3-454F-81F0-ED5C45999E24");
100
- GUID.BandwidthSharingObject = new GUID("A69609E6-517B-11D2-B6AF-00C04FD908E9");
101
- GUID.LanguageListObject = new GUID("7C4346A9-EFE0-4BFC-B229-393EDE415C85");
102
- GUID.MetadataObject = new GUID("C5F8CBEA-5BAF-4877-8467-AA8C44FA4CCA");
103
- GUID.MetadataLibraryObject = new GUID("44231C94-9498-49D1-A141-1D134E457054");
104
- GUID.IndexParametersObject = new GUID("D6E229DF-35DA-11D1-9034-00A0C90349BE");
105
- GUID.MediaObjectIndexParametersObject = new GUID("6B203BAD-3F11-48E4-ACA8-D7613DE2CFA7");
106
- GUID.TimecodeIndexParametersObject = new GUID("F55E496D-9797-4B5D-8C8B-604DFE9BFB24");
107
- GUID.CompatibilityObject = new GUID("26F18B5D-4584-47EC-9F5F-0E651F0452C9");
108
- GUID.AdvancedContentEncryptionObject = new GUID("43058533-6981-49E6-9B74-AD12CB86D58C");
109
- // 10.4 Stream Properties Object Stream Type GUIDs
110
- GUID.AudioMedia = new GUID("F8699E40-5B4D-11CF-A8FD-00805F5C442B");
111
- GUID.VideoMedia = new GUID("BC19EFC0-5B4D-11CF-A8FD-00805F5C442B");
112
- GUID.CommandMedia = new GUID("59DACFC0-59E6-11D0-A3AC-00A0C90348F6");
113
- GUID.JFIF_Media = new GUID("B61BE100-5B4E-11CF-A8FD-00805F5C442B");
114
- GUID.Degradable_JPEG_Media = new GUID("35907DE0-E415-11CF-A917-00805F5C442B");
115
- GUID.FileTransferMedia = new GUID("91BD222C-F21C-497A-8B6D-5AA86BFC0185");
116
- GUID.BinaryMedia = new GUID("3AFB65E2-47EF-40F2-AC2C-70A90D71D343");
117
- GUID.ASF_Index_Placeholder_Object = new GUID("D9AADE20-7C17-4F9C-BC28-8555DD98E2A2");
118
- export default GUID;