Add doRun in worker-script
This commit is contained in:
parent
e26adb855b
commit
fbdc691184
@ -26,6 +26,11 @@ const strList2ptr = (strList) => {
|
|||||||
return listPtr;
|
return listPtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const doRun = (_args) => {
|
||||||
|
const args = [...defaultArgs, ..._args.trim().split(' ')];
|
||||||
|
ffmpeg(args.length, strList2ptr(args));
|
||||||
|
};
|
||||||
|
|
||||||
const load = ({ workerId, payload: { options: { corePath } } }, res) => {
|
const load = ({ workerId, payload: { options: { corePath } } }, res) => {
|
||||||
if (Module == null) {
|
if (Module == null) {
|
||||||
const Core = adapter.getCore(corePath);
|
const Core = adapter.getCore(corePath);
|
||||||
@ -63,8 +68,7 @@ const transcode = ({
|
|||||||
options = '',
|
options = '',
|
||||||
},
|
},
|
||||||
}, res) => {
|
}, res) => {
|
||||||
const args = [...defaultArgs, ...`${options} -i ${inputPath} ${outputPath}`.trim().split(' ')];
|
doRun(`${options} -i ${inputPath} ${outputPath}`);
|
||||||
ffmpeg(args.length, strList2ptr(args));
|
|
||||||
res.resolve({ message: `Complete transcoding ${inputPath} to ${outputPath}` });
|
res.resolve({ message: `Complete transcoding ${inputPath} to ${outputPath}` });
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -78,12 +82,11 @@ const read = ({
|
|||||||
|
|
||||||
const run = ({
|
const run = ({
|
||||||
payload: {
|
payload: {
|
||||||
args: _args,
|
args,
|
||||||
},
|
},
|
||||||
}, res) => {
|
}, res) => {
|
||||||
const args = [...defaultArgs, ..._args.trim().split(' ')];
|
doRun(args);
|
||||||
ffmpeg(args.length, strList2ptr(args));
|
res.resolve({ message: `Complete ./ffmpeg ${args}` });
|
||||||
res.resolve({ message: `Complete ./ffmpeg ${_args}` });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.dispatchHandlers = (packet, send) => {
|
exports.dispatchHandlers = (packet, send) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user