Merge pull request #235 from seminelee/master

Add `mainName` option,the main function name of custom ffmpeg-core.js script. And catch the exit Error.
This commit is contained in:
jeromewu 2022-08-14 18:26:50 +08:00 committed by GitHub
commit ab2671e564
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,7 +88,7 @@ module.exports = (_options = {}) => {
return prefix + path;
},
});
ffmpeg = Core.cwrap('proxy_main', 'number', ['number', 'number']);
ffmpeg = Core.cwrap(options.mainName || 'proxy_main', 'number', ['number', 'number']);
log('info', 'ffmpeg-core loaded');
} else {
throw Error('ffmpeg.wasm was loaded, you should not load it again, use ffmpeg.isLoaded() to check next time.');
@ -178,7 +178,11 @@ module.exports = (_options = {}) => {
throw NO_LOAD;
} else {
running = false;
try {
Core.exit(1);
} catch(e) {
console.log('catch core exit error', e);
}
Core = null;
ffmpeg = null;
runResolve = null;