| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- importScripts('../build/ffmpeg.js');
- var now = Date.now;
- function print(text) {
- postMessage({
- 'type' : 'stdout',
- 'data' : text
- });
- }
- onmessage = function(event) {
- var message = event.data;
- if (message.type === "command") {
- var Module = {
- print: print,
- printErr: print,
- files: message.files || [],
- arguments: message.arguments || [],
- TOTAL_MEMORY: message.TOTAL_MEMORY || false
- // Can play around with this option - must be a power of 2
- // TOTAL_MEMORY: 268435456
- };
- postMessage({
- 'type' : 'start',
- 'data' : Module.arguments.join(" ")
- });
- postMessage({
- 'type' : 'stdout',
- 'data' : 'Received command: ' +
- Module.arguments.join(" ") +
- ((Module.TOTAL_MEMORY) ? ". Processing with " + Module.TOTAL_MEMORY + " bits." : "")
- });
- var time = now();
- var result = ffmpeg_run(Module);
- var totalTime = now() - time;
- postMessage({
- 'type' : 'stdout',
- 'data' : 'Finished processing (took ' + totalTime + 'ms)'
- });
- postMessage({
- 'type' : 'done',
- 'data' : result,
- 'time' : totalTime
- });
- }
- };
- postMessage({
- 'type' : 'ready'
- });
|