diff --git a/src/misc/coders/Decoders/audio/Default.js b/src/misc/coders/Decoders/audio/Default.js index e758250..4a47958 100644 --- a/src/misc/coders/Decoders/audio/Default.js +++ b/src/misc/coders/Decoders/audio/Default.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/Default.js b/src/misc/coders/Decoders/video/Default.js index c617039..5c7ec89 100644 --- a/src/misc/coders/Decoders/video/Default.js +++ b/src/misc/coders/Decoders/video/Default.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/H264CUVID.js b/src/misc/coders/Decoders/video/H264CUVID.js index f2bbcd8..ac5a3d0 100644 --- a/src/misc/coders/Decoders/video/H264CUVID.js +++ b/src/misc/coders/Decoders/video/H264CUVID.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/H264MMAL.js b/src/misc/coders/Decoders/video/H264MMAL.js index 02f8f65..c62ea64 100644 --- a/src/misc/coders/Decoders/video/H264MMAL.js +++ b/src/misc/coders/Decoders/video/H264MMAL.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/HEVCCUVID.js b/src/misc/coders/Decoders/video/HEVCCUVID.js index 4cf243f..51b2079 100644 --- a/src/misc/coders/Decoders/video/HEVCCUVID.js +++ b/src/misc/coders/Decoders/video/HEVCCUVID.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/MJPEGCUVID.js b/src/misc/coders/Decoders/video/MJPEGCUVID.js index fc3d70d..6210c64 100644 --- a/src/misc/coders/Decoders/video/MJPEGCUVID.js +++ b/src/misc/coders/Decoders/video/MJPEGCUVID.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/MPEG1CUVID.js b/src/misc/coders/Decoders/video/MPEG1CUVID.js index c084f52..57e2f45 100644 --- a/src/misc/coders/Decoders/video/MPEG1CUVID.js +++ b/src/misc/coders/Decoders/video/MPEG1CUVID.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/MPEG2CUVID.js b/src/misc/coders/Decoders/video/MPEG2CUVID.js index e112fe5..4ae3263 100644 --- a/src/misc/coders/Decoders/video/MPEG2CUVID.js +++ b/src/misc/coders/Decoders/video/MPEG2CUVID.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/MPEG2MMAL.js b/src/misc/coders/Decoders/video/MPEG2MMAL.js index fa8dc9a..4e8f103 100644 --- a/src/misc/coders/Decoders/video/MPEG2MMAL.js +++ b/src/misc/coders/Decoders/video/MPEG2MMAL.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/MPEG4CUVID.js b/src/misc/coders/Decoders/video/MPEG4CUVID.js index d5300ba..42f299b 100644 --- a/src/misc/coders/Decoders/video/MPEG4CUVID.js +++ b/src/misc/coders/Decoders/video/MPEG4CUVID.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/MPEG4MMAL.js b/src/misc/coders/Decoders/video/MPEG4MMAL.js index 6d2aa40..949ab01 100644 --- a/src/misc/coders/Decoders/video/MPEG4MMAL.js +++ b/src/misc/coders/Decoders/video/MPEG4MMAL.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/NVDEC.js b/src/misc/coders/Decoders/video/NVDEC.js index aa4fc83..8e92653 100644 --- a/src/misc/coders/Decoders/video/NVDEC.js +++ b/src/misc/coders/Decoders/video/NVDEC.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/VC1CUVID.js b/src/misc/coders/Decoders/video/VC1CUVID.js index 841e931..8feec38 100644 --- a/src/misc/coders/Decoders/video/VC1CUVID.js +++ b/src/misc/coders/Decoders/video/VC1CUVID.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/VC1MMAL.js b/src/misc/coders/Decoders/video/VC1MMAL.js index cad32ac..614cddd 100644 --- a/src/misc/coders/Decoders/video/VC1MMAL.js +++ b/src/misc/coders/Decoders/video/VC1MMAL.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/VP8CUVID.js b/src/misc/coders/Decoders/video/VP8CUVID.js index 34a3936..4ce6c5a 100644 --- a/src/misc/coders/Decoders/video/VP8CUVID.js +++ b/src/misc/coders/Decoders/video/VP8CUVID.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/VP9CUVID.js b/src/misc/coders/Decoders/video/VP9CUVID.js index 3396f95..9202566 100644 --- a/src/misc/coders/Decoders/video/VP9CUVID.js +++ b/src/misc/coders/Decoders/video/VP9CUVID.js @@ -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(() => { diff --git a/src/misc/coders/Decoders/video/VideoToolbox.js b/src/misc/coders/Decoders/video/VideoToolbox.js index 618033a..f8a793a 100644 --- a/src/misc/coders/Decoders/video/VideoToolbox.js +++ b/src/misc/coders/Decoders/video/VideoToolbox.js @@ -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(() => { diff --git a/src/misc/coders/Encoders/audio/AAC.js b/src/misc/coders/Encoders/audio/AAC.js index cee38bc..8362a79 100644 --- a/src/misc/coders/Encoders/audio/AAC.js +++ b/src/misc/coders/Encoders/audio/AAC.js @@ -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) => { diff --git a/src/misc/coders/Encoders/audio/AACAudioToolbox.js b/src/misc/coders/Encoders/audio/AACAudioToolbox.js index e286784..81914d7 100644 --- a/src/misc/coders/Encoders/audio/AACAudioToolbox.js +++ b/src/misc/coders/Encoders/audio/AACAudioToolbox.js @@ -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) => { diff --git a/src/misc/coders/Encoders/audio/Copy.js b/src/misc/coders/Encoders/audio/Copy.js index e282568..7fed3a8 100644 --- a/src/misc/coders/Encoders/audio/Copy.js +++ b/src/misc/coders/Encoders/audio/Copy.js @@ -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(() => { diff --git a/src/misc/coders/Encoders/audio/Libopus.js b/src/misc/coders/Encoders/audio/Libopus.js index 8148700..35b2b58 100644 --- a/src/misc/coders/Encoders/audio/Libopus.js +++ b/src/misc/coders/Encoders/audio/Libopus.js @@ -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) => { diff --git a/src/misc/coders/Encoders/audio/Libvorbis.js b/src/misc/coders/Encoders/audio/Libvorbis.js index 2729bdf..f1f4059 100644 --- a/src/misc/coders/Encoders/audio/Libvorbis.js +++ b/src/misc/coders/Encoders/audio/Libvorbis.js @@ -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) => { diff --git a/src/misc/coders/Encoders/audio/MP3.js b/src/misc/coders/Encoders/audio/MP3.js index 32389ff..9088751 100644 --- a/src/misc/coders/Encoders/audio/MP3.js +++ b/src/misc/coders/Encoders/audio/MP3.js @@ -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) => { diff --git a/src/misc/coders/Encoders/audio/None.js b/src/misc/coders/Encoders/audio/None.js index 5744666..fefae37 100644 --- a/src/misc/coders/Encoders/audio/None.js +++ b/src/misc/coders/Encoders/audio/None.js @@ -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(() => { diff --git a/src/misc/coders/Encoders/audio/Opus.js b/src/misc/coders/Encoders/audio/Opus.js index f53ec5b..1736301 100644 --- a/src/misc/coders/Encoders/audio/Opus.js +++ b/src/misc/coders/Encoders/audio/Opus.js @@ -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) => { diff --git a/src/misc/coders/Encoders/audio/Vorbis.js b/src/misc/coders/Encoders/audio/Vorbis.js index 474cbaa..0d50549 100644 --- a/src/misc/coders/Encoders/audio/Vorbis.js +++ b/src/misc/coders/Encoders/audio/Vorbis.js @@ -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) => { diff --git a/src/misc/coders/Encoders/video/Copy.js b/src/misc/coders/Encoders/video/Copy.js index cfcb87e..f538c6b 100644 --- a/src/misc/coders/Encoders/video/Copy.js +++ b/src/misc/coders/Encoders/video/Copy.js @@ -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(() => { diff --git a/src/misc/coders/Encoders/video/H264NVENC.js b/src/misc/coders/Encoders/video/H264NVENC.js index c0f737f..02bd6de 100644 --- a/src/misc/coders/Encoders/video/H264NVENC.js +++ b/src/misc/coders/Encoders/video/H264NVENC.js @@ -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) => { diff --git a/src/misc/coders/Encoders/video/H264OMX.js b/src/misc/coders/Encoders/video/H264OMX.js index cca1564..7ef1a86 100644 --- a/src/misc/coders/Encoders/video/H264OMX.js +++ b/src/misc/coders/Encoders/video/H264OMX.js @@ -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) => { diff --git a/src/misc/coders/Encoders/video/H264V4L2M2M.js b/src/misc/coders/Encoders/video/H264V4L2M2M.js index c91a781..22166ec 100644 --- a/src/misc/coders/Encoders/video/H264V4L2M2M.js +++ b/src/misc/coders/Encoders/video/H264V4L2M2M.js @@ -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) => { diff --git a/src/misc/coders/Encoders/video/H264VAAPI.js b/src/misc/coders/Encoders/video/H264VAAPI.js index 43d59c7..0fd4601 100644 --- a/src/misc/coders/Encoders/video/H264VAAPI.js +++ b/src/misc/coders/Encoders/video/H264VAAPI.js @@ -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) => { diff --git a/src/misc/coders/Encoders/video/H264VideoToolbox.js b/src/misc/coders/Encoders/video/H264VideoToolbox.js index 71c8ac1..c3777ec 100644 --- a/src/misc/coders/Encoders/video/H264VideoToolbox.js +++ b/src/misc/coders/Encoders/video/H264VideoToolbox.js @@ -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) => { diff --git a/src/misc/coders/Encoders/video/HEVCVAAPI.js b/src/misc/coders/Encoders/video/HEVCVAAPI.js index f1db3d2..0084522 100644 --- a/src/misc/coders/Encoders/video/HEVCVAAPI.js +++ b/src/misc/coders/Encoders/video/HEVCVAAPI.js @@ -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) => { diff --git a/src/misc/coders/Encoders/video/None.js b/src/misc/coders/Encoders/video/None.js index 51816f7..4935a4a 100644 --- a/src/misc/coders/Encoders/video/None.js +++ b/src/misc/coders/Encoders/video/None.js @@ -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(() => { diff --git a/src/misc/coders/Encoders/video/Raw.js b/src/misc/coders/Encoders/video/Raw.js index 71a4c49..9f70cae 100644 --- a/src/misc/coders/Encoders/video/Raw.js +++ b/src/misc/coders/Encoders/video/Raw.js @@ -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(() => { diff --git a/src/misc/coders/Encoders/video/VP9.js b/src/misc/coders/Encoders/video/VP9.js index ba1e37a..54843c3 100644 --- a/src/misc/coders/Encoders/video/VP9.js +++ b/src/misc/coders/Encoders/video/VP9.js @@ -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) => { diff --git a/src/misc/coders/Encoders/video/VP9VAAPI.js b/src/misc/coders/Encoders/video/VP9VAAPI.js index 0209223..b673a84 100644 --- a/src/misc/coders/Encoders/video/VP9VAAPI.js +++ b/src/misc/coders/Encoders/video/VP9VAAPI.js @@ -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) => { diff --git a/src/misc/coders/Encoders/video/X264.js b/src/misc/coders/Encoders/video/X264.js index 947e14f..8cc2d1c 100644 --- a/src/misc/coders/Encoders/video/X264.js +++ b/src/misc/coders/Encoders/video/X264.js @@ -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) => { diff --git a/src/misc/coders/Encoders/video/X265.js b/src/misc/coders/Encoders/video/X265.js index b82df4a..b99ed21 100644 --- a/src/misc/coders/Encoders/video/X265.js +++ b/src/misc/coders/Encoders/video/X265.js @@ -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) => { diff --git a/src/misc/coders/README.md b/src/misc/coders/README.md index 8ef022b..df80b5b 100644 --- a/src/misc/coders/README.md +++ b/src/misc/coders/README.md @@ -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: ``` { diff --git a/src/misc/coders/coders.test.js b/src/misc/coders/coders.test.js new file mode 100644 index 0000000..5eaef97 --- /dev/null +++ b/src/misc/coders/coders.test.js @@ -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(); + }); + + 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); diff --git a/src/misc/coders/helper/index.js b/src/misc/coders/helper/index.js new file mode 100644 index 0000000..47213e9 --- /dev/null +++ b/src/misc/coders/helper/index.js @@ -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, +};