2022-11-24 12:41:40 +01:00

67 lines
1.3 KiB
JavaScript

import React from 'react';
import Helper from '../../helper';
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const local = ['-codec:v', 'rawvideo'];
const mapping = {
global: [],
local: local,
};
return mapping;
}
function Coder(props) {
const 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) {},
};
function summarize(settings) {
return `${name}`;
}
function defaults(stream, skills) {
return {
settings: {},
mapping: createMapping({}, stream, skills),
};
}
const coder = 'rawvideo';
const name = 'RAWVIDEO';
const codec = 'rawvideo';
const type = 'video';
const hwaccel = false;
export { coder, name, codec, type, hwaccel, summarize, defaults, Coder as component };