From abe617a346ff22ebba063a9cb8befdea14f658ca Mon Sep 17 00:00:00 2001 From: Sergey Krashevich Date: Wed, 1 May 2024 09:04:04 +0300 Subject: [PATCH] refactor(ffmpeg): generalize device and hardware support for multiple OS - Rename `device_freebsd.go` to `device_bsd.go` and `hardware_freebsd.go` to `hardware_bsd.go` to reflect broader BSD support (FreeBSD, NetBSD, OpenBSD, Dragonfly). - Update build tags in `device_bsd.go` and `hardware_bsd.go` to include FreeBSD, NetBSD, OpenBSD, and Dragonfly. - Rename `device_linux.go` to `device_unix.go` and `hardware_linux.go` to `hardware_unix.go` to generalize Unix support excluding Darwin-based systems and BSDs. - Add specific build tags to `device_darwin.go`, `device_unix.go`, `hardware_darwin.go`, and `hardware_unix.go` to correctly target their respective operating systems. - Ensure Windows-specific files (`device_windows.go` and `hardware_windows.go`) are correctly tagged for building on Windows. --- internal/ffmpeg/device/{device_freebsd.go => device_bsd.go} | 2 ++ internal/ffmpeg/device/device_darwin.go | 2 ++ internal/ffmpeg/device/{device_linux.go => device_unix.go} | 2 ++ internal/ffmpeg/device/device_windows.go | 2 ++ .../ffmpeg/hardware/{hardware_freebsd.go => hardware_bsd.go} | 2 ++ internal/ffmpeg/hardware/hardware_darwin.go | 2 ++ .../ffmpeg/hardware/{hardware_linux.go => hardware_unix.go} | 2 ++ internal/ffmpeg/hardware/hardware_windows.go | 2 ++ 8 files changed, 16 insertions(+) rename internal/ffmpeg/device/{device_freebsd.go => device_bsd.go} (97%) rename internal/ffmpeg/device/{device_linux.go => device_unix.go} (96%) rename internal/ffmpeg/hardware/{hardware_freebsd.go => hardware_bsd.go} (96%) rename internal/ffmpeg/hardware/{hardware_linux.go => hardware_unix.go} (97%) diff --git a/internal/ffmpeg/device/device_freebsd.go b/internal/ffmpeg/device/device_bsd.go similarity index 97% rename from internal/ffmpeg/device/device_freebsd.go rename to internal/ffmpeg/device/device_bsd.go index f3a26a30..27d5b615 100644 --- a/internal/ffmpeg/device/device_freebsd.go +++ b/internal/ffmpeg/device/device_bsd.go @@ -1,3 +1,5 @@ +//go:build freebsd || netbsd || openbsd || dragonfly + package device import ( diff --git a/internal/ffmpeg/device/device_darwin.go b/internal/ffmpeg/device/device_darwin.go index ac9b5e43..ba97c0aa 100644 --- a/internal/ffmpeg/device/device_darwin.go +++ b/internal/ffmpeg/device/device_darwin.go @@ -1,3 +1,5 @@ +//go:build darwin || ios + package device import ( diff --git a/internal/ffmpeg/device/device_linux.go b/internal/ffmpeg/device/device_unix.go similarity index 96% rename from internal/ffmpeg/device/device_linux.go rename to internal/ffmpeg/device/device_unix.go index d1228b15..7b62187f 100644 --- a/internal/ffmpeg/device/device_linux.go +++ b/internal/ffmpeg/device/device_unix.go @@ -1,3 +1,5 @@ +//go:build unix && !darwin && !freebsd && !netbsd && !openbsd && !dragonfly + package device import ( diff --git a/internal/ffmpeg/device/device_windows.go b/internal/ffmpeg/device/device_windows.go index c14630d3..ff328311 100644 --- a/internal/ffmpeg/device/device_windows.go +++ b/internal/ffmpeg/device/device_windows.go @@ -1,3 +1,5 @@ +//go:build windows + package device import ( diff --git a/internal/ffmpeg/hardware/hardware_freebsd.go b/internal/ffmpeg/hardware/hardware_bsd.go similarity index 96% rename from internal/ffmpeg/hardware/hardware_freebsd.go rename to internal/ffmpeg/hardware/hardware_bsd.go index 6ef753ac..de24ac5c 100644 --- a/internal/ffmpeg/hardware/hardware_freebsd.go +++ b/internal/ffmpeg/hardware/hardware_bsd.go @@ -1,3 +1,5 @@ +//go:build freebsd || netbsd || openbsd || dragonfly + package hardware import ( diff --git a/internal/ffmpeg/hardware/hardware_darwin.go b/internal/ffmpeg/hardware/hardware_darwin.go index 8392d2b1..b1505512 100644 --- a/internal/ffmpeg/hardware/hardware_darwin.go +++ b/internal/ffmpeg/hardware/hardware_darwin.go @@ -1,3 +1,5 @@ +//go:build darwin || ios + package hardware import ( diff --git a/internal/ffmpeg/hardware/hardware_linux.go b/internal/ffmpeg/hardware/hardware_unix.go similarity index 97% rename from internal/ffmpeg/hardware/hardware_linux.go rename to internal/ffmpeg/hardware/hardware_unix.go index f0d4858e..4f688ce4 100644 --- a/internal/ffmpeg/hardware/hardware_linux.go +++ b/internal/ffmpeg/hardware/hardware_unix.go @@ -1,3 +1,5 @@ +//go:build unix && !darwin && !freebsd && !netbsd && !openbsd && !dragonfly + package hardware import ( diff --git a/internal/ffmpeg/hardware/hardware_windows.go b/internal/ffmpeg/hardware/hardware_windows.go index c22639f5..cdf0e12c 100644 --- a/internal/ffmpeg/hardware/hardware_windows.go +++ b/internal/ffmpeg/hardware/hardware_windows.go @@ -1,3 +1,5 @@ +//go:build windows + package hardware import "github.com/AlexxIT/go2rtc/internal/api"