Add coder tests

This commit is contained in:
Ingo Oppermann 2022-11-24 12:41:40 +01:00
parent 638642d3de
commit d18f99acdd
No known key found for this signature in database
GPG Key ID: 2AB32426E9DD229E
42 changed files with 375 additions and 45 deletions

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: [],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: [],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-c:v', 'h264_cuvid'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-c:v', 'h264_mmal'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-c:v', 'hevc_cuvid'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-c:v', 'mjpeg_cuvid'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-c:v', 'mpeg1_cuvid'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-c:v', 'mpeg2_cuvid'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-c:v', 'mpeg2_mmal'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-c:v', 'mpeg4_cuvid'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-c:v', 'mpeg4_mmal'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-hwaccel', 'cuda', '-hwaccel_output_format', 'cuda'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-c:v', 'vc1_cuvid'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-c:v', 'vc1_mmal'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-c:v', 'vp8_cuvid'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-c:v', 'vp9_cuvid'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,5 +1,7 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
@ -9,6 +11,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-hwaccel', 'videotoolbox'],
@ -19,6 +24,8 @@ function createMapping(settings, stream, skills) {
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;
@ -27,7 +34,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -3,6 +3,7 @@ import React from 'react';
import Grid from '@mui/material/Grid';
import Audio from '../../settings/Audio';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -14,6 +15,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const local = ['-codec:a', 'aac', '-b:a', `${settings.bitrate}k`, '-shortest'];
if (stream.codec === 'aac') {
@ -30,6 +34,8 @@ function createMapping(settings, stream, skills) {
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;
@ -38,7 +44,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -3,6 +3,7 @@ import React from 'react';
import Grid from '@mui/material/Grid';
import Audio from '../../settings/Audio';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -14,6 +15,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const local = ['-codec:a', 'aac_at', '-b:a', `${settings.bitrate}k`, '-shortest'];
if (stream.codec === 'aac') {
@ -30,6 +34,8 @@ function createMapping(settings, stream, skills) {
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;
@ -38,7 +44,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -1,6 +1,11 @@
import React from 'react';
import Helper from '../../helper';
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const local = ['-codec:a', 'copy'];
//if (stream.codec === 'aac') {
@ -17,6 +22,8 @@ function createMapping(settings, stream, skills) {
function Coder(props) {
const settings = {};
const stream = Helper.InitStream(props.stream);
const skills = Helper.InitSkills(props.skills);
const handleChange = (newSettings) => {
let automatic = false;
@ -25,7 +32,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -3,6 +3,7 @@ import React from 'react';
import Grid from '@mui/material/Grid';
import Audio from '../../settings/Audio';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -14,6 +15,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const local = ['-codec:a', 'libopus', '-b:a', `${settings.bitrate}k`, '-shortest'];
const mapping = {
@ -26,6 +30,8 @@ function createMapping(settings, stream, skills) {
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;
@ -34,7 +40,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -3,6 +3,7 @@ import React from 'react';
import Grid from '@mui/material/Grid';
import Audio from '../../settings/Audio';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -14,6 +15,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const local = ['-codec:a', 'libvorbis', '-b:a', `${settings.bitrate}k`, '-shortest'];
const mapping = {
@ -26,6 +30,8 @@ function createMapping(settings, stream, skills) {
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;
@ -34,7 +40,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -3,6 +3,7 @@ import React from 'react';
import Grid from '@mui/material/Grid';
import Audio from '../../settings/Audio';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -14,6 +15,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
// '-qscale:a', '6'
const local = ['-codec:a', 'libmp3lame', '-b:a', `${settings.bitrate}k`, '-shortest'];
@ -27,6 +31,8 @@ function createMapping(settings, stream, skills) {
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;
@ -35,7 +41,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -1,6 +1,11 @@
import React from 'react';
import Helper from '../../helper';
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const local = ['-an'];
const mapping = {
@ -13,6 +18,8 @@ function createMapping(settings, stream, skills) {
function Coder(props) {
const settings = {};
const stream = Helper.InitStream(props.stream);
const skills = Helper.InitSkills(props.skills);
const handleChange = (newSettings) => {
let automatic = false;
@ -21,7 +28,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -8,6 +8,7 @@ import { Trans, t } from '@lingui/macro';
import Audio from '../../settings/Audio';
import SelectCustom from '../../../../misc/SelectCustom';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -20,6 +21,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
let sampling = settings.sampling;
let layout = settings.layout;
@ -90,6 +94,8 @@ Delay.defaultProps = {
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;
@ -98,7 +104,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -3,6 +3,7 @@ import React from 'react';
import Grid from '@mui/material/Grid';
import Audio from '../../settings/Audio';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -14,6 +15,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const local = ['-codec:a', 'vorbis', '-b:a', `${settings.bitrate}k`, '-qscale:a', '3', '-shortest'];
const mapping = {
@ -26,6 +30,8 @@ function createMapping(settings, stream, skills) {
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;
@ -34,7 +40,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -1,6 +1,11 @@
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', 'copy'];
const mapping = {
@ -13,6 +18,8 @@ function createMapping(settings, stream, skills) {
function Coder(props) {
const settings = {};
const stream = Helper.InitStream(props.stream);
const skills = Helper.InitSkills(props.skills);
const handleChange = (newSettings) => {
let automatic = false;
@ -21,7 +28,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -7,6 +7,7 @@ import { Trans } from '@lingui/macro';
import Select from '../../../Select';
import Video from '../../settings/Video';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -24,6 +25,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const local = [
'-codec:v',
'h264_nvenc',
@ -163,6 +167,8 @@ RateControl.defaultProps = {
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;
@ -171,7 +177,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -3,6 +3,7 @@ import React from 'react';
import Grid from '@mui/material/Grid';
import Video from '../../settings/Video';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -17,6 +18,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const local = [
'-codec:v',
'h264_omx',
@ -50,6 +54,8 @@ function createMapping(settings, stream, skills) {
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;
@ -58,7 +64,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -9,6 +9,7 @@ import { Trans } from '@lingui/macro';
import BoxText from '../../../BoxText';
import TextField from '../../../TextField';
import Video from '../../settings/Video';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -76,6 +77,9 @@ Codec Controls
*/
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
let ffversion = 4;
if (SemverSatisfies(skills.ffmpeg.version, '^5.0.0')) {
ffversion = 5;
@ -131,8 +135,11 @@ function createMapping(settings, stream, skills) {
function Coder(props) {
const settings = init(props.settings);
const stream = Helper.InitStream(props.stream);
const skills = Helper.InitSkills(props.skills);
let ffversion = 4;
if (SemverSatisfies(props.skills.ffmpeg.version, '^5.0.0')) {
if (SemverSatisfies(skills.ffmpeg.version, '^5.0.0')) {
ffversion = 5;
}
@ -143,7 +150,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -8,6 +8,7 @@ import { Trans } from '@lingui/macro';
import Select from '../../../Select';
import Video from '../../settings/Video';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -24,6 +25,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const global = [];
const local = [];
@ -97,6 +101,8 @@ Profile.defaultProps = {
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;
@ -105,7 +111,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -7,6 +7,7 @@ import { Trans } from '@lingui/macro';
import Select from '../../../Select';
import Video from '../../settings/Video';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -22,6 +23,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const local = [
'-codec:v',
'h264_videotoolbox',
@ -76,6 +80,8 @@ Entropy.defaultProps = {
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;
@ -84,7 +90,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -8,6 +8,7 @@ import { Trans } from '@lingui/macro';
import Select from '../../../Select';
import Video from '../../settings/Video';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -24,6 +25,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const global = [];
const local = [];
@ -97,6 +101,8 @@ Profile.defaultProps = {
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;
@ -105,7 +111,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -1,6 +1,11 @@
import React from 'react';
import Helper from '../../helper';
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const local = ['-vn'];
const mapping = {
@ -13,6 +18,8 @@ function createMapping(settings, stream, skills) {
function Coder(props) {
const settings = {};
const stream = Helper.InitStream(props.stream);
const skills = Helper.InitSkills(props.skills);
const handleChange = (newSettings) => {
let automatic = false;
@ -21,7 +28,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -1,6 +1,11 @@
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 = {
@ -13,6 +18,8 @@ function createMapping(settings, stream, skills) {
function Coder(props) {
const settings = {};
const stream = Helper.InitStream(props.stream);
const skills = Helper.InitSkills(props.skills);
const handleChange = (newSettings) => {
let automatic = false;
@ -21,7 +28,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {

View File

@ -4,6 +4,7 @@ import SemverSatisfies from 'semver/functions/satisfies';
import Grid from '@mui/material/Grid';
import Video from '../../settings/Video';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -18,6 +19,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
let ffversion = 4;
if (SemverSatisfies(skills.ffmpeg.version, '^5.0.0')) {
ffversion = 5;
@ -63,8 +67,11 @@ function createMapping(settings, stream, skills) {
function Coder(props) {
const settings = init(props.settings);
const stream = Helper.InitStream(props.stream);
const skills = Helper.InitSkills(props.skills);
let ffversion = 4;
if (SemverSatisfies(props.skills.ffmpeg.version, '^5.0.0')) {
if (SemverSatisfies(skills.ffmpeg.version, '^5.0.0')) {
ffversion = 5;
}
@ -75,7 +82,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -8,6 +8,7 @@ import { Trans } from '@lingui/macro';
import Select from '../../../Select';
import Video from '../../settings/Video';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -24,6 +25,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const global = [];
const local = [];
@ -97,6 +101,8 @@ Profile.defaultProps = {
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;
@ -105,7 +111,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -8,6 +8,7 @@ import { Trans } from '@lingui/macro';
import Select from '../../../Select';
import Video from '../../settings/Video';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -25,6 +26,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
let ffversion = 4;
if (SemverSatisfies(skills.ffmpeg.version, '^5.0.0')) {
ffversion = 5;
@ -120,8 +124,11 @@ Tune.defaultProps = {
function Coder(props) {
const settings = init(props.settings);
const stream = Helper.InitStream(props.stream);
const skills = Helper.InitSkills(props.skills);
let ffversion = 4;
if (SemverSatisfies(props.skills.ffmpeg.version, '^5.0.0')) {
if (SemverSatisfies(skills.ffmpeg.version, '^5.0.0')) {
ffversion = 5;
}
@ -132,7 +139,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -8,6 +8,7 @@ import { Trans } from '@lingui/macro';
import Select from '../../../Select';
import Video from '../../settings/Video';
import Helper from '../../helper';
function init(initialState) {
const state = {
@ -25,6 +26,9 @@ function init(initialState) {
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
let ffversion = 4;
if (SemverSatisfies(skills.ffmpeg.version, '^5.0.0')) {
ffversion = 5;
@ -120,8 +124,11 @@ Tune.defaultProps = {
function Coder(props) {
const settings = init(props.settings);
const stream = Helper.InitStream(props.stream);
const skills = Helper.InitSkills(props.skills);
let ffversion = 4;
if (SemverSatisfies(props.skills.ffmpeg.version, '^5.0.0')) {
if (SemverSatisfies(skills.ffmpeg.version, '^5.0.0')) {
ffversion = 5;
}
@ -132,7 +139,7 @@ function Coder(props) {
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, props.stream, props.skills), automatic);
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
const update = (what) => (event) => {

View File

@ -22,7 +22,7 @@ export { coder, name, codecs, type, hwaccel, defaults, Coder as component };
### defaults
The `defaults()` function returns the default settings and mappings for this decoder. It is an object of this shape:
The `defaults(stream, skills)` function returns the default settings and mappings for this decoder. It is an object of this shape:
```
{
@ -80,7 +80,7 @@ export { coder, name, codec, type, hwaccel, summarize, defaults, Coder as compon
### defaults
The `defaults()` function returns the default settings and mappings for this encoder. It is an object of this shape:
The `defaults(stream, skills)` function returns the default settings and mappings for this encoder. It is an object of this shape:
```
{

View File

@ -0,0 +1,35 @@
import React from 'react';
import { render, act } from '../../utils/testing';
import '@testing-library/jest-dom';
import * as Decoders from './Decoders';
import * as Encoders from './Encoders';
const audiodecoders = Decoders.Audio.List();
const videodecoders = Decoders.Video.List();
const audioencoders = Encoders.Audio.List();
const videoencoders = Encoders.Video.List();
const testfunc = async (coder) => {
const defaults = coder.defaults();
let $settings = {};
let $mapping = {};
const handleChange = (settings, mapping) => {
$settings = settings;
$mapping = mapping;
};
await act(async () => {
render(<coder.component onChange={handleChange} />);
});
expect($settings).toStrictEqual(defaults.settings);
expect($mapping).toStrictEqual(defaults.mapping);
};
test.each(audiodecoders)('coder:decoder:$type $coder', testfunc);
test.each(videodecoders)('coder:decoder:$type $coder', testfunc);
test.each(audioencoders)('coder:encoder:$type $coder', testfunc);
test.each(videoencoders)('coder:encoder:$type $coder', testfunc);

View File

@ -0,0 +1,35 @@
function InitStream(initialStream) {
if (!initialStream) {
initialStream = {};
}
let stream = {
codec: '',
...initialStream,
};
return stream;
}
function InitSkills(initialSkills) {
if (!initialSkills) {
initialSkills = {};
}
let skills = {
ffmpeg: {},
...initialSkills,
};
skills.ffmpeg = {
version: '5.0.0',
...skills.ffmpeg,
};
return skills;
}
export default {
InitStream,
InitSkills,
};