audio_unknown.go (729B)
1 //go:build !windows && (!(darwin || linux) || !cgo) 2 3 // Shell out to ffmpeg if either the OS is unknown or cgo is disabled. 4 // Windows is pure Go and never falls through to this file. 5 6 package nativeaudio 7 8 // start stub. 9 func start() error { 10 return nil 11 } 12 13 // end stub. 14 func end() error { 15 return nil 16 } 17 18 // openStream decodes up front, because ffmpeg cannot read compressed 19 // audio from a pipe for every container we support. 20 func openStream(by []byte) (*Stream, error) { 21 pcm, format, err := FFmpegDecode(by) 22 if err != nil { 23 return nil, err 24 } 25 return newBufferedStream(pcm, format), nil 26 } 27 28 // openStreamFile pipes PCM straight out of ffmpeg. 29 func openStreamFile(path string) (*Stream, error) { 30 return FFmpegStream(path) 31 }