enable hwcodec

This commit is contained in:
csf
2022-06-30 16:19:36 +08:00
parent eaaeefd90b
commit 09937049a6
3 changed files with 70 additions and 4 deletions

View File

@@ -702,7 +702,7 @@ impl UI {
let p = "explorer";
#[cfg(target_os = "macos")]
let p = "open";
#[cfg(target_os = "linux")]
#[cfg(target_os = "linux")]
let p = if std::path::Path::new("/usr/bin/firefox").exists() {
"firefox"
} else {
@@ -753,6 +753,13 @@ impl UI {
self.get_option_("custom-rendezvous-server"),
)
}
fn has_hwcodec(&self) -> bool {
#[cfg(not(feature = "hwcodec"))]
return false;
#[cfg(feature = "hwcodec")]
return true;
}
}
impl sciter::EventHandler for UI {
@@ -829,6 +836,7 @@ impl sciter::EventHandler for UI {
fn discover();
fn get_lan_peers();
fn get_uuid();
fn has_hwcodec();
}
}

View File

@@ -165,6 +165,44 @@ class AudioInputs: Reactor.Component {
}
}
var enhancementsMenu;
class Enhancements: Reactor.Component {
function this() {
enhancementsMenu = this;
}
function render() {
var has_hwcodec = handler.has_hwcodec();
var me = this;
self.timer(1ms, function() { me.toggleMenuState() });
return <li>{translate('Enhancements')}
<menu #enhancements-menu>
{has_hwcodec ? <li #enable-hwcodec><span>{svg_checkmark}</span>{translate("Hardware Codec")}</li> : ""}
<li #enable-abr><span>{svg_checkmark}</span>{translate("ABR")}</li>
</menu>
</li>;
}
function toggleMenuState() {
for (var el in $$(menu#enhancements-menu>li)) {
if (el.id && el.id.indexOf("enable-") == 0) {
var enabled = handler.get_option(el.id) != "N";
el.attributes.toggleClass("selected", enabled);
}
}
}
event click $(menu#enhancements-menu>li) (_, me) {
var v = me.id;
if (v.indexOf("enable-") == 0) {
handler.set_option(v, handler.get_option(v) != 'N' ? 'N' : '');
}
this.toggleMenuState();
}
}
function getUserName() {
try {
return JSON.parse(handler.get_local_option("user_info")).name;
@@ -204,6 +242,7 @@ class MyIdMenu: Reactor.Component {
<li #enable-file-transfer><span>{svg_checkmark}</span>{translate('Enable File Transfer')}</li>
<li #enable-tunnel><span>{svg_checkmark}</span>{translate('Enable TCP Tunneling')}</li>
<AudioInputs />
<Enhancements />
<li #allow-remote-config-modification><span>{svg_checkmark}</span>{translate('Enable remote configuration modification')}</li>
<div .separator />
<li #custom-server>{translate('ID/Relay Server')}</li>