Move component to common collection to avoid duplication

This commit is contained in:
Ingo Oppermann 2022-11-08 11:31:52 +01:00
parent f89aad775f
commit e795c2b33e
No known key found for this signature in database
GPG Key ID: 2AB32426E9DD229E
4 changed files with 28 additions and 55 deletions

View File

@ -2,11 +2,7 @@ import React from 'react';
import SemverSatisfies from 'semver/functions/satisfies';
import Grid from '@mui/material/Grid';
import MenuItem from '@mui/material/MenuItem';
import { Trans } from '@lingui/macro';
import Select from '../../../Select';
import Video from '../../settings/Video';
function init(initialState) {
@ -65,22 +61,6 @@ function createMapping(settings, skills) {
return mapping;
}
function FpsMode(props) {
return (
<Select label={<Trans>Frames per second mode</Trans>} value={props.value} onChange={props.onChange}>
<MenuItem value="passthrough"><Trans>Frame is passed (Passthrough)</Trans></MenuItem>
<MenuItem value="cfr"><Trans>Constant frame rate (CFR)</Trans></MenuItem>
<MenuItem value="vfr"><Trans>Variable frame rate (VFR)</Trans></MenuItem>
<MenuItem value="auto"><Trans>Chooses between CRF and VFR (Auto)</Trans></MenuItem>
</Select>
);
}
FpsMode.defaultProps = {
value: '',
onChange: function (event) {},
};
function Coder(props) {
const settings = init(props.settings);
let ffversion = 4;
@ -125,7 +105,7 @@ function Coder(props) {
</Grid>
{ffversion === 5 && (
<Grid item xs={12}>
<FpsMode value={settings.fps_mode} onChange={update('fps_mode')} />
<Video.FpsMode value={settings.fps_mode} onChange={update('fps_mode')} />
</Grid>
)}
</Grid>

View File

@ -118,22 +118,6 @@ Tune.defaultProps = {
onChange: function (event) {},
};
function FpsMode(props) {
return (
<Select label={<Trans>Frames per second mode</Trans>} value={props.value} onChange={props.onChange}>
<MenuItem value="passthrough"><Trans>Frame is passed (Passthrough)</Trans></MenuItem>
<MenuItem value="cfr"><Trans>Constant frame rate (CFR)</Trans></MenuItem>
<MenuItem value="vfr"><Trans>Variable frame rate (VFR)</Trans></MenuItem>
<MenuItem value="auto"><Trans>Chooses between CRF and VFR (Auto)</Trans></MenuItem>
</Select>
);
}
FpsMode.defaultProps = {
value: '',
onChange: function (event) {},
};
function Coder(props) {
const settings = init(props.settings);
let ffversion = 4;
@ -178,7 +162,7 @@ function Coder(props) {
</Grid>
{ffversion === 5 && (
<Grid item xs={12}>
<FpsMode value={settings.fps_mode} onChange={update('fps_mode')} />
<Video.FpsMode value={settings.fps_mode} onChange={update('fps_mode')} />
</Grid>
)}
<Grid item xs={6}>

View File

@ -118,22 +118,6 @@ Tune.defaultProps = {
onChange: function (event) {},
};
function FpsMode(props) {
return (
<Select label={<Trans>Frames per second mode</Trans>} value={props.value} onChange={props.onChange}>
<MenuItem value="passthrough"><Trans>Frame is passed (Passthrough)</Trans></MenuItem>
<MenuItem value="cfr"><Trans>Constant frame rate (CFR)</Trans></MenuItem>
<MenuItem value="vfr"><Trans>Variable frame rate (VFR)</Trans></MenuItem>
<MenuItem value="auto"><Trans>Chooses between CRF and VFR (Auto)</Trans></MenuItem>
</Select>
);
}
FpsMode.defaultProps = {
value: '',
onChange: function (event) {},
};
function Coder(props) {
const settings = init(props.settings);
let ffversion = 4;
@ -178,7 +162,7 @@ function Coder(props) {
</Grid>
{ffversion === 5 && (
<Grid item xs={12}>
<FpsMode value={settings.fps_mode} onChange={update('fps_mode')} />
<Video.FpsMode value={settings.fps_mode} onChange={update('fps_mode')} />
</Grid>
)}
<Grid item xs={6}>

View File

@ -327,6 +327,30 @@ Format.defaultProps = {
onChange: function (event) {},
};
function FpsMode(props) {
return (
<Select label={<Trans>Framerate mode</Trans>} value={props.value} onChange={props.onChange}>
<MenuItem value="passthrough">
<Trans>Frame is passed through (Passthrough)</Trans>
</MenuItem>
<MenuItem value="cfr">
<Trans>Constant frame rate (CFR)</Trans>
</MenuItem>
<MenuItem value="vfr">
<Trans>Variable frame rate (VFR)</Trans>
</MenuItem>
<MenuItem value="auto">
<Trans>Choose between CFR and VFR (Auto)</Trans>
</MenuItem>
</Select>
);
}
FpsMode.defaultProps = {
value: '',
onChange: function (event) {},
};
export default {
Bitrate,
GOP,
@ -336,4 +360,5 @@ export default {
Width,
Height,
Format,
FpsMode,
};