From f981ef247ab2c99af7ed069d9687a1df771bcb0f Mon Sep 17 00:00:00 2001 From: Quick104 <31828688+Quick104@users.noreply.github.com> Date: Mon, 10 Aug 2026 18:37:42 -0400 Subject: [PATCH] style(playback): use constants for hwaccel strings in darwin detection goconst flags the new darwin branch's string literals now that the transcodeHW* constants exist; use them (plus a darwinGOOS constant and a new transcodeHWNone) at the new call sites. Co-Authored-By: Claude Fable 5 --- internal/playback/gpudetect.go | 8 +++++--- internal/playback/transcode.go | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/playback/gpudetect.go b/internal/playback/gpudetect.go index 4d1c81b1..41d3871c 100644 --- a/internal/playback/gpudetect.go +++ b/internal/playback/gpudetect.go @@ -13,6 +13,8 @@ import ( "time" ) +const darwinGOOS = "darwin" + var ( defaultDRIDir = "/dev/dri" defaultNVIDIAControlDevice = "/dev/nvidiactl" @@ -106,15 +108,15 @@ func ResolveHWAccelWithFFmpeg(hwAccel string, ffmpegPath string) string { if hwAccel != "auto" { return hwAccel } - if currentGOOS == "darwin" { + if currentGOOS == darwinGOOS { if ok, reason := ffmpegSupportsVideoToolbox(ffmpegPath); ok { slog.Info("hw_accel=auto: macOS detected, using VideoToolbox") - return "videotoolbox" + return transcodeHWVideoToolbox } else { slog.Warn("hw_accel=auto: macOS detected but FFmpeg VideoToolbox probe failed", "ffmpeg", normalizeFFmpegPath(ffmpegPath), "reason", reason) } - return "none" + return transcodeHWNone } if currentGOOS != "linux" { return "none" diff --git a/internal/playback/transcode.go b/internal/playback/transcode.go index 44d9216d..a6517d3c 100644 --- a/internal/playback/transcode.go +++ b/internal/playback/transcode.go @@ -104,6 +104,7 @@ const ( transcodeHWVAAPI = "vaapi" transcodeHWNVENC = "nvenc" transcodeHWVideoToolbox = "videotoolbox" + transcodeHWNone = "none" ) // TranscodeSession manages a running ffmpeg HLS transcode process.