mirror of
https://github.com/Stremio/stremio-shell-ng.git
synced 2026-05-17 18:21:59 +00:00
Player: switch to gpu-next defaults
Some checks failed
Continuous integration / test (push) Has been cancelled
Some checks failed
Continuous integration / test (push) Has been cancelled
This commit is contained in:
parent
bbbe882faf
commit
5d119459a1
1 changed files with 36 additions and 7 deletions
|
|
@ -19,6 +19,28 @@ struct ObserveProperty {
|
||||||
format: Format,
|
format: Format,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn with_gpu_next_fallback(vo: String) -> String {
|
||||||
|
let mut outputs = vo
|
||||||
|
.split(',')
|
||||||
|
.filter(|output| !output.is_empty())
|
||||||
|
.map(String::from)
|
||||||
|
.collect::<Vec<String>>();
|
||||||
|
|
||||||
|
let has_gpu_next = outputs.iter().any(|output| output == "gpu-next");
|
||||||
|
let has_gpu = outputs.iter().any(|output| output == "gpu");
|
||||||
|
|
||||||
|
if outputs.is_empty() {
|
||||||
|
outputs.push("gpu-next".to_string());
|
||||||
|
outputs.push("gpu".to_string());
|
||||||
|
} else if has_gpu_next && !has_gpu {
|
||||||
|
outputs.push("gpu".to_string());
|
||||||
|
} else if has_gpu && !has_gpu_next {
|
||||||
|
outputs.push("gpu-next".to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
format!("{},", outputs.join(","))
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Player {
|
pub struct Player {
|
||||||
pub channel: ipc::Channel,
|
pub channel: ipc::Channel,
|
||||||
|
|
@ -76,7 +98,19 @@ fn create_shareable_mpv(window_handle: HWND) -> Arc<Mpv> {
|
||||||
set_property!("msg-level", "all=no");
|
set_property!("msg-level", "all=no");
|
||||||
set_property!("quiet", "yes");
|
set_property!("quiet", "yes");
|
||||||
set_property!("hwdec", "auto");
|
set_property!("hwdec", "auto");
|
||||||
// set_property!("vo", "gpu-next,");
|
// gpu-next: libplacebo VO with modern HDR tone-mapping; gpu, is the fallback.
|
||||||
|
set_property!("vo", "gpu-next,gpu,");
|
||||||
|
for (name, value) in [
|
||||||
|
("tone-mapping", "bt.2390"),
|
||||||
|
("dither-depth", "auto"),
|
||||||
|
("deband", "yes"),
|
||||||
|
("scale", "spline36"),
|
||||||
|
("cscale", "spline36"),
|
||||||
|
] {
|
||||||
|
if let Err(error) = initializer.set_property(name, value) {
|
||||||
|
eprintln!("mpv: cannot set {name}={value}: {error:?}");
|
||||||
|
}
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
Arc::new(mpv.expect("cannot build MPV"))
|
Arc::new(mpv.expect("cannot build MPV"))
|
||||||
|
|
@ -230,12 +264,7 @@ fn create_message_thread(
|
||||||
}
|
}
|
||||||
InMsg(InMsgFn::MpvSetProp, InMsgArgs::StProp(name, PropVal::Str(value))) => {
|
InMsg(InMsgFn::MpvSetProp, InMsgArgs::StProp(name, PropVal::Str(value))) => {
|
||||||
let value = if name.to_string() == "vo" {
|
let value = if name.to_string() == "vo" {
|
||||||
let mut value = value;
|
with_gpu_next_fallback(value)
|
||||||
if !value.is_empty() && !value.ends_with(',') {
|
|
||||||
value.push(',');
|
|
||||||
}
|
|
||||||
value.push_str("gpu-next,");
|
|
||||||
value
|
|
||||||
} else {
|
} else {
|
||||||
value
|
value
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue