DataHoarder
fe503892ba
All checks were successful
continuous-integration/drone/push Build is passing
48 lines
849 B
Go
48 lines
849 B
Go
//go:build !disable_format_alac && enable_codec_libalac
|
|
// +build !disable_format_alac,enable_codec_libalac
|
|
|
|
package alac
|
|
|
|
import (
|
|
"git.gammaspectra.live/S.O.N.G/Kirika/audio/format/flac"
|
|
"git.gammaspectra.live/S.O.N.G/Kirika/test"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestEncodeALAC(t *testing.T) {
|
|
t.Parallel()
|
|
fp, err := os.Open(test.TestSingleSample24)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
defer fp.Close()
|
|
source, err := flac.NewFormat().Open(fp)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
|
|
target, err := os.CreateTemp("/tmp", "encode_test_*.m4a")
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
|
|
defer func() {
|
|
name := target.Name()
|
|
target.Close()
|
|
os.Remove(name)
|
|
}()
|
|
|
|
options := make(map[string]interface{})
|
|
options["bitdepth"] = 24
|
|
|
|
err = NewFormat().Encode(source, target, options)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
}
|