@@ -172,7 +164,7 @@ function Select(props) {
);
}
- if (availableSources.length === 0) {
+ if (selectAvailableSources.length === 0) {
return (
@@ -186,15 +178,7 @@ function Select(props) {
return (
- {availableSources}
+ {selectAvailableSources}
);
}
-
-Select.defaultProps = {
- type: '',
- selected: '',
- ffversion: '0.0.0',
- availableSources: {},
- onSelect: function (source) {},
-};
diff --git a/src/views/Edit/Sources/ALSA.js b/src/views/Edit/Sources/ALSA.js
index 1d562db..a2e9fd4 100644
--- a/src/views/Edit/Sources/ALSA.js
+++ b/src/views/Edit/Sources/ALSA.js
@@ -57,10 +57,19 @@ const createInputs = (settings) => {
return [input];
};
-function Source(props) {
+function Source({
+ knownDevices = [],
+ settings = {},
+ onChange = function (settings) {},
+ onProbe = function (settings, inputs) {},
+ onRefresh = function () {},
+ onStore = function (name, data) {
+ return '';
+ },
+}) {
const classes = useStyles();
const { i18n } = useLingui();
- const settings = initSettings(props.settings);
+ settings = initSettings(settings);
const handleChange = (what) => (event) => {
let data = {};
@@ -69,21 +78,21 @@ function Source(props) {
data[what] = event.target.value;
}
- props.onChange({
+ onChange({
...settings,
...data,
});
};
const handleRefresh = () => {
- props.onRefresh();
+ onRefresh();
};
const handleProbe = () => {
- props.onProbe(settings, createInputs(settings));
+ onProbe(settings, createInputs(settings));
};
- const filteredDevices = props.knownDevices.filter((device) => device.media === 'audio');
+ const filteredDevices = knownDevices.filter((device) => device.media === 'audio');
const options = filteredDevices.map((device) => {
return {
value: device.id.replace(/^hw:/, ''),
@@ -140,14 +149,6 @@ function Source(props) {
);
}
-Source.defaultProps = {
- knownDevices: [],
- settings: {},
- onChange: function (settings) {},
- onProbe: function (settings, inputs) {},
- onRefresh: function () {},
-};
-
function SourceIcon(props) {
return ;
}
diff --git a/src/views/Edit/Sources/AVFoundation.js b/src/views/Edit/Sources/AVFoundation.js
index 072b7d9..1cde83b 100644
--- a/src/views/Edit/Sources/AVFoundation.js
+++ b/src/views/Edit/Sources/AVFoundation.js
@@ -74,10 +74,19 @@ const createInputs = (settings) => {
return [input];
};
-function Source(props) {
+function Source({
+ knownDevices = [],
+ settings = {},
+ onChange = function (settings) {},
+ onProbe = function (settings, inputs) {},
+ onRefresh = function () {},
+ onStore = function (name, data) {
+ return '';
+ },
+}) {
const classes = useStyles();
const { i18n } = useLingui();
- const settings = initSettings(props.settings);
+ settings = initSettings(settings);
const handleChange = (what) => (event) => {
let data = {};
@@ -88,21 +97,21 @@ function Source(props) {
data[what] = event.target.value;
}
- props.onChange({
+ onChange({
...settings,
...data,
});
};
const handleRefresh = () => {
- props.onRefresh();
+ onRefresh();
};
const handleProbe = () => {
- props.onProbe(settings, createInputs(settings));
+ onProbe(settings, createInputs(settings));
};
- let filteredDevices = props.knownDevices.filter((device) => device.media === 'video');
+ let filteredDevices = knownDevices.filter((device) => device.media === 'video');
let options = filteredDevices.map((device) => {
return {
value: device.id,
@@ -132,7 +141,7 @@ function Source(props) {
/>
);
- filteredDevices = props.knownDevices.filter((device) => device.media === 'audio');
+ filteredDevices = knownDevices.filter((device) => device.media === 'audio');
options = filteredDevices.map((device) => {
return {
value: device.id,
@@ -205,14 +214,6 @@ function Source(props) {
);
}
-Source.defaultProps = {
- knownDevices: [],
- settings: {},
- onChange: function (settings) {},
- onProbe: function (settings, inputs) {},
- onRefresh: function () {},
-};
-
function SourceIcon(props) {
return ;
}
diff --git a/src/views/Edit/Sources/AudioLoop.js b/src/views/Edit/Sources/AudioLoop.js
index 2220f50..794918e 100644
--- a/src/views/Edit/Sources/AudioLoop.js
+++ b/src/views/Edit/Sources/AudioLoop.js
@@ -50,9 +50,19 @@ const createInputs = (settings) => {
return [input];
};
-function Source(props) {
+function Source({
+ knownDevices = [],
+ settings = {},
+ onChange = function (settings) {},
+ onProbe = function (settings, inputs) {},
+ onRefresh = function () {},
+ onStore = function (name, data) {
+ return '';
+ },
+}) {
const classes = useStyles();
- const settings = initSettings(props.settings);
+ settings = initSettings(settings);
+
const [$saving, setSaving] = React.useState(false);
const [$error, setError] = React.useState({
open: false,
@@ -61,9 +71,9 @@ function Source(props) {
});
const handleFileUpload = async (data, extension, mimetype) => {
- const path = await props.onStore('audioloop.source', data);
+ const path = await onStore('audioloop.source', data);
- props.onChange({
+ onChange({
...settings,
address: path,
mimetype: mimetype,
@@ -127,7 +137,7 @@ function Source(props) {
};
const handleProbe = () => {
- props.onProbe(settings, createInputs(settings));
+ onProbe(settings, createInputs(settings));
};
return (
@@ -175,17 +185,6 @@ function Source(props) {
);
}
-Source.defaultProps = {
- knownDevices: [],
- settings: {},
- onChange: function (settings) {},
- onProbe: function (settings, inputs) {},
- onRefresh: function () {},
- onStore: function (name, data) {
- return '';
- },
-};
-
function SourceIcon(props) {
return ;
}
diff --git a/src/views/Edit/Sources/Framebuffer.js b/src/views/Edit/Sources/Framebuffer.js
index 2f80556..8692429 100644
--- a/src/views/Edit/Sources/Framebuffer.js
+++ b/src/views/Edit/Sources/Framebuffer.js
@@ -45,10 +45,19 @@ const createInputs = (settings) => {
return [input];
};
-function Source(props) {
+function Source({
+ knownDevices = [],
+ settings = {},
+ onChange = function (settings) {},
+ onProbe = function (settings, inputs) {},
+ onRefresh = function () {},
+ onStore = function (name, data) {
+ return '';
+ },
+}) {
const classes = useStyles();
const { i18n } = useLingui();
- const settings = initSettings(props.settings);
+ settings = initSettings(settings);
const handleChange = (what) => (event) => {
let data = {};
@@ -57,17 +66,17 @@ function Source(props) {
data[what] = event.target.value;
}
- props.onChange({
+ onChange({
...settings,
...data,
});
};
const handleProbe = () => {
- props.onProbe(settings, createInputs(settings));
+ onProbe(settings, createInputs(settings));
};
- const filteredDevices = props.knownDevices.filter((device) => device.extra !== '');
+ const filteredDevices = knownDevices.filter((device) => device.extra !== '');
const options = filteredDevices.map((device) => {
return {
value: device.id,
@@ -114,13 +123,6 @@ function Source(props) {
);
}
-Source.defaultProps = {
- knownDevices: [],
- settings: {},
- onChange: function (settings) {},
- onProbe: function (settings, inputs) {},
-};
-
function SourceIcon(props) {
return ;
}
diff --git a/src/views/Edit/Sources/Network.js b/src/views/Edit/Sources/Network.js
index 18fd4d4..6c754e3 100644
--- a/src/views/Edit/Sources/Network.js
+++ b/src/views/Edit/Sources/Network.js
@@ -495,8 +495,7 @@ const isValidURL = (address) => {
return true;
};
-function AdvancedSettings(props) {
- const settings = props.settings;
+function AdvancedSettings({ settings = {}, onChange = function (settings) {} }) {
let protocolClass = getProtocolClass(settings.address);
if (settings.mode === 'push') {
switch (settings.push.type) {
@@ -528,7 +527,7 @@ function AdvancedSettings(props) {
- UDP transport} checked={settings.rtsp.udp} onChange={props.onChange('rtsp', 'udp')} />
+ UDP transport} checked={settings.rtsp.udp} onChange={onChange('rtsp', 'udp')} />
Socket timeout (microseconds)}
value={settings.rtsp.stimeout}
- onChange={props.onChange('rtsp', 'stimeout')}
+ onChange={onChange('rtsp', 'stimeout')}
/>
@@ -555,12 +554,12 @@ function AdvancedSettings(props) {
Read input at native speed}
checked={settings.http.readNative}
- onChange={props.onChange('http', 'readNative')}
+ onChange={onChange('http', 'readNative')}
/>
Force input framerate}
checked={settings.http.forceFramerate}
- onChange={props.onChange('http', 'forceFramerate')}
+ onChange={onChange('http', 'forceFramerate')}
/>
{settings.http.forceFramerate === true && (
@@ -573,7 +572,7 @@ function AdvancedSettings(props) {
fullWidth
label={
Framerate}
value={settings.http.framerate}
- onChange={props.onChange('http', 'framerate')}
+ onChange={onChange('http', 'framerate')}
/>
)}
@@ -583,7 +582,7 @@ function AdvancedSettings(props) {
fullWidth
label="User-Agent"
value={settings.http.userAgent}
- onChange={props.onChange('http', 'userAgent')}
+ onChange={onChange('http', 'userAgent')}
/>
@@ -592,7 +591,7 @@ function AdvancedSettings(props) {
fullWidth
label="Referrer"
value={settings.http.referer}
- onChange={props.onChange('http', 'referer')}
+ onChange={onChange('http', 'referer')}
/>
@@ -601,7 +600,7 @@ function AdvancedSettings(props) {
fullWidth
label="HTTP proxy"
value={settings.http.http_proxy}
- onChange={props.onChange('http', 'http_proxy')}
+ onChange={onChange('http', 'http_proxy')}
placeholder="https://123.123.123.123:443"
/>
@@ -621,7 +620,7 @@ function AdvancedSettings(props) {
fullWidth
label="thread_queue_size"
value={settings.general.thread_queue_size}
- onChange={props.onChange('general', 'thread_queue_size')}
+ onChange={onChange('general', 'thread_queue_size')}
/>
@@ -633,7 +632,7 @@ function AdvancedSettings(props) {
fullWidth
label="probesize (bytes)"
value={settings.general.probesize}
- onChange={props.onChange('general', 'probesize')}
+ onChange={onChange('general', 'probesize')}
/>
@@ -650,7 +649,7 @@ function AdvancedSettings(props) {
fullWidth
label="max_probe_packets"
value={settings.general.max_probe_packets}
- onChange={props.onChange('general', 'max_probe_packets')}
+ onChange={onChange('general', 'max_probe_packets')}
/>
Default {2500}
@@ -677,7 +676,7 @@ function AdvancedSettings(props) {
? settings.general.analyzeduration_rtmp
: settings.general.analyzeduration
}
- onChange={props.onChange(
+ onChange={onChange(
'general',
settings.mode === 'push'
? settings.push.type === 'hls'
@@ -699,7 +698,7 @@ function AdvancedSettings(props) {
-
+
@@ -712,16 +711,16 @@ function AdvancedSettings(props) {
- copyts} checked={settings.general.copyts} onChange={props.onChange('general', 'copyts')} />
+ copyts} checked={settings.general.copyts} onChange={onChange('general', 'copyts')} />
start_at_zero}
checked={settings.general.start_at_zero}
- onChange={props.onChange('general', 'start_at_zero')}
+ onChange={onChange('general', 'start_at_zero')}
/>
use_wallclock_as_timestamps}
checked={settings.general.use_wallclock_as_timestamps}
- onChange={props.onChange('general', 'use_wallclock_as_timestamps')}
+ onChange={onChange('general', 'use_wallclock_as_timestamps')}
/>
@@ -729,7 +728,7 @@ function AdvancedSettings(props) {
type="select"
label={avoid_negative_ts}
value={settings.general.avoid_negative_ts}
- onChange={props.onChange('general', 'avoid_negative_ts')}
+ onChange={onChange('general', 'avoid_negative_ts')}
>
@@ -744,12 +743,19 @@ function AdvancedSettings(props) {
);
}
-function Pull(props) {
+function Pull({
+ knownDevices = [],
+ settings = {},
+ config = {},
+ skills = null,
+ onChange = function (settings) {},
+ onProbe = function (settings, inputs) {},
+ onRefresh = function () {},
+}) {
const classes = useStyles();
- const settings = props.settings;
const authProtocol = isAuthProtocol(settings.address);
const validURL = isValidURL(settings.address);
- const supportedProtocol = isSupportedProtocol(settings.address, props.skills.protocols.input);
+ const supportedProtocol = isSupportedProtocol(settings.address, skills.protocols.input);
return (
@@ -765,7 +771,7 @@ function Pull(props) {
label={Address}
placeholder="rtsp://ip:port/path"
value={settings.address}
- onChange={props.onChange('', 'address')}
+ onChange={onChange('', 'address')}
/>
Supports HTTP (HLS, DASH), RTP, RTSP, RTMP, SRT and more.
@@ -792,7 +798,7 @@ function Pull(props) {
fullWidth
label={Username}
value={settings.username}
- onChange={props.onChange('', 'username')}
+ onChange={onChange('', 'username')}
/>
Username for the device.
@@ -804,7 +810,7 @@ function Pull(props) {
fullWidth
label={Password}
value={settings.password}
- onChange={props.onChange('', 'password')}
+ onChange={onChange('', 'password')}
/>
Password for the device.
@@ -812,13 +818,13 @@ function Pull(props) {
)}
-
+
)}
)}
-
+
Probe
@@ -826,13 +832,20 @@ function Pull(props) {
);
}
-function Push(props) {
+function Push({
+ knownDevices = [],
+ settings = {},
+ config = {},
+ skills = null,
+ onChange = function (settings) {},
+ onProbe = function (settings, inputs) {},
+ onRefresh = function () {},
+}) {
const classes = useStyles();
- const settings = props.settings;
- //const supportsHLS = isSupportedProtocol('http://', props.skills.protocols.input);
- const supportsRTMP = isSupportedProtocol('rtmp://', props.skills.protocols.input);
- const supportsSRT = isSupportedProtocol('srt://', props.skills.protocols.input);
+ //const supportsHLS = isSupportedProtocol('http://', skills.protocols.input);
+ const supportsRTMP = isSupportedProtocol('rtmp://', skills.protocols.input);
+ const supportsSRT = isSupportedProtocol('srt://', skills.protocols.input);
if (!supportsRTMP && !supportsSRT) {
return (
@@ -853,7 +866,7 @@ function Push(props) {
-
- {settings.push.type === 'rtmp' && }
- {settings.push.type === 'hls' && }
- {settings.push.type === 'srt' && }
+ {settings.push.type === 'rtmp' && (
+
+ )}
+ {settings.push.type === 'hls' && }
+ {settings.push.type === 'srt' && (
+
+ )}
);
}
-Push.defaultProps = {
- knownDevices: [],
- settings: {},
- config: {},
- skills: null,
- onChange: function (settings) {},
- onProbe: function (settings, inputs) {},
- onRefresh: function () {},
-};
-
-function PushHLS(props) {
+function PushHLS({ settings = {}, config = {}, onChange = function (settings) {}, onProbe = function (settings, inputs) {} }) {
const classes = useStyles();
- const config = props.config;
const HLS = getHLS(config);
@@ -898,9 +904,9 @@ function PushHLS(props) {
-
+
-
+
Probe
@@ -908,11 +914,17 @@ function PushHLS(props) {
);
}
-function PushRTMP(props) {
+function PushRTMP({
+ knownDevices = [],
+ settings = {},
+ config = {},
+ onChange = function (settings) {},
+ onProbe = function (settings, inputs) {},
+ onRefresh = function () {},
+}) {
const { i18n } = useLingui();
const classes = useStyles();
const navigate = useNavigate();
- const config = props.config;
let form = null;
@@ -934,7 +946,7 @@ function PushRTMP(props) {
} else {
const RTMP = getRTMP(config);
- const filteredDevices = props.knownDevices.filter((device) => device.media === 'rtmp');
+ const filteredDevices = knownDevices.filter((device) => device.media === 'rtmp');
const options = filteredDevices.map((device) => {
return (
,
);
}
}
- if (props.type === 'video') {
+ if (type === 'video') {
if (streamList.length === 0) {
selected = -1;
streamList.push(
{i18n._(t`No video stream available`)}
-
+ ,
);
} else {
streamList.unshift(
{i18n._(t`Choose a video stream`)}
-
+ ,
);
}
- } else if (props.type === 'audio') {
+ } else if (type === 'audio') {
if (streamList.length === 0 && selected >= 0) {
selected = -1;
streamList.push(
{i18n._(t`No audio stream available`)}
-
+ ,
);
} else {
streamList.unshift(
{i18n._(t`Choose an audio stream`)}
-
+ ,
);
}
}
@@ -85,12 +84,3 @@ export default function StreamSelect(props) {
);
}
-
-StreamSelect.defaultProps = {
- type: '',
- streams: [],
- selected: -1,
- allowCustom: false,
- allowNone: false,
- onChange: function (stream) {},
-};
diff --git a/src/views/Edit/Summary.js b/src/views/Edit/Summary.js
index 4361f68..e55f759 100644
--- a/src/views/Edit/Summary.js
+++ b/src/views/Edit/Summary.js
@@ -10,10 +10,8 @@ import * as Filters from '../../misc/filters';
import BoxText from '../../misc/BoxText';
import Sources from './Sources';
-export default function Summary(props) {
+export default function Summary({ type = '', sources = [], profile = null }) {
const { i18n } = useLingui();
- const sources = props.sources;
- const profile = props.profile;
let source = null;
let stream = null;
@@ -44,9 +42,9 @@ export default function Summary(props) {
let coder = null;
- if (props.type === 'video') {
+ if (type === 'video') {
coder = Coders.Video.Get(profile.encoder.coder);
- } else if (props.type === 'audio') {
+ } else if (type === 'audio') {
coder = Coders.Audio.Get(profile.encoder.coder);
}
@@ -58,9 +56,9 @@ export default function Summary(props) {
if (profile.filter.graph.length !== 0) {
let filters = null;
- if (props.type === 'video') {
+ if (type === 'video') {
filters = Filters.Video;
- } else if (props.type === 'audio') {
+ } else if (type === 'audio') {
filters = Filters.Audio;
}
@@ -114,9 +112,3 @@ export default function Summary(props) {
);
}
-
-Summary.defaultProps = {
- type: '',
- sources: [],
- profile: null,
-};
diff --git a/src/views/Edit/Wizard/Abort.js b/src/views/Edit/Wizard/Abort.js
index 955a593..d72b584 100644
--- a/src/views/Edit/Wizard/Abort.js
+++ b/src/views/Edit/Wizard/Abort.js
@@ -8,12 +8,12 @@ import Button from '@mui/material/Button';
import Paper from '../../../misc/Paper';
import PaperHeader from '../../../misc/PaperHeader';
-export default function Abort(props) {
+export default function Abort({ onHelp = () => {}, onBack = () => {}, onNext = () => {}, nchannels = 0 }) {
return (
- Abort} onHelp={props.onHelp} />
+ Abort} onHelp={onHelp} />
- {props.nchannels <= 1 ? (
+ {nchannels <= 1 ? (
@@ -21,7 +21,7 @@ export default function Abort(props) {
-
@@ -34,12 +34,12 @@ export default function Abort(props) {
-
+
Yes
-
+
No
@@ -49,10 +49,3 @@ export default function Abort(props) {
);
}
-
-Abort.defaultProps = {
- onHelp: () => {},
- onBack: () => {},
- onNext: () => {},
- nchannels: 0,
-};
diff --git a/src/views/Edit/Wizard/Audio.js b/src/views/Edit/Wizard/Audio.js
index b61c2fd..741dc47 100644
--- a/src/views/Edit/Wizard/Audio.js
+++ b/src/views/Edit/Wizard/Audio.js
@@ -17,18 +17,32 @@ import Paper from '../../../misc/Paper';
import PaperHeader from '../../../misc/PaperHeader';
import Select from '../../../misc/Select';
-export default function Audio(props) {
+export default function Audio({
+ onAbort = () => {},
+ onHelp = () => {},
+ onBack = () => {},
+ onNext = () => {},
+ onSource = () => {},
+ source = '',
+ onAudioStreamChange = () => {},
+ onAudioDeviceChange = () => {},
+ streamList = [],
+ deviceList = [],
+ status = '',
+ stream = 0,
+ address = {},
+}) {
const { i18n } = useLingui();
return (
- Audio setup} onAbort={props.onAbort} onHelp={props.onHelp} />
+ Audio setup} onAbort={onAbort} onHelp={onHelp} />
- {props.status === 'error' && (
+ {status === 'error' && (
@@ -36,7 +50,7 @@ export default function Audio(props) {
)}
- {props.status === 'nostream' && (
+ {status === 'nostream' && (
@@ -44,7 +58,7 @@ export default function Audio(props) {
)}
- {props.status === 'nocoder' && (
+ {status === 'nocoder' && (
@@ -54,9 +68,9 @@ export default function Audio(props) {
)}
-
+
- {props.streamList.length === 0 && (
+ {streamList.length === 0 && (
@@ -66,26 +80,26 @@ export default function Audio(props) {
)}
- {props.streamList.length !== 0 && (
+ {streamList.length !== 0 && (
} label={i18n._(t`Audio from device`)} />
- Stream} value={props.stream} onChange={props.onAudioStreamChange}>
- {props.streamList}
+ Stream} value={stream} onChange={onAudioStreamChange}>
+ {streamList}
)}
- {props.deviceList.length !== 0 && (
+ {deviceList.length !== 0 && (
} label={i18n._(t`Audio from device`)} />
- Device} value={props.address} onChange={props.onAudioDeviceChange}>
- {props.deviceList}
+ Device} value={address} onChange={onAudioDeviceChange}>
+ {deviceList}
@@ -105,12 +119,12 @@ export default function Audio(props) {
-
+
Back
-
+
Next
@@ -118,19 +132,3 @@ export default function Audio(props) {
);
}
-
-Audio.defaultProps = {
- onAbort: () => {},
- onHelp: () => {},
- onBack: () => {},
- onNext: () => {},
- onSource: () => {},
- source: '',
- onAudioStreamChange: () => {},
- onAudioDeviceChange: () => {},
- streamList: [],
- deviceList: [],
- status: '',
- stream: 0,
- address: {},
-};
diff --git a/src/views/Edit/Wizard/Error.js b/src/views/Edit/Wizard/Error.js
index e5ac148..f4d3657 100644
--- a/src/views/Edit/Wizard/Error.js
+++ b/src/views/Edit/Wizard/Error.js
@@ -10,10 +10,10 @@ import BoxText from '../../../misc/BoxText';
import Paper from '../../../misc/Paper';
import PaperHeader from '../../../misc/PaperHeader';
-export default function Error(props) {
+export default function Error({ onAbort = () => {}, onHelp = () => {}, onNext = () => {} }) {
return (
- Error} onAbort={props.onAbort} onHelp={props.onHelp} />
+ Error} onAbort={onAbort} onHelp={onHelp} />
@@ -22,7 +22,7 @@ export default function Error(props) {
-
+
Retry
@@ -30,9 +30,3 @@ export default function Error(props) {
);
}
-
-Error.defaultProps = {
- onAbort: () => {},
- onHelp: () => {},
- onNext: () => {},
-};
diff --git a/src/views/Edit/Wizard/License.js b/src/views/Edit/Wizard/License.js
index d361f56..c15a285 100644
--- a/src/views/Edit/Wizard/License.js
+++ b/src/views/Edit/Wizard/License.js
@@ -11,10 +11,10 @@ import LicenseControl from '../../../misc/controls/License';
import Paper from '../../../misc/Paper';
import PaperHeader from '../../../misc/PaperHeader';
-export default function License(props) {
+export default function License({ onAbort = () => {}, onHelp = () => {}, onBack = () => {}, onNext = () => {}, onChange = (license) => {}, license = '' }) {
return (
- License} onAbort={props.onAbort} onHelp={props.onHelp} />
+ License} onAbort={onAbort} onHelp={onHelp} />
@@ -28,18 +28,18 @@ export default function License(props) {
-
+
-
+
Back
-
+
Save
@@ -47,12 +47,3 @@ export default function License(props) {
);
}
-
-License.defaultProps = {
- onAbort: () => {},
- onHelp: () => {},
- onBack: () => {},
- onNext: () => {},
- onChange: (license) => {},
- license: '',
-};
diff --git a/src/views/Edit/Wizard/Metadata.js b/src/views/Edit/Wizard/Metadata.js
index eac9d34..0ce2965 100644
--- a/src/views/Edit/Wizard/Metadata.js
+++ b/src/views/Edit/Wizard/Metadata.js
@@ -11,10 +11,10 @@ import MetadataControl from '../../../misc/controls/Metadata';
import Paper from '../../../misc/Paper';
import PaperHeader from '../../../misc/PaperHeader';
-export default function Metadata(props) {
+export default function Metadata({ onAbort = () => {}, onHelp = () => {}, onBack = () => {}, onNext = () => {}, onChange = (metadata) => {}, metadata = {} }) {
return (
- Metadata} onAbort={props.onAbort} onHelp={props.onHelp} />
+ Metadata} onAbort={onAbort} onHelp={onHelp} />
@@ -25,18 +25,18 @@ export default function Metadata(props) {
-
+
-
+
Back
-
+
Next
@@ -44,12 +44,3 @@ export default function Metadata(props) {
);
}
-
-Metadata.defaultProps = {
- onAbort: () => {},
- onHelp: () => {},
- onBack: () => {},
- onNext: () => {},
- onChange: (metadata) => {},
- metadata: {},
-};
diff --git a/src/views/Edit/Wizard/Probe.js b/src/views/Edit/Wizard/Probe.js
index 15a6bc0..a96c1d2 100644
--- a/src/views/Edit/Wizard/Probe.js
+++ b/src/views/Edit/Wizard/Probe.js
@@ -8,10 +8,10 @@ import Typography from '@mui/material/Typography';
import Paper from '../../../misc/Paper';
import PaperHeader from '../../../misc/PaperHeader';
-export default function Probe(props) {
+export default function Probe({ onAbort = () => {} }) {
return (
-
+
@@ -25,7 +25,3 @@ export default function Probe(props) {
);
}
-
-Probe.defaultProps = {
- onAbort: () => {},
-};
diff --git a/src/views/Edit/Wizard/Saving.js b/src/views/Edit/Wizard/Saving.js
index ea9e940..5f3b93a 100644
--- a/src/views/Edit/Wizard/Saving.js
+++ b/src/views/Edit/Wizard/Saving.js
@@ -8,10 +8,10 @@ import Typography from '@mui/material/Typography';
import Paper from '../../../misc/Paper';
import PaperHeader from '../../../misc/PaperHeader';
-export default function Saving(props) {
+export default function Saving({ onAbort = () => {} }) {
return (
-
+
@@ -25,7 +25,3 @@ export default function Saving(props) {
);
}
-
-Saving.defaultProps = {
- onAbort: () => {},
-};
diff --git a/src/views/Edit/Wizard/Source.js b/src/views/Edit/Wizard/Source.js
index 9f3e452..2f7c9dd 100644
--- a/src/views/Edit/Wizard/Source.js
+++ b/src/views/Edit/Wizard/Source.js
@@ -9,10 +9,10 @@ import Typography from '@mui/material/Typography';
import Paper from '../../../misc/Paper';
import PaperHeader from '../../../misc/PaperHeader';
-export default function Source(props) {
+export default function Source({ onAbort = () => {}, onHelp = () => {}, onAdvanced = () => {}, sources = [] }) {
return (
- Video setup} onAbort={props.Abort} onHelp={props.onHelp} />
+ Video setup} onAbort={onAbort} onHelp={onHelp} />
@@ -27,14 +27,14 @@ export default function Source(props) {
- {props.sources}
+ {sources}
-
+
Advanced setup
@@ -42,10 +42,3 @@ export default function Source(props) {
);
}
-
-Source.defaultProps = {
- onAbort: () => {},
- onHelp: () => {},
- onAdvanced: () => {},
- sources: [],
-};
diff --git a/src/views/Edit/Wizard/Sources/AVFoundation.js b/src/views/Edit/Wizard/Sources/AVFoundation.js
index 615658c..252657f 100644
--- a/src/views/Edit/Wizard/Sources/AVFoundation.js
+++ b/src/views/Edit/Wizard/Sources/AVFoundation.js
@@ -23,20 +23,27 @@ function initSettings(initialSettings) {
return settings;
}
-function Source(props) {
+function Source({
+ settings = {},
+ knownDevices = [],
+ config = null,
+ skills = null,
+ onChange = function (type, settings, inputs, ready) {},
+ onRefresh = function () {},
+}) {
const { i18n } = useLingui();
- const settings = initSettings(props.settings);
+ settings = initSettings(settings);
const handleChange = (newSettings) => {
newSettings = newSettings || settings;
- const filteredDevices = props.knownDevices.filter((device) => device.media === 'video');
+ const filteredDevices = knownDevices.filter((device) => device.media === 'video');
- props.onChange(S.id, newSettings, S.func.createInputs(newSettings), filteredDevices.length !== 0 ? true : false);
+ onChange(S.id, newSettings, S.func.createInputs(newSettings), filteredDevices.length !== 0 ? true : false);
};
const handleRefresh = () => {
- props.onRefresh();
+ onRefresh();
};
const update = (what) => (event) => {
@@ -55,7 +62,7 @@ function Source(props) {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
- let filteredDevices = props.knownDevices.filter((device) => device.media === 'video');
+ let filteredDevices = knownDevices.filter((device) => device.media === 'video');
let options = filteredDevices.map((device) => {
return (
@@ -68,13 +75,13 @@ function Source(props) {
options.push(
{i18n._(t`No input device available`)}
-
+ ,
);
} else {
options.unshift(
{i18n._(t`Default`)}
-
+ ,
);
}
@@ -84,7 +91,7 @@ function Source(props) {
);
- filteredDevices = props.knownDevices.filter((device) => device.media === 'audio');
+ filteredDevices = knownDevices.filter((device) => device.media === 'audio');
options = filteredDevices.map((device) => {
return (
@@ -96,14 +103,14 @@ function Source(props) {
options.unshift(
{i18n._(t`None`)}
-
+ ,
);
if (options.length > 1) {
options.unshift(
{i18n._(t`Default`)}
-
+ ,
);
}
@@ -141,13 +148,6 @@ function Source(props) {
);
}
-Source.defaultProps = {
- knownDevices: [],
- settings: {},
- onChange: function (type, settings, inputs, ready) {},
- onRefresh: function () {},
-};
-
function SourceIcon(props) {
return
;
}
diff --git a/src/views/Edit/Wizard/Sources/InternalHLS.js b/src/views/Edit/Wizard/Sources/InternalHLS.js
index 929153f..ce53bca 100644
--- a/src/views/Edit/Wizard/Sources/InternalHLS.js
+++ b/src/views/Edit/Wizard/Sources/InternalHLS.js
@@ -20,10 +20,17 @@ const initSettings = (initialSettings, config) => {
return settings;
};
-function Source(props) {
- const config = S.func.initConfig(props.config);
- const settings = initSettings(props.settings, config);
- const skills = S.func.initSkills(props.skills);
+function Source({
+ settings = {},
+ knownDevices = [],
+ config = null,
+ skills = null,
+ onChange = function (type, settings, inputs, ready) {},
+ onRefresh = function () {},
+}) {
+ config = S.func.initConfig(config);
+ settings = initSettings(settings, config);
+ skills = S.func.initSkills(skills);
const handleChange = (newSettings) => {
newSettings = newSettings || settings;
@@ -31,7 +38,7 @@ function Source(props) {
const inputs = S.func.createInputs(newSettings, config, skills);
newSettings.address = inputs[0].address;
- props.onChange(S.id, newSettings, inputs, newSettings.address.length !== 0);
+ onChange(S.id, newSettings, inputs, newSettings.address.length !== 0);
};
React.useEffect(() => {
@@ -57,13 +64,6 @@ function Source(props) {
);
}
-Source.defaultProps = {
- settings: {},
- config: null,
- skills: null,
- onChange: function (type, settings, inputs, ready) {},
-};
-
function SourceIcon(props) {
return
;
}
diff --git a/src/views/Edit/Wizard/Sources/InternalRTMP.js b/src/views/Edit/Wizard/Sources/InternalRTMP.js
index f777551..22b9af7 100644
--- a/src/views/Edit/Wizard/Sources/InternalRTMP.js
+++ b/src/views/Edit/Wizard/Sources/InternalRTMP.js
@@ -26,12 +26,19 @@ const initSettings = (initialSettings, config) => {
return settings;
};
-function Source(props) {
+function Source({
+ settings = {},
+ knownDevices = [],
+ config = null,
+ skills = null,
+ onChange = function (type, settings, inputs, ready) {},
+ onRefresh = function () {},
+}) {
const { i18n } = useLingui();
const navigate = useNavigate();
- const config = S.func.initConfig(props.config);
- const settings = initSettings(props.settings, config);
- const skills = S.func.initSkills(props.skills);
+ config = S.func.initConfig(config);
+ settings = initSettings(settings, config);
+ skills = S.func.initSkills(skills);
const handleChange = (newSettings) => {
newSettings = newSettings || settings;
@@ -39,11 +46,11 @@ function Source(props) {
const inputs = S.func.createInputs(newSettings, config, skills);
newSettings.address = inputs[0].address;
- props.onChange(S.id, newSettings, inputs, config.rtmp.enabled);
+ onChange(S.id, newSettings, inputs, config.rtmp.enabled);
};
const handleRefresh = () => {
- props.onRefresh();
+ onRefresh();
};
const update = (what) => (event) => {
@@ -82,7 +89,7 @@ function Source(props) {
);
} else {
- const filteredDevices = props.knownDevices.filter((device) => device.media === 'rtmp');
+ const filteredDevices = knownDevices.filter((device) => device.media === 'rtmp');
const options = filteredDevices.map((device) => {
return (
@@ -136,15 +143,6 @@ function Source(props) {
return form;
}
-Source.defaultProps = {
- knownDevices: [],
- settings: {},
- config: null,
- skills: null,
- onChange: function (type, settings, inputs, ready) {},
- onRefresh: function () {},
-};
-
function SourceIcon(props) {
return ;
}
diff --git a/src/views/Edit/Wizard/Sources/InternalSRT.js b/src/views/Edit/Wizard/Sources/InternalSRT.js
index 0341c6c..f475535 100644
--- a/src/views/Edit/Wizard/Sources/InternalSRT.js
+++ b/src/views/Edit/Wizard/Sources/InternalSRT.js
@@ -26,12 +26,19 @@ const initSettings = (initialSettings, config) => {
return settings;
};
-function Source(props) {
+function Source({
+ settings = {},
+ knownDevices = [],
+ config = null,
+ skills = null,
+ onChange = function (type, settings, inputs, ready) {},
+ onRefresh = function () {},
+}) {
const { i18n } = useLingui();
const navigate = useNavigate();
- const config = S.func.initConfig(props.config);
- const settings = initSettings(props.settings, config);
- const skills = S.func.initSkills(props.skills);
+ config = S.func.initConfig(config);
+ settings = initSettings(settings, config);
+ skills = S.func.initSkills(skills);
const handleChange = (newSettings) => {
newSettings = newSettings || settings;
@@ -39,11 +46,11 @@ function Source(props) {
const inputs = S.func.createInputs(newSettings, config, skills);
newSettings.address = inputs[0].address;
- props.onChange(S.id, newSettings, inputs, config.srt.enabled);
+ onChange(S.id, newSettings, inputs, config.srt.enabled);
};
const handleRefresh = () => {
- props.onRefresh();
+ onRefresh();
};
const update = (what) => (event) => {
@@ -82,7 +89,7 @@ function Source(props) {
);
} else {
- const filteredDevices = props.knownDevices.filter((device) => device.media === 'srt');
+ const filteredDevices = knownDevices.filter((device) => device.media === 'srt');
const options = filteredDevices.map((device) => {
return (
@@ -136,13 +143,6 @@ function Source(props) {
return form;
}
-Source.defaultProps = {
- settings: {},
- config: null,
- skills: null,
- onChange: function (type, settings, inputs, ready) {},
-};
-
function SourceIcon(props) {
return ;
}
diff --git a/src/views/Edit/Wizard/Sources/Network.js b/src/views/Edit/Wizard/Sources/Network.js
index 88578c0..8279afe 100644
--- a/src/views/Edit/Wizard/Sources/Network.js
+++ b/src/views/Edit/Wizard/Sources/Network.js
@@ -19,15 +19,22 @@ const initSettings = (initialSettings, config) => {
return settings;
};
-function Source(props) {
- const config = S.func.initConfig(props.config);
- const settings = initSettings(props.settings, config);
- const skills = S.func.initSkills(props.skills);
+function Source({
+ settings = {},
+ knownDevices = [],
+ config = null,
+ skills = null,
+ onChange = function (type, settings, inputs, ready) {},
+ onRefresh = function () {},
+}) {
+ config = S.func.initConfig(config);
+ settings = initSettings(settings, config);
+ skills = S.func.initSkills(skills);
const handleChange = (newSettings) => {
newSettings = newSettings || settings;
- props.onChange(S.id, newSettings, S.func.createInputs(newSettings, config, skills), S.func.isValidURL(newSettings.address));
+ onChange(S.id, newSettings, S.func.createInputs(newSettings, config, skills), S.func.isValidURL(newSettings.address));
};
const update = (protocol, what) => (event) => {
@@ -107,13 +114,6 @@ function Source(props) {
);
}
-Source.defaultProps = {
- settings: {},
- config: null,
- skills: null,
- onChange: function (type, settings, inputs, ready) {},
-};
-
function SourceIcon(props) {
return ;
}
diff --git a/src/views/Edit/Wizard/Sources/Raspicam.js b/src/views/Edit/Wizard/Sources/Raspicam.js
index de92d24..1af32ed 100644
--- a/src/views/Edit/Wizard/Sources/Raspicam.js
+++ b/src/views/Edit/Wizard/Sources/Raspicam.js
@@ -48,14 +48,21 @@ function initDevices(initialDevices) {
return devices;
}
-function Source(props) {
- const settings = initSettings(props.settings, props.knownDevices);
- const devices = initDevices(props.knownDevices);
+function Source({
+ settings = {},
+ knownDevices = [],
+ config = null,
+ skills = null,
+ onChange = function (type, settings, inputs, ready) {},
+ onRefresh = function () {},
+}) {
+ const devices = initDevices(knownDevices);
+ settings = initSettings(settings, knownDevices);
const handleChange = (newSettings) => {
newSettings = newSettings || settings;
- props.onChange(S.id, newSettings, S.func.createInputs(newSettings), true);
+ onChange(S.id, newSettings, S.func.createInputs(newSettings), true);
};
const update = (what) => (event) => {
@@ -102,12 +109,6 @@ function Source(props) {
);
}
-Source.defaultProps = {
- knownDevices: [],
- settings: {},
- onChange: function (type, settings, inputs, ready) {},
-};
-
function SourceIcon(props) {
return ;
}
diff --git a/src/views/Edit/Wizard/Sources/V4L.js b/src/views/Edit/Wizard/Sources/V4L.js
index 7417a08..8d153b8 100644
--- a/src/views/Edit/Wizard/Sources/V4L.js
+++ b/src/views/Edit/Wizard/Sources/V4L.js
@@ -54,19 +54,26 @@ function initDevices(initialDevices) {
return devices;
}
-function Source(props) {
+function Source({
+ settings = {},
+ knownDevices = [],
+ config = null,
+ skills = null,
+ onChange = function (type, settings, inputs, ready) {},
+ onRefresh = function () {},
+}) {
const { i18n } = useLingui();
- const settings = initSettings(props.settings, props.knownDevices);
- const devices = initDevices(props.knownDevices);
+ const devices = initDevices(knownDevices);
+ settings = initSettings(settings, knownDevices);
const handleChange = (newSettings) => {
newSettings = newSettings || settings;
- props.onChange(S.id, newSettings, S.func.createInputs(newSettings), devices.length !== 0 ? true : false);
+ onChange(S.id, newSettings, S.func.createInputs(newSettings), devices.length !== 0 ? true : false);
};
const handleRefresh = () => {
- props.onRefresh();
+ onRefresh();
};
const update = (what) => (event) => {
@@ -124,13 +131,6 @@ function Source(props) {
);
}
-Source.defaultProps = {
- knownDevices: [],
- settings: {},
- onChange: function (type, settings, inputs, ready) {},
- onRefresh: function () {},
-};
-
function SourceIcon(props) {
return ;
}
diff --git a/src/views/Edit/Wizard/Video.js b/src/views/Edit/Wizard/Video.js
index f907dd1..192bbaa 100644
--- a/src/views/Edit/Wizard/Video.js
+++ b/src/views/Edit/Wizard/Video.js
@@ -13,21 +13,30 @@ import BoxText from '../../../misc/BoxText';
import Paper from '../../../misc/Paper';
import PaperHeader from '../../../misc/PaperHeader';
-export default function Video(props) {
+export default function Video({
+ onAbort = () => {},
+ onHelp = () => {},
+ onBack = () => {},
+ onNext = () => {},
+ sourceid = '',
+ status = '',
+ ready = false,
+ children = null,
+}) {
return (
- Video setup} onAbort={props.onAbort} onHelp={props.onHelp} />
+ Video setup} onAbort={onAbort} onHelp={onHelp} />
- {props.children}
+ {children}
- {props.status === 'error' && (
+ {status === 'error' && (
- {props.sourceid === 'rtmp' || props.sourceid === 'hls' ? (
+ {sourceid === 'rtmp' || sourceid === 'hls' ? (
No live stream was detected. Please check the software that sends the stream.
) : (
Failed to verify the source. Please check the address.
@@ -35,7 +44,7 @@ export default function Video(props) {
)}
- {props.status === 'nostream' && (
+ {status === 'nostream' && (
@@ -43,7 +52,7 @@ export default function Video(props) {
)}
- {props.status === 'nocoder' && (
+ {status === 'nocoder' && (
@@ -62,12 +71,12 @@ export default function Video(props) {
-
+
Back
-
+
Next
@@ -75,13 +84,3 @@ export default function Video(props) {
);
}
-
-Video.defaultProps = {
- onAbort: () => {},
- onHelp: () => {},
- onBack: () => {},
- onNext: () => {},
- sourceid: '',
- status: '',
- ready: false,
-};
diff --git a/src/views/Edit/Wizard/VideoProfile.js b/src/views/Edit/Wizard/VideoProfile.js
index 5eef427..a8743e5 100644
--- a/src/views/Edit/Wizard/VideoProfile.js
+++ b/src/views/Edit/Wizard/VideoProfile.js
@@ -10,10 +10,25 @@ import Paper from '../../../misc/Paper';
import PaperHeader from '../../../misc/PaperHeader';
import Select from '../../../misc/Select';
-export default function VideoProfile(props) {
+export default function VideoProfile({
+ onAbort = () => {},
+ onHelp = () => {},
+ onBack = () => {},
+ onNext = () => {},
+ compatible = false,
+ onStreamChange = () => {},
+ streamList = [],
+ stream = 0,
+ onDecoderChange = () => {},
+ decodersList = [],
+ decoder = '',
+ onEncoderChange = () => {},
+ encodersList = [],
+ encoder = '',
+}) {
return (
- Video setup} onAbort={props.onAbort} onHelp={props.onHelp} />
+ Video setup} onAbort={onAbort} onHelp={onHelp} />
@@ -24,13 +39,13 @@ export default function VideoProfile(props) {
- Profile} value={props.stream} onChange={props.onStreamChange}>
- {props.streamList}
+ Profile} value={stream} onChange={onStreamChange}>
+ {streamList}
- {props.compatible === false && (
+ {compatible === false && (
- {props.encodersList.length === 0 ? (
+ {encodersList.length === 0 ? (
Your stream needs to be encoded, but there's no suitable encoder available.
@@ -43,16 +58,16 @@ export default function VideoProfile(props) {
Your stream needs to be encoded. Choose the desired encoder:
- {props.decodersList.length >= 2 && (
+ {decodersList.length >= 2 && (
- Decoder} value={props.decoder} onChange={props.onDecoderChange}>
- {props.decodersList}
+ Decoder} value={decoder} onChange={onDecoderChange}>
+ {decodersList}
)}
- Encoder} value={props.encoder} onChange={props.onEncoderChange}>
- {props.encodersList}
+ Encoder} value={encoder} onChange={onEncoderChange}>
+ {encodersList}
@@ -63,18 +78,12 @@ export default function VideoProfile(props) {
-
+
Back
-
+
Next
@@ -82,20 +91,3 @@ export default function VideoProfile(props) {
);
}
-
-VideoProfile.defaultProps = {
- onAbort: () => {},
- onHelp: () => {},
- onBack: () => {},
- onNext: () => {},
- compatible: false,
- onStreamChange: () => {},
- streamList: [],
- stream: 0,
- onDecoderChange: () => {},
- decodersList: [],
- decoder: '',
- onEncoderChange: () => {},
- encodersList: [],
- encoder: '',
-};
diff --git a/src/views/Edit/Wizard/index.js b/src/views/Edit/Wizard/index.js
index 0aa0113..7369531 100644
--- a/src/views/Edit/Wizard/index.js
+++ b/src/views/Edit/Wizard/index.js
@@ -29,7 +29,7 @@ import Probe from './Probe';
import License from './License';
import Metadata from './Metadata';
-export default function Wizard(props) {
+export default function Wizard({ restreamer = null }) {
const { i18n } = useLingui();
const navigate = useNavigate();
const { channelid: _channelid } = useParams();
@@ -69,22 +69,22 @@ export default function Wizard(props) {
}, [navigate, $invalid]);
const load = async () => {
- const channelid = props.restreamer.SelectChannel(_channelid);
+ const channelid = restreamer.SelectChannel(_channelid);
if (channelid === '' || channelid !== _channelid) {
setInvalid(true);
return;
}
- const skills = await props.restreamer.Skills();
+ const skills = await restreamer.Skills();
setSkills(skills);
- const config = await props.restreamer.ConfigActive();
+ const config = await restreamer.ConfigActive();
setConfig(config);
setData({
...$data,
meta: {
- name: props.restreamer.GetChannel(_channelid).name,
+ name: restreamer.GetChannel(_channelid).name,
},
});
@@ -92,9 +92,9 @@ export default function Wizard(props) {
};
const refreshSkills = async () => {
- await props.restreamer.RefreshSkills();
+ await restreamer.RefreshSkills();
- const skills = await props.restreamer.Skills();
+ const skills = await restreamer.Skills();
setSkills(skills);
};
@@ -105,7 +105,7 @@ export default function Wizard(props) {
status: 'none',
});
- let [res, err] = await props.restreamer.Probe(_channelid, source.inputs);
+ let [res, err] = await restreamer.Probe(_channelid, source.inputs);
if (err !== null) {
res = {
streams: [],
@@ -179,23 +179,23 @@ export default function Wizard(props) {
data.streams = M.createOutputStreams(sources, profiles);
- const [, err] = await props.restreamer.UpsertIngest(_channelid, global, inputs, outputs, control);
+ const [, err] = await restreamer.UpsertIngest(_channelid, global, inputs, outputs, control);
if (err !== null) {
notify.Dispatch('error', 'save:ingest', err.message);
return false;
}
// Save the metadata
- await props.restreamer.SetIngestMetadata(_channelid, data);
+ await restreamer.SetIngestMetadata(_channelid, data);
// Create update the ingest snapshot process
- await props.restreamer.UpsertIngestSnapshot(_channelid, control);
+ await restreamer.UpsertIngestSnapshot(_channelid, control);
// Create/update the player
- await props.restreamer.UpdatePlayer(_channelid);
+ await restreamer.UpdatePlayer(_channelid);
// Create/update the playersite
- await props.restreamer.UpdatePlayersite();
+ await restreamer.UpdatePlayersite();
notify.Dispatch('success', 'save:ingest', i18n._(t`Main channel saved`));
@@ -275,7 +275,7 @@ export default function Wizard(props) {
{s.name}