1
|
|
|
/* |
2
|
|
|
* Copyright (c) 2020 Rafael da Silva Rocha. |
3
|
|
|
* |
4
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining |
5
|
|
|
* a copy of this software and associated documentation files (the |
6
|
|
|
* "Software"), to deal in the Software without restriction, including |
7
|
|
|
* without limitation the rights to use, copy, modify, merge, publish, |
8
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to |
9
|
|
|
* permit persons to whom the Software is furnished to do so, subject to |
10
|
|
|
* the following conditions: |
11
|
|
|
* |
12
|
|
|
* The above copyright notice and this permission notice shall be |
13
|
|
|
* included in all copies or substantial portions of the Software. |
14
|
|
|
* |
15
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
16
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
17
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
18
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
19
|
|
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
20
|
|
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21
|
|
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22
|
|
|
* |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @fileoverview Externs for riff-file 1.0 |
27
|
|
|
* @see https://github.com/rochars/riff-file |
28
|
|
|
* @externs |
29
|
|
|
*/ |
30
|
|
|
|
31
|
|
|
// riffFile module |
32
|
|
|
var riffFile = {}; |
33
|
|
|
|
34
|
|
|
// RIFFFile class |
35
|
|
|
var RIFFFile = {}; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* The container identifier. |
39
|
|
|
* 'RIFF', 'RIFX' and 'RF64' are supported. |
40
|
|
|
* @type {string} |
41
|
|
|
*/ |
42
|
|
|
RIFFFile.prototype.container = ''; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* The main chunk size, in bytes. |
46
|
|
|
* @type {number} |
47
|
|
|
*/ |
48
|
|
|
RIFFFile.prototype.chunkSize = 0; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* The format identifier. |
52
|
|
|
* @type {string} |
53
|
|
|
*/ |
54
|
|
|
RIFFFile.prototype.format = ''; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* An object representing the signature of all chunks in the file. |
58
|
|
|
* @type {!Object} |
59
|
|
|
*/ |
60
|
|
|
RIFFFile.prototype.signature = {}; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @type {number} |
64
|
|
|
* @protected |
65
|
|
|
*/ |
66
|
|
|
RIFFFile.prototype.head = 0; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @type { |
70
|
|
|
{bits: number, be: boolean, signed: boolean, fp: boolean} |
71
|
|
|
} |
72
|
|
|
* @protected |
73
|
|
|
*/ |
74
|
|
|
RIFFFile.prototype.uInt32 = { bits: 32, be: false, signed: false, fp: false }; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* The list of supported containers. |
78
|
|
|
* Any format different from RIFX will be treated as RIFF. |
79
|
|
|
* @type {!Array<string>} |
80
|
|
|
* @protected |
81
|
|
|
*/ |
82
|
|
|
RIFFFile.prototype.supported_containers = ['RIFF', 'RIFX']; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Read the signature of the chunks in a RIFF/RIFX file. |
86
|
|
|
* @param {!Uint8Array} buffer The file bytes. |
87
|
|
|
* @protected |
88
|
|
|
*/ |
89
|
|
|
RIFFFile.prototype.setSignature = function(buffer) {}; |
|
|
|
|
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Find a chunk by its fourCC_ in a array of RIFF chunks. |
93
|
|
|
* @param {string} chunkId The chunk fourCC_. |
94
|
|
|
* @param {boolean} multiple True if there may be multiple chunks |
95
|
|
|
* with the same chunkId. |
96
|
|
|
* @return {Object} |
97
|
|
|
* @protected |
98
|
|
|
*/ |
99
|
|
|
RIFFFile.prototype.findChunk = function(chunkId, multiple=false) {}; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Read bytes as a string from a RIFF chunk. |
103
|
|
|
* @param {!Uint8Array} bytes The bytes. |
104
|
|
|
* @param {number} maxSize the max size of the string. |
105
|
|
|
* @return {string} The string. |
106
|
|
|
* @protected |
107
|
|
|
*/ |
108
|
|
|
RIFFFile.prototype.readString = function(bytes, maxSize) {}; |
|
|
|
|
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Read a number from a chunk. |
112
|
|
|
* @param {!Uint8Array} bytes The chunk bytes. |
113
|
|
|
* @return {number} The number. |
114
|
|
|
* @protected |
115
|
|
|
*/ |
116
|
|
|
RIFFFile.prototype.readUInt32 = function(bytes) {}; |
|
|
|
|
117
|
|
|
|
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.