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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
987f05737c
commit
f981ef247a
@@ -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"
|
||||
|
||||
@@ -104,6 +104,7 @@ const (
|
||||
transcodeHWVAAPI = "vaapi"
|
||||
transcodeHWNVENC = "nvenc"
|
||||
transcodeHWVideoToolbox = "videotoolbox"
|
||||
transcodeHWNone = "none"
|
||||
)
|
||||
|
||||
// TranscodeSession manages a running ffmpeg HLS transcode process.
|
||||
|
||||
Reference in New Issue
Block a user