From: Kostya Shishkov Date: Sat, 28 Feb 2026 14:57:14 +0000 (+0100) Subject: videoplayer: add support for vthreads option in .naplayerrc X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=78bf500d72cb0f3ccf88459b31bac5bbc4655ad4;p=nihav-player.git videoplayer: add support for vthreads option in .naplayerrc --- diff --git a/videoplayer/src/main.rs b/videoplayer/src/main.rs index b06cb53..836001e 100644 --- a/videoplayer/src/main.rs +++ b/videoplayer/src/main.rs @@ -1178,20 +1178,37 @@ fn main() { if words.is_empty() { continue; } - if words[0] == "scale_thr" { - let last_arg = words[words.len() - 1]; - let dim: Vec<&str> = last_arg.split(['x', 'X']).collect(); - if dim.len() != 2 { - println!(" expected 'scale_thr=WxH', got 'scale_thr={last_arg}'"); - continue; - } - if let (Ok(thr_w), Ok(thr_h)) = (dim[0].parse::(), dim[1].parse::()) { - debug_log!(player; {format!(" set autoscale threshold to {thr_w}x{thr_h}")}); - player.thr_w = thr_w; - player.thr_h = thr_h; - } else { - println!(" expected 'scale_thr=WxH', got 'scale_thr={last_arg}'"); - continue; + match words[0] { + "scale_thr" => { + let last_arg = words[words.len() - 1]; + let dim: Vec<&str> = last_arg.split(['x', 'X']).collect(); + if dim.len() != 2 { + println!(" expected 'scale_thr=WxH', got 'scale_thr={last_arg}'"); + continue; + } + if let (Ok(thr_w), Ok(thr_h)) = (dim[0].parse::(), dim[1].parse::()) { + debug_log!(player; {format!(" set autoscale threshold to {thr_w}x{thr_h}")}); + player.thr_w = thr_w; + player.thr_h = thr_h; + } else { + println!(" expected 'scale_thr=WxH', got 'scale_thr={last_arg}'"); + continue; + } + }, + "vthreads" => { + let last_arg = words[words.len() - 1]; + if let Ok(val) = last_arg.parse::() { + if val <= 256 { + player.vthreads = val; + } else { + println!(" too many threads given, {val}"); + } + } else { + println!(" expected number of threads, got 'vthreads={last_arg}'"); + } + }, + _ => { + println!("unknown .naplayerrc option '{}'", words[0]); } } } else {