mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-03 03:11:40 +00:00
Compare commits
3 commits
21e5a4dfd2
...
8bc45cda3b
| Author | SHA1 | Date | |
|---|---|---|---|
| 8bc45cda3b | |||
| e154810b21 | |||
| 0f22b9fbd7 |
3 changed files with 20 additions and 14 deletions
|
|
@ -224,16 +224,22 @@ export const RightControls = () => {
|
||||||
icon={
|
icon={
|
||||||
playbackSettings.mpvProperties.audioChannels === 'mono'
|
playbackSettings.mpvProperties.audioChannels === 'mono'
|
||||||
? 'volumeNormal'
|
? 'volumeNormal'
|
||||||
: 'volumeMax'
|
: playbackSettings.mpvProperties.audioChannels === 'stereo'
|
||||||
|
? 'volumeMax'
|
||||||
|
: 'volumeMute'
|
||||||
}
|
}
|
||||||
iconProps={{
|
iconProps={{
|
||||||
size: 'lg',
|
size: 'lg',
|
||||||
}}
|
}}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const current =
|
const current = playbackSettings.mpvProperties.audioChannels || 'auto';
|
||||||
playbackSettings.mpvProperties.audioChannels || 'stereo';
|
const next =
|
||||||
const next = current === 'mono' ? 'stereo' : 'mono';
|
current === 'auto'
|
||||||
|
? 'mono'
|
||||||
|
: current === 'mono'
|
||||||
|
? 'stereo'
|
||||||
|
: 'auto';
|
||||||
setSettings({
|
setSettings({
|
||||||
playback: {
|
playback: {
|
||||||
...playbackSettings,
|
...playbackSettings,
|
||||||
|
|
@ -245,15 +251,15 @@ export const RightControls = () => {
|
||||||
});
|
});
|
||||||
// Apply to MPV immediately
|
// Apply to MPV immediately
|
||||||
mpvPlayer?.setProperties({
|
mpvPlayer?.setProperties({
|
||||||
'audio-channels': next,
|
'audio-channels': next === 'auto' ? undefined : next,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
size="sm"
|
size="sm"
|
||||||
tooltip={{
|
tooltip={{
|
||||||
label:
|
label:
|
||||||
playbackType === PlaybackType.WEB
|
playbackType === PlaybackType.WEB
|
||||||
? `Audio: ${playbackSettings.mpvProperties.audioChannels || 'stereo'} (MPV only)`
|
? `Audio: ${playbackSettings.mpvProperties.audioChannels || 'auto'} (MPV only)`
|
||||||
: `Audio: ${playbackSettings.mpvProperties.audioChannels || 'stereo'}`,
|
: `Audio: ${playbackSettings.mpvProperties.audioChannels || 'auto'}`,
|
||||||
openDelay: 0,
|
openDelay: 0,
|
||||||
}}
|
}}
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ export const getMpvSetting = (
|
||||||
) => {
|
) => {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case 'audioChannels':
|
case 'audioChannels':
|
||||||
return { 'audio-channels': value };
|
return { 'audio-channels': value === 'auto' ? undefined : value };
|
||||||
case 'audioExclusiveMode':
|
case 'audioExclusiveMode':
|
||||||
return { 'audio-exclusive': value || 'no' };
|
return { 'audio-exclusive': value || 'no' };
|
||||||
case 'audioSampleRateHz':
|
case 'audioSampleRateHz':
|
||||||
|
|
@ -55,7 +55,7 @@ export const getMpvSetting = (
|
||||||
|
|
||||||
export const getMpvProperties = (settings: SettingsState['playback']['mpvProperties']) => {
|
export const getMpvProperties = (settings: SettingsState['playback']['mpvProperties']) => {
|
||||||
const properties: Record<string, any> = {
|
const properties: Record<string, any> = {
|
||||||
'audio-channels': settings.audioChannels || 'stereo',
|
'audio-channels': settings.audioChannels === 'auto' ? undefined : settings.audioChannels,
|
||||||
'audio-exclusive': settings.audioExclusiveMode || 'no',
|
'audio-exclusive': settings.audioExclusiveMode || 'no',
|
||||||
'audio-samplerate':
|
'audio-samplerate':
|
||||||
settings.audioSampleRateHz === 0 ? undefined : settings.audioSampleRateHz,
|
settings.audioSampleRateHz === 0 ? undefined : settings.audioSampleRateHz,
|
||||||
|
|
@ -278,15 +278,15 @@ export const MpvSettings = () => {
|
||||||
control: (
|
control: (
|
||||||
<Select
|
<Select
|
||||||
data={[
|
data={[
|
||||||
|
{ label: 'Auto', value: 'auto' },
|
||||||
{ label: 'Mono', value: 'mono' },
|
{ label: 'Mono', value: 'mono' },
|
||||||
{ label: 'Stereo', value: 'stereo' },
|
{ label: 'Stereo', value: 'stereo' },
|
||||||
]}
|
]}
|
||||||
defaultValue={settings.mpvProperties.audioChannels || 'stereo'}
|
defaultValue={settings.mpvProperties.audioChannels || 'auto'}
|
||||||
onChange={(e) => handleSetMpvProperty('audioChannels', e)}
|
onChange={(e) => handleSetMpvProperty('audioChannels', e)}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
description:
|
description: 'Select the audio channel mode. Auto lets MPV decide based on the source.',
|
||||||
'Select the audio channel mode. Stereo is the default, mono downmixes to a single channel.',
|
|
||||||
isHidden: settings.type !== PlaybackType.LOCAL,
|
isHidden: settings.type !== PlaybackType.LOCAL,
|
||||||
title: 'Audio Channels',
|
title: 'Audio Channels',
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ const TranscodingConfigSchema = z.object({
|
||||||
});
|
});
|
||||||
|
|
||||||
const MpvSettingsSchema = z.object({
|
const MpvSettingsSchema = z.object({
|
||||||
audioChannels: z.enum(['mono', 'stereo']).optional(),
|
audioChannels: z.enum(['auto', 'mono', 'stereo']).optional(),
|
||||||
audioExclusiveMode: z.enum(['no', 'yes']),
|
audioExclusiveMode: z.enum(['no', 'yes']),
|
||||||
audioFormat: z.enum(['float', 's16', 's32']).optional(),
|
audioFormat: z.enum(['float', 's16', 's32']).optional(),
|
||||||
audioSampleRateHz: z.number().optional(),
|
audioSampleRateHz: z.number().optional(),
|
||||||
|
|
@ -658,7 +658,7 @@ const initialState: SettingsState = {
|
||||||
mediaSession: false,
|
mediaSession: false,
|
||||||
mpvExtraParameters: [],
|
mpvExtraParameters: [],
|
||||||
mpvProperties: {
|
mpvProperties: {
|
||||||
audioChannels: 'stereo',
|
audioChannels: 'auto',
|
||||||
audioExclusiveMode: 'no',
|
audioExclusiveMode: 'no',
|
||||||
audioFormat: undefined,
|
audioFormat: undefined,
|
||||||
audioSampleRateHz: 48000,
|
audioSampleRateHz: 48000,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue