// This content populates the video variant modal, which is spawned from the variants table. import React from 'react'; import { Slider, Select, Switch, Divider, Collapse } from 'antd'; import { FieldUpdaterFunc, PRESET, VideoVariant } from '../../../types/config-section'; import { ENCODER_PRESETS, DEFAULT_VARIANT_STATE } from './constants'; import InfoTip from '../info-tip'; const { Option } = Select; const { Panel } = Collapse; const VIDEO_VARIANT_DEFAULTS = { framerate: { min: 10, max: 80, defaultValue: 24, unit: 'fps', incrementBy: 1, tip: 'You prob wont need to touch this unless youre a hardcore gamer and need all the bitties', }, videoBitrate: { min: 600, max: 1200, defaultValue: 800, unit: 'kbps', incrementBy: 100, tip: 'This is importatnt yo', }, audioBitrate: { min: 600, max: 1200, defaultValue: 800, unit: 'kbps', incrementBy: 100, tip: 'nothing to see here' }, encoderPreset: { defaultValue: ENCODER_PRESETS[2], tip: 'Info and stuff.' }, videoPassthrough: { tip: 'If No is selected, then you should set your desired Video Bitrate.' }, audioPassthrough: { tip: 'If No is selected, then you should set your desired Audio Bitrate.' }, }; interface VideoVariantFormProps { dataState: VideoVariant; onUpdateField: FieldUpdaterFunc; } /* CPU Usage slider { 'ultrafast': 'lowest cpu, lowest quality', 'superfast': 'lower cpu, lower quality', 'veryfast': 'medium cpu, medium quality', 'faster': 'higher cpu, higher quality', 'fast': 'highest cpu, highest quality' } */ export default function VideoVariantForm({ dataState = DEFAULT_VARIANT_STATE, onUpdateField }: VideoVariantFormProps) { const handleFramerateChange = (value: number) => { onUpdateField({ fieldName: 'framerate', value }); }; const handleVideoBitrateChange = (value: number) => { onUpdateField({ fieldName: 'videoBitrate', value }); }; const handleAudioBitrateChange = (value: number) => { onUpdateField({ fieldName: 'audioBitrate', value }); }; const handleEncoderPresetChange = (value: PRESET) => { onUpdateField({ fieldName: 'encoderPreset', value }); }; const handleAudioPassChange = (value: boolean) => { onUpdateField({ fieldName: 'audioPassthrough', value }); }; const handleVideoPassChange = (value: boolean) => { onUpdateField({ fieldName: 'videoPassthrough', value }); }; const framerateDefaults = VIDEO_VARIANT_DEFAULTS.framerate; const framerateMin = framerateDefaults.min; const framerateMax = framerateDefaults.max; const framerateUnit = framerateDefaults.unit; const encoderDefaults = VIDEO_VARIANT_DEFAULTS.encoderPreset; const videoBitrateDefaults = VIDEO_VARIANT_DEFAULTS.videoBitrate; const videoBRMin = videoBitrateDefaults.min; const videoBRMax = videoBitrateDefaults.max; const videoBRUnit = videoBitrateDefaults.unit; const audioBitrateDefaults = VIDEO_VARIANT_DEFAULTS.audioBitrate; const audioBRMin = audioBitrateDefaults.min; const audioBRMax = audioBitrateDefaults.max; const audioBRUnit = audioBitrateDefaults.unit; const selectedVideoBRnote = `Selected: ${dataState.videoBitrate}${videoBRUnit} - it sucks`; const selectedAudioBRnote = `Selected: ${dataState.audioBitrate}${audioBRUnit} - too slow`; const selectedFramerateNote = `Selected: ${dataState.framerate}${framerateUnit} - whoa there`; const selectedPresetNote = ''; return (