73 lines
1.4 KiB
JavaScript
73 lines
1.4 KiB
JavaScript
import React from 'react';
|
|
|
|
import Helper from '../../helper';
|
|
|
|
function init(initialState) {
|
|
const state = {
|
|
...initialState,
|
|
};
|
|
|
|
return state;
|
|
}
|
|
|
|
function createMapping(settings, stream, skills) {
|
|
stream = Helper.InitStream(stream);
|
|
skills = Helper.InitSkills(skills);
|
|
|
|
const mapping = {
|
|
global: [],
|
|
local: ['-hwaccel', 'cuda', '-c:v', 'av1_cuvid'],
|
|
};
|
|
|
|
return mapping;
|
|
}
|
|
|
|
function Coder(props) {
|
|
const settings = init(props.settings);
|
|
const stream = Helper.InitStream(props.stream);
|
|
const skills = Helper.InitSkills(props.skills);
|
|
|
|
const handleChange = (newSettings) => {
|
|
let automatic = false;
|
|
if (!newSettings) {
|
|
newSettings = settings;
|
|
automatic = true;
|
|
}
|
|
|
|
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
|
|
};
|
|
|
|
React.useEffect(() => {
|
|
handleChange(null);
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, []);
|
|
|
|
return null;
|
|
}
|
|
|
|
Coder.defaultProps = {
|
|
stream: {},
|
|
settings: {},
|
|
skills: {},
|
|
onChange: function (settings, mapping) {},
|
|
};
|
|
|
|
// -hwaccel nvdec
|
|
|
|
const coder = 'av1_cuvid';
|
|
const name = 'AV1 (CUVID)';
|
|
const codecs = ['av1'];
|
|
const type = 'video';
|
|
const hwaccel = true;
|
|
|
|
function defaults(stream, skills) {
|
|
const settings = init({});
|
|
|
|
return {
|
|
settings: settings,
|
|
mapping: createMapping(settings, stream, skills),
|
|
};
|
|
}
|
|
|
|
export { coder, name, codecs, type, hwaccel, defaults, Coder as component };
|