The swiss army knife of lossless video/audio editing
Merge remote-tracking branch 'origin/master' into claude/copy-metadata-from-track
Claudebf835d9f067b
diff --cc src/renderer/src/StreamsSelector.tsxindex 31315793,39f65be1..e235c189--- a/src/renderer/src/StreamsSelector.tsx+++ b/src/renderer/src/StreamsSelector.tsx@@@ -15,8 -15,8 +15,8 @@@ import AutoExportToggler from './componimport Select from './components/Select';import type { FileStream } from './ffmpeg';import { getStreamFps } from './ffmpeg';- import { getActiveDisposition, attachedPicDisposition, isGpsStream, isMov } from './util/streams';+ import { getActiveDisposition, attachedPicDisposition, isGpsStream, isMov, hasFileEdits, hasStreamEdits } from './util/streams';-import { fileMetadataKeys, getCodecTagSuggestions, getLanguageSuggestions, getNonNativeMovMetadataKeys, isValidCodecTag, isValidCreationTime, isValidLanguageCode, needsHvc1Tag, streamMetadataKeys } from './util/metadata';+import { fileMetadataKeys, getCodecTagSuggestions, getCopyableMetadata, getEffectiveMetadata, getLanguageSuggestions, getNonNativeMovMetadataKeys, isValidCodecTag, isValidCreationTime, isValidLanguageCode, needsHvc1Tag, streamMetadataKeys } from './util/metadata';import useUserSettings from './hooks/useUserSettings';import TagEditor, { cancelTagEditOnEscape, type TagInfo } from './components/TagEditor';import SuggestionTextField from './components/SuggestionTextField';@@@ -28,16 -28,30 +28,38 @@@ import styles from './StreamsSelector.mimport Json5Dialog from './components/Json5Dialog';import GpsMap from './components/GpsMap';import Switch from './components/Switch';+ import type { ConfirmDialog } from './components/GenericDialog';+const { basename } = window.require('node:path');++// for "Copy from": the source's metadata including the user's changes, without muxer-written keys+function getCopyFromSource({ key, getLabel, existing, custom }: { key: string, getLabel: (metadata: Record<string, string>) => string, existing: Record<string, string> | undefined, custom: Record<string, string> | undefined }) {+ const metadata = getCopyableMetadata(getEffectiveMetadata(existing, custom));+ return Object.keys(metadata).length > 0 ? { key, label: getLabel(metadata), metadata } : [];+}++ type ResetParams = (path: string, streamId?: number) => void;++ // highlighted when there are changes+ function EditButton({ title, onClick, highlighted }: { title: string, onClick: () => void, highlighted: boolean }) {+ return <Button title={title} onClick={onClick}><FaEdit style={{ verticalAlign: 'middle', color: highlighted ? 'var(--accent-11)' : undefined }} /></Button>;+ }++ // Without streamId: resets the file's own params (not its tracks). Keeps disposition (see hasStreamEdits)+ function resetParamsDraft(fileParams: FileParams, streamId?: number) {+ if (streamId == null) {+ // eslint-disable-next-line no-param-reassign+ fileParams.metadata = {};+ // eslint-disable-next-line no-param-reassign+ delete fileParams.offset;+ return;+ }+ const disposition = fileParams.paramsByStream.get(streamId)?.disposition;+ if (disposition != null) fileParams.paramsByStream.set(streamId, { metadata: {}, disposition });+ else fileParams.paramsByStream.delete(streamId);+ }+type UpdateStreamParams = (fileId: string, streamId: number, setter: (a: StreamParams) => void) => void;interface EditingStream {