commit 837631ba1992643872d6acd65851f16d9765eaae
parent 6fb83b0f1a73c83454d8583d9bede6c0cf5e7dd7
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date: Thu, 28 Oct 2021 12:00:11 +0800
nativeaudio: [unknown] shell out to ffmpeg
For platforms we haven't explicitly handled, shell out to ffmpeg.
If the system is handled but cgo is disabled, also use ffmpeg.
Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Diffstat:
1 file changed, 30 insertions(+), 0 deletions(-)
diff --git a/audio_unknown.go b/audio_unknown.go
@@ -0,0 +1,30 @@
+//go:build !(windows || darwin || linux) || !cgo
+
+// Shell out to ffmpeg if either the OS is unknown or cgo is disabled.
+
+package nativeaudio
+
+// play audio with ffmpeg.
+func play(path string) error {
+ return FFmpegPlay(path)
+}
+
+// load and decode an audio file with ffmpeg.
+func load(path string) ([]byte, Format, error) {
+ return FFmpegLoad(path)
+}
+
+// decode a bytes with ffmpeg.
+func decode(by []byte) ([]byte, Format, error) {
+ return FFmpegDecode(by)
+}
+
+// start stub.
+func start() error {
+ return nil
+}
+
+// end stub.
+func end() error {
+ return nil
+}