The swiss army knife of lossless video/audio editing
refactor
Mikael Finstad08e29b2135f0
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsxindex f2318b95..44a9bc29 100644--- a/src/renderer/src/App.tsx+++ b/src/renderer/src/App.tsx@@ -340,7 +340,7 @@ function App() {const isRotationSet = rotation !== 360;const effectiveRotation = useMemo(() => (isRotationSet ? rotation : (activeVideoStream?.tags?.rotate ? parseInt(activeVideoStream.tags.rotate, 10) : undefined)), [isRotationSet, activeVideoStream, rotation]);- const zoomRel = useCallback((rel) => setZoom((z) => Math.min(Math.max(z + (rel * (1 + (z / 10))), 1), zoomMax)), []);+ const zoomRel = useCallback((rel: number) => setZoom((z) => Math.min(Math.max(z + (rel * (1 + (z / 10))), 1), zoomMax)), []);const compatPlayerRequired = usingDummyVideo;const compatPlayerWanted = (isRotationSet || activeVideoStreamIndex != null || activeAudioStreamIndex != null) && !hideMediaSourcePlayer;const compatPlayerEnabled = (compatPlayerRequired || compatPlayerWanted) && (activeVideoStream != null || activeAudioStream != null);@@ -662,13 +662,13 @@ function App() {}, [setWorking, subtitleStreams, subtitlesByStreamId, filePath]);const onActiveVideoStreamChange = useCallback((index?: number) => {- if (!videoRef.current) throw new Error();+ invariant(videoRef.current);setHideMediaSourcePlayer(index == null || getVideoTrackForStreamIndex(videoRef.current, index) != null);enableVideoTrack(videoRef.current, index);setActiveVideoStreamIndex(index);}, []);const onActiveAudioStreamChange = useCallback((index?: number) => {- if (!videoRef.current) throw new Error();+ invariant(videoRef.current);setHideMediaSourcePlayer(index == null || getAudioTrackForStreamIndex(videoRef.current, index) != null);enableAudioTrack(videoRef.current, index);setActiveAudioStreamIndex(index);@@ -2649,7 +2649,9 @@ function App() {<div className="no-user-select" style={{ position: 'absolute', right: 0, bottom: 0, marginBottom: 10, display: 'flex', alignItems: 'center' }}><VolumeControl playbackVolume={playbackVolume} setPlaybackVolume={setPlaybackVolume} onToggleMutedClick={toggleMuted} />- {shouldShowPlaybackStreamSelector && <PlaybackStreamSelector subtitleStreams={subtitleStreams} videoStreams={videoStreams} audioStreams={audioStreams} activeSubtitleStreamIndex={activeSubtitleStreamIndex} activeVideoStreamIndex={activeVideoStreamIndex} activeAudioStreamIndex={activeAudioStreamIndex} onActiveSubtitleChange={onActiveSubtitleChange} onActiveVideoStreamChange={onActiveVideoStreamChange} onActiveAudioStreamChange={onActiveAudioStreamChange} />}+ {shouldShowPlaybackStreamSelector && (+ <PlaybackStreamSelector subtitleStreams={subtitleStreams} videoStreams={videoStreams} audioStreams={audioStreams} activeSubtitleStreamIndex={activeSubtitleStreamIndex} activeVideoStreamIndex={activeVideoStreamIndex} activeAudioStreamIndex={activeAudioStreamIndex} onActiveSubtitleChange={onActiveSubtitleChange} onActiveVideoStreamChange={onActiveVideoStreamChange} onActiveAudioStreamChange={onActiveAudioStreamChange} />+ )}{compatPlayerEnabled && <div style={{ color: 'white', opacity: 0.7, padding: '.5em' }} role="button" onClick={() => incrementMediaSourceQuality()} title={t('Select playback quality')}>{mediaSourceQualities[mediaSourceQuality]}</div>}