-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathdecode.html
More file actions
184 lines (159 loc) · 6.36 KB
/
Copy pathdecode.html
File metadata and controls
184 lines (159 loc) · 6.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<!-- doctype html -->
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>DECODE: FLAC to WAV conversion</title>
<!--
preparing to load the libflac.js library:
* set custom location/path to FLAC_SCRIPT_LOCATION:
needs to be the same paths as the library script, so that the library can
find additional files that it needs to load
* detect support for WebAssembly:
if supported, use wasm library, otherwise the fallback asm.js library
-->
<script src="util/check-params.js" type="text/javascript"></script>
<script src="util/check-support.js" type="text/javascript"></script>
<script src="util/load-script.js" type="text/javascript"></script>
<script type="text/javascript">
var demoType = 'decode';
var global = window;
// check search-param "lib", i.e. "?lib=<variant>":
// -> set different library variants: 'min' | 'dev' | '' (default)
var variant = getLibVariantPathParam();
global.FLAC_SCRIPT_LOCATION = '../dist/';
//check search-param "wasm", if not using WebAssembly should be forced, even if would be supported
var wasmDisable = getDisableWebAssembly();
var lib;
if(!wasmDisable && isWebAssemblySupported()){
lib = 'libflac.'+variant.replace('/', '.')+'wasm.js';
} else {
lib = 'libflac.'+variant.replace('/', '.')+'js';
}
var libFile = global.FLAC_SCRIPT_LOCATION.replace('//','/') + lib;
// load libflac.js library variant and demo scripts after document was loaded:
global.onload = function(){
loadScripts([libFile, demoType+'-func.js', 'util/download-util.js', 'util/data-util.js', 'util/file-handler.js', 'app-'+demoType+'.js'], function(err){
console[err? 'error' : 'info'](err? 'encountered error '+err : 'scripts initialized successfully');
});
};
</script>
<style>
.project-link {
float: right;
}
.drop-zone {
border: 1px red solid;
height: 250px;
}
.drop-hint {
text-align: center;
padding-top: 100px;
}
.hint {
background-color: #C6E7FF;
color: #0094FF;
border-radius: 50%;
height: 1em;
width: 1em;
display: inline-block;
}
.hint:before {
content: ' ? ';
margin-left: 0.25em;
}
.hint.info:before {
content: ' i ';
margin-left: 0.25em;
}
</style>
</head>
<body>
<div>
<div class="project-link">Demo for <a href="https://github.com/mmig/libflac.js">libflac.js</a></div>
<h1><a href="decode.html">FLAC to WAV conversion</a></h1>
<p>
Either use the drop zone or the file selection button.
</p>
</div>
<!-- START: section for library variants -->
<div>
<style>
#variants-collapse {
background-color: #DFDFDF;
color: #737373;
border-radius: 50%;
height: 1em;
width: 1em;
display: inline-block;
text-decoration: none;
padding-bottom: 4px;
padding-left: 2px;
padding-right: 2px;
}
.hidden {
display: none;
}
</style>
<h3>Library Variants <a href="#" id="variants-collapse" class="hidden">→</a></h3>
<div id="variants-desc">
<hr/>
<p>
<dl><dt>Technology:</dt>
<dd><em>asm.js</em>: sub-set of JavaScript for optimized execution (if browser supports it; fully "JavaScript compatible")</dd>
<dd><em>WASM</em>: new standard for "web binaries" (WebAssembly), i.e. binary execution format</dd>
</dl>
<dl><dt>Optimizations:</dt>
<dd><em>debug</em>: all debugging output enabled</dd>
<dd><em>release</em>: normal optimizations</dd>
<dd><em>minified</em>: all optimizations enabled</dd>
</dl>
<br/>
</p>
<p>
<h4>Load and Try Library Variants</h4>
<em>Note that some library variants initialize synchronously, and some asynchronously.</em>
</p>
<table>
<thead>
<tr><th align="left">Technology →<br/> Optimization ↓</th><th>asm.js</th><th>WASM</th></tr>
</thead>
<tbody>
<tr><th align="left">release</th><td valign="top"><a href="?lib=&wasm=false&showSelect=true">[release.asmjs]</a><br/><em>sync init</em><br/><em>(default)</em></td><td valign="top"><a href="?lib=&wasm=true&showSelect=true">[release.]wasm</a><br/><em>async init</em></td></tr>
<tr><th align="left">debug</th><td><a href="?lib=dev&wasm=false&showSelect=true">dev[.asmjs]</a><br/><em>sync init</em></td><td><a href="?lib=dev&wasm=true&showSelect=true">dev.wasm</a><br/><em>async init</em></td></tr>
<tr><th align="left">minified</th><td><a href="?lib=min&wasm=false&showSelect=true">min[.asmjs]</a><br/><em>async init</em></td><td><a href="?lib=min&wasm=true&showSelect=true">min.wasm</a><br/><em>async init</em></td></tr>
</tbody>
</table>
<script type="text/javascript">
;(function(){
var btn = document.getElementById('variants-collapse');
btn.classList.remove('hidden');
var descEl = document.getElementById('variants-desc');
if(!/\bshowSelect=true\b/.test(document.location.search)){
descEl.classList.add('hidden');
} else {
btn.innerHTML = ' ↓';
}
btn.addEventListener('click', function(){
var isShow = descEl.classList.contains('hidden');
var func = isShow? 'remove' : 'add';
btn.innerHTML = isShow? ' ↓' : '→';
descEl.classList[func]('hidden');
}, false);
})();
</script>
<hr/>
</div>
</div>
<!-- END: section for library variants -->
<div id="drop_zone" class="drop-zone"><div class="drop-hint">Drop FLAC-files here</div></div>
<input type="file" id="files" name="files[]" multiple />
<input type="checkbox" id="check_download" checked>Download <div class="hint" title="download WAV file after decoding"></div>
<input type="checkbox" id="check_verify" checked>Verify <div class="hint" title="Checksum verification during decoding
(disable for faster decoding)"></div>
<input type="checkbox" id="check_ogg">OGG <div class="hint" title="force treating source as OGG container file (otherwise detect from file extension)"></div>
<input type="checkbox" id="check_extract_metadata">Extract Metadata <div class="hint" title="extract metadata blocks"></div>
<!--input type="button" id="files_button" value="process file"-->
<output id="list"></output>
</body>
</html>