]> git.nihav.org Git - nihav-player.git/commitdiff
videoplayer: add support for vthreads option in .naplayerrc
authorKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 28 Feb 2026 14:57:14 +0000 (15:57 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 28 Feb 2026 14:58:25 +0000 (15:58 +0100)
videoplayer/src/main.rs

index b06cb5388b7bca75705cdd77c6f41558e724fd51..836001ea4edc1163bb3e9a6f2a1afe9a5f0dae77 100644 (file)
@@ -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::<usize>(), dim[1].parse::<usize>()) {
-                            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::<usize>(), dim[1].parse::<usize>()) {
+                                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::<usize>() {
+                                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 {