Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 118 additions & 19 deletions src_assets/common/assets/web/configs/tabs/Advanced.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,57 @@ watch(isWGCSelected, (newValue) => {
checkSunshineMode()
}
})

// === 编解码器策略(HEVC + AV1 整合 UI) ===
// 底层仍写入 hevc_mode / av1_mode(保持 sunshine.conf 兼容),UI 层用一个策略 +
// 一个 HDR 复选框推算两者的值。
const showCodecAdvanced = ref(false)

// 把 config.value.hevc_mode / av1_mode 转成 number,便于比较(旧值可能是 string)
const hevcModeNum = computed(() => Number(config.value.hevc_mode ?? 0))
const av1ModeNum = computed(() => Number(config.value.av1_mode ?? 0))

const codecStrategy = computed({
get() {
const h = hevcModeNum.value
const a = av1ModeNum.value
if (h === 0 && a === 0) return 'auto'
if (h === 1 && a === 1) return 'h264_only'
// modern: 都通告(值为 2 或 3 都算 modern;HDR 由 enableHdr 单独决定)
if ((h === 2 || h === 3) && (a === 2 || a === 3)) return 'modern'
return 'custom'
},
set(v) {
if (v === 'auto') {
config.value.hevc_mode = 0
config.value.av1_mode = 0
} else if (v === 'h264_only') {
config.value.hevc_mode = 1
config.value.av1_mode = 1
} else if (v === 'modern') {
const hdr = enableHdr.value
config.value.hevc_mode = hdr ? 3 : 2
config.value.av1_mode = hdr ? 3 : 2
}
// 'custom' → 不修改值,由用户在展开区编辑
},
})

// 当任意 codec 选择 mode 3(含 10-bit/HDR),即视为开启 HDR 通告
const enableHdr = computed({
get() {
return hevcModeNum.value === 3 || av1ModeNum.value === 3
},
set(v) {
// 仅在"现代编码器"策略下生效
if (codecStrategy.value !== 'modern') return
config.value.hevc_mode = v ? 3 : 2
config.value.av1_mode = v ? 3 : 2
},
})

// HDR 复选框是否可用(只有 modern 策略下才有意义)
const hdrToggleDisabled = computed(() => codecStrategy.value !== 'modern')
</script>

<template>
Expand All @@ -129,28 +180,76 @@ watch(isWGCSelected, (newValue) => {
<div class="form-text">{{ $t('config.min_threads_desc') }}</div>
</div>

<!-- HEVC Support -->
<!-- Codec Strategy (整合 HEVC + AV1) -->
<div class="mb-3">
<label for="hevc_mode" class="form-label">{{ $t('config.hevc_mode') }}</label>
<select id="hevc_mode" class="form-select" v-model="config.hevc_mode">
<option value="0">{{ $t('config.hevc_mode_0') }}</option>
<option value="1">{{ $t('config.hevc_mode_1') }}</option>
<option value="2">{{ $t('config.hevc_mode_2') }}</option>
<option value="3">{{ $t('config.hevc_mode_3') }}</option>
<label for="codec_strategy" class="form-label">{{ $t('config.codec_strategy') }}</label>
<select id="codec_strategy" class="form-select" v-model="codecStrategy">
<option value="auto">{{ $t('config.codec_strategy_auto') }}</option>
<option value="modern">{{ $t('config.codec_strategy_modern') }}</option>
<option value="h264_only">{{ $t('config.codec_strategy_h264') }}</option>
<option value="custom" disabled v-if="codecStrategy !== 'custom'">
{{ $t('config.codec_strategy_custom_locked') }}
</option>
<option value="custom" v-else>{{ $t('config.codec_strategy_custom') }}</option>
</select>
<div class="form-text">{{ $t('config.hevc_mode_desc') }}</div>
</div>

<!-- AV1 Support -->
<div class="mb-3">
<label for="av1_mode" class="form-label">{{ $t('config.av1_mode') }}</label>
<select id="av1_mode" class="form-select" v-model="config.av1_mode">
<option value="0">{{ $t('config.av1_mode_0') }}</option>
<option value="1">{{ $t('config.av1_mode_1') }}</option>
<option value="2">{{ $t('config.av1_mode_2') }}</option>
<option value="3">{{ $t('config.av1_mode_3') }}</option>
</select>
<div class="form-text">{{ $t('config.av1_mode_desc') }}</div>
<div class="form-check mt-2">
<input
class="form-check-input"
type="checkbox"
id="codec_enable_hdr"
v-model="enableHdr"
:disabled="hdrToggleDisabled"
/>
<label class="form-check-label" for="codec_enable_hdr">
{{ $t('config.codec_enable_hdr') }}
</label>
<div class="form-text" v-if="hdrToggleDisabled">
{{ $t('config.codec_enable_hdr_disabled_hint') }}
</div>
</div>

<div class="form-text">{{ $t('config.codec_strategy_desc') }}</div>

<!-- 偏离推荐值时给出温和提示 -->
<div class="alert alert-warning py-2 mt-2 mb-0" v-if="codecStrategy !== 'auto'">
<small>{{ $t('config.codec_strategy_non_default_warning') }}</small>
</div>

<!-- 高级(专家模式):原 HEVC / AV1 dropdown -->
<div class="mt-2">
<button
type="button"
class="btn btn-sm btn-outline-secondary"
@click="showCodecAdvanced = !showCodecAdvanced"
>
{{ showCodecAdvanced ? $t('config.codec_advanced_hide') : $t('config.codec_advanced_show') }}
</button>
</div>

<div v-if="showCodecAdvanced" class="mt-3 ps-3 border-start">
<div class="mb-3">
Comment thread
coderabbitai[bot] marked this conversation as resolved.
<label for="hevc_mode" class="form-label">{{ $t('config.hevc_mode') }}</label>
<select id="hevc_mode" class="form-select" v-model="config.hevc_mode">
<option value="0">{{ $t('config.hevc_mode_0') }}</option>
<option value="1">{{ $t('config.hevc_mode_1') }}</option>
<option value="2">{{ $t('config.hevc_mode_2') }}</option>
<option value="3">{{ $t('config.hevc_mode_3') }}</option>
</select>
<div class="form-text">{{ $t('config.hevc_mode_desc') }}</div>
</div>

<div class="mb-0">
<label for="av1_mode" class="form-label">{{ $t('config.av1_mode') }}</label>
<select id="av1_mode" class="form-select" v-model="config.av1_mode">
<option value="0">{{ $t('config.av1_mode_0') }}</option>
<option value="1">{{ $t('config.av1_mode_1') }}</option>
<option value="2">{{ $t('config.av1_mode_2') }}</option>
<option value="3">{{ $t('config.av1_mode_3') }}</option>
</select>
<div class="form-text">{{ $t('config.av1_mode_desc') }}</div>
</div>
</div>
</div>

<!-- Capture -->
Expand Down
14 changes: 12 additions & 2 deletions src_assets/common/assets/web/public/assets/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,18 @@
"av1_mode_1": "Sunshine will not advertise support for AV1",
"av1_mode_2": "Sunshine will advertise support for AV1 Main 8-bit profile",
"av1_mode_3": "Sunshine will advertise support for AV1 Main 8-bit and 10-bit (HDR) profiles",
"av1_mode_desc": "Allows the client to request AV1 Main 8-bit or 10-bit video streams. AV1 is more CPU-intensive to encode, so enabling this may reduce performance when using software encoding.",
"back_button_timeout": "Home/Guide Button Emulation Timeout",
"av1_mode_desc": "Allows the client to request AV1 Main 8-bit or 10-bit video streams. AV1 is more CPU-intensive to encode, so enabling this may reduce performance when using software encoding.", "codec_strategy": "Video codec strategy",
"codec_strategy_auto": "Automatic (recommended)",
"codec_strategy_modern": "Prefer modern codecs (HEVC + AV1)",
"codec_strategy_h264": "H.264 only (maximum compatibility)",
"codec_strategy_custom": "Custom (configure below)",
"codec_strategy_custom_locked": "Custom (click 'Show advanced options' to edit)",
"codec_strategy_desc": "Controls which video codecs Sunshine advertises to Moonlight. The default 'Automatic' picks based on encoder capability and is right for ~99% of users. Switch to 'H.264 only' if your client shows a black/green screen or HDR colors look wrong.",
"codec_strategy_non_default_warning": "You are using a non-default strategy. Some clients may fail to connect or fall back to a lower quality. Restore 'Automatic (recommended)' if you encounter issues.",
"codec_enable_hdr": "Also advertise HDR / 10-bit profiles",
"codec_enable_hdr_disabled_hint": "HDR is only adjustable under 'Prefer modern codecs'. 'Automatic' decides this for you based on encoder capability.",
"codec_advanced_show": "Show advanced options (configure HEVC / AV1 separately)",
"codec_advanced_hide": "Hide advanced options", "back_button_timeout": "Home/Guide Button Emulation Timeout",
"back_button_timeout_desc": "If the Back/Select button is held down for the specified number of milliseconds, a Home/Guide button press is emulated. If set to a value < 0 (default), holding the Back/Select button will not emulate the Home/Guide button.",
"bind_address": "Bind address (test feature)",
"bind_address_desc": "Set the specific IP address Sunshine will bind to. If left blank, Sunshine will bind to all available addresses.",
Expand Down
14 changes: 12 additions & 2 deletions src_assets/common/assets/web/public/assets/locale/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,18 @@
"av1_mode_1": "Sunshine will not advertise support for AV1",
"av1_mode_2": "Sunshine will advertise support for AV1 Main 8-bit profile",
"av1_mode_3": "Sunshine will advertise support for AV1 Main 8-bit and 10-bit (HDR) profiles",
"av1_mode_desc": "Allows the client to request AV1 Main 8-bit or 10-bit video streams. AV1 is more CPU-intensive to encode, so enabling this may reduce performance when using software encoding.",
"back_button_timeout": "Home/Guide Button Emulation Timeout",
"av1_mode_desc": "Allows the client to request AV1 Main 8-bit or 10-bit video streams. AV1 is more CPU-intensive to encode, so enabling this may reduce performance when using software encoding.", "codec_strategy": "Video codec strategy",
"codec_strategy_auto": "Automatic (recommended)",
"codec_strategy_modern": "Prefer modern codecs (HEVC + AV1)",
"codec_strategy_h264": "H.264 only (maximum compatibility)",
"codec_strategy_custom": "Custom (configure below)",
"codec_strategy_custom_locked": "Custom (click 'Show advanced options' to edit)",
"codec_strategy_desc": "Controls which video codecs Sunshine advertises to Moonlight. The default 'Automatic' picks based on encoder capability and is right for ~99% of users. Switch to 'H.264 only' if your client shows a black/green screen or HDR colors look wrong.",
"codec_strategy_non_default_warning": "You are using a non-default strategy. Some clients may fail to connect or fall back to a lower quality. Restore 'Automatic (recommended)' if you encounter issues.",
"codec_enable_hdr": "Also advertise HDR / 10-bit profiles",
"codec_enable_hdr_disabled_hint": "HDR is only adjustable under 'Prefer modern codecs'. 'Automatic' decides this for you based on encoder capability.",
"codec_advanced_show": "Show advanced options (configure HEVC / AV1 separately)",
"codec_advanced_hide": "Hide advanced options", "back_button_timeout": "Home/Guide Button Emulation Timeout",
"back_button_timeout_desc": "If the Back/Select button is held down for the specified number of milliseconds, a Home/Guide button press is emulated. If set to a value < 0 (default), holding the Back/Select button will not emulate the Home/Guide button.",
"bind_address": "Bind address (test feature)",
"bind_address_desc": "Set the specific IP address Sunshine will bind to. If left blank, Sunshine will bind to all available addresses.",
Expand Down
14 changes: 12 additions & 2 deletions src_assets/common/assets/web/public/assets/locale/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,18 @@
"av1_mode_1": "Sunshine will not advertise support for AV1",
"av1_mode_2": "Sunshine will advertise support for AV1 Main 8-bit profile",
"av1_mode_3": "Sunshine will advertise support for AV1 Main 8-bit and 10-bit (HDR) profiles",
"av1_mode_desc": "Allows the client to request AV1 Main 8-bit or 10-bit video streams. AV1 is more CPU-intensive to encode, so enabling this may reduce performance when using software encoding.",
"back_button_timeout": "Home/Guide Button Emulation Timeout",
"av1_mode_desc": "Allows the client to request AV1 Main 8-bit or 10-bit video streams. AV1 is more CPU-intensive to encode, so enabling this may reduce performance when using software encoding.", "codec_strategy": "Video codec strategy",
"codec_strategy_auto": "Automatic (recommended)",
"codec_strategy_modern": "Prefer modern codecs (HEVC + AV1)",
"codec_strategy_h264": "H.264 only (maximum compatibility)",
"codec_strategy_custom": "Custom (configure below)",
"codec_strategy_custom_locked": "Custom (click 'Show advanced options' to edit)",
"codec_strategy_desc": "Controls which video codecs Sunshine advertises to Moonlight. The default 'Automatic' picks based on encoder capability and is right for ~99% of users. Switch to 'H.264 only' if your client shows a black/green screen or HDR colors look wrong.",
"codec_strategy_non_default_warning": "You are using a non-default strategy. Some clients may fail to connect or fall back to a lower quality. Restore 'Automatic (recommended)' if you encounter issues.",
"codec_enable_hdr": "Also advertise HDR / 10-bit profiles",
"codec_enable_hdr_disabled_hint": "HDR is only adjustable under 'Prefer modern codecs'. 'Automatic' decides this for you based on encoder capability.",
"codec_advanced_show": "Show advanced options (configure HEVC / AV1 separately)",
"codec_advanced_hide": "Hide advanced options", "back_button_timeout": "Home/Guide Button Emulation Timeout",
"back_button_timeout_desc": "If the Back/Select button is held down for the specified number of milliseconds, a Home/Guide button press is emulated. If set to a value < 0 (default), holding the Back/Select button will not emulate the Home/Guide button.",
"bind_address": "Bind address (test feature)",
"bind_address_desc": "Set the specific IP address Sunshine will bind to. If left blank, Sunshine will bind to all available addresses.",
Expand Down
12 changes: 12 additions & 0 deletions src_assets/common/assets/web/public/assets/locale/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,18 @@
"av1_mode_2": "通告 AV1 Main 8-bit 配置支持",
"av1_mode_3": "通告 AV1 Main 8-bit 和 10-bit (HDR) 配置支持",
"av1_mode_desc": "允许客户端请求 AV1 Main 8-bit 或 10-bit 视频流。AV1 编码对 CPU 要求较高,使用软件编码时启用可能会影响性能。",
"codec_strategy": "视频编解码器策略",
"codec_strategy_auto": "自动(推荐)",
"codec_strategy_modern": "优先现代编码器(HEVC + AV1)",
"codec_strategy_h264": "仅 H.264(最大兼容)",
"codec_strategy_custom": "自定义(在下方分别设置)",
"codec_strategy_custom_locked": "自定义(点“显示高级选项”后可编辑)",
"codec_strategy_desc": "控制 Sunshine 向 Moonlight 客户端通告哪些视频编码格式。默认跳动【自动】按编码器能力选择,99% 的用户不需要修改。如果客户端出现黑屏 / 花屏 / HDR 偏色,可以切到【仅 H.264】或默认【自动】。",
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
"codec_strategy_non_default_warning": "已切换到非默认策略,某些客户端可能无法连接或画质下降。如遇问题请先恢复为【自动(推荐)】。",
"codec_enable_hdr": "同时启用 HDR / 10-bit 高色深",
"codec_enable_hdr_disabled_hint": "HDR 选项仅在【优先现代编码器】策略下可用。默认【自动】会根据编码器能力自行决定。",
"codec_advanced_show": "显示高级选项(分别配置 HEVC / AV1)",
"codec_advanced_hide": "隐藏高级选项",
"back_button_timeout": "主页/导航按钮模拟超时",
"back_button_timeout_desc": "按住\"返回/选择\"按钮达到指定毫秒数后,将模拟按下\"主页/导航\"按钮。若设置值小于0(默认值),则不会触发此功能。",
"bind_address": "绑定地址(测试功能)",
Expand Down
12 changes: 12 additions & 0 deletions src_assets/common/assets/web/public/assets/locale/zh_TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,18 @@
"av1_mode_2": "Sunshine 將宣告支援 AV1 Main 8 位元設定檔",
"av1_mode_3": "Sunshine 將宣告支援 AV1 Main 8 位元和 10 位元 (HDR) 設定檔",
"av1_mode_desc": "允許用戶端要求 AV1 Main 8 位元或 10 位元視訊串流。AV1 的編碼較耗費 CPU,因此使用軟體編碼時,啟用此功能可能會降低效能。",
"codec_strategy": "視訊編解碼器策略",
"codec_strategy_auto": "自動(建議)",
"codec_strategy_modern": "優先現代編碼器(HEVC + AV1)",
"codec_strategy_h264": "僅 H.264(最大相容)",
"codec_strategy_custom": "自訂(在下方分別設定)",
"codec_strategy_custom_locked": "自訂(點「顯示進階選項」後可編輯)",
"codec_strategy_desc": "控制 Sunshine 向 Moonlight 用戶端宣告哪些視訊編碼格式。預設「自動」將根據編碼器能力選擇,適合 99% 的用戶。若用戶端出現黑屏 / 花屏 或 HDR 色彩異常,請切換到「僅 H.264」。",
"codec_strategy_non_default_warning": "已切換到非預設策略,某些用戶端可能無法連線或畫質下降。遇到問題請回到「自動(建議)」。",
"codec_enable_hdr": "同時宣告 HDR / 10-bit 高色深",
"codec_enable_hdr_disabled_hint": "HDR 選項僅在「優先現代編碼器」策略下可調。預設「自動」會根據編碼器能力自行決定。",
"codec_advanced_show": "顯示進階選項(分別配置 HEVC / AV1)",
"codec_advanced_hide": "隱藏進階選項",
"back_button_timeout": "主畫面/導覽按鈕模擬超時",
"back_button_timeout_desc": "如果按住 Back/Select 按鈕達到指定的毫秒數,系統會模擬 Home/Guide 按鈕的按下動作。若設定為小於 0(預設值),則按住 Back/Select 按鈕不會模擬 Home/Guide 按鈕。",
"bind_address": "綁定位址(測試功能)",
Expand Down
Loading