Update aac-go to use fork, fixed vo-aacenc tests
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DataHoarder 2022-07-20 19:15:36 +02:00
parent 932af1275e
commit 386837a4f7
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
6 changed files with 17 additions and 12 deletions

View file

@ -19,7 +19,7 @@ steps:
- git clone --depth 1 https://gitlab.xiph.org/xiph/libopusenc.git && cd libopusenc && ./autogen.sh && ./configure --prefix /usr && make && make install && cd ..
- git clone --depth 1 https://git.gammaspectra.live/S.O.N.G/alac.git && cd alac && autoreconf -fi && ./configure --prefix /usr && make && make install && cd ..
- go test -cover -v ./...
- go test -cover -v -tags=disable_codec_libfdk-aac,disable_codec_lame,disable_codec_tta,disable_codec_libflac ./...
- go test -cover -v -tags=disable_codec_libfdk_aac,disable_codec_lame,disable_codec_tta,disable_codec_libflac ./...
- go test -cover -v -tags=disable_format_aac,disable_format_alac,disable_format_mp3,disable_format_opus,disable_format_tta,disable_format_vorbis ./...
- CGO_ENABLED=0 GOOS=linux go test -cover -v ./...
---
@ -43,7 +43,7 @@ steps:
- git clone --depth 1 https://github.com/mstorsjo/fdk-aac.git && cd fdk-aac && ./autogen.sh && ./configure --prefix /usr && make -j$(nproc) && make install && cd ..
- git clone --depth 1 https://git.gammaspectra.live/S.O.N.G/alac.git && cd alac && autoreconf -fi && ./configure --prefix /usr && make && make install && cd ..
- go test -cover -v ./...
- go test -cover -v -tags=disable_codec_libfdk-aac,disable_codec_lame,disable_codec_tta,disable_codec_libflac ./...
- go test -cover -v -tags=disable_codec_libfdk_aac,disable_codec_lame,disable_codec_tta,disable_codec_libflac ./...
- go test -cover -v -tags=disable_format_aac,disable_format_alac,disable_format_mp3,disable_format_opus,disable_format_tta,disable_format_vorbis ./...
- CGO_ENABLED=0 GOOS=linux go test -cover -v ./...
...

View file

@ -196,7 +196,7 @@ Subdependencies that are not cgo-based are denoted in cursive.
| [dh1tw/gosamplerate](https://github.com/dh1tw/gosamplerate) | Go | [BSD 2-Clause](https://github.com/dh1tw/gosamplerate/blob/master/LICENSE) | |
| [libsndfile/libsamplerate](https://github.com/libsndfile/libsamplerate) | C | [BSD 2-Clause](https://github.com/libsndfile/libsamplerate/blob/master/COPYING) | Can be linked by cgo as a shared library. |
| [edgeware/mp4ff](https://github.com/edgeware/mp4ff) | Go | [MIT](https://github.com/edgeware/mp4ff/blob/master/LICENSE.md) | |
| [gen2brain/aac-go](https://github.com/gen2brain/aac-go) | Go | [Apache 2.0](https://github.com/gen2brain/aac-go/blob/master/COPYING) | |
| [aam335/aac-go](https://github.com/aam335/aac-go) | Go | [Apache 2.0](https://github.com/aam335/aac-go/blob/master/COPYING) | |
| [mstorsjo/vo-aacenc](https://github.com/mstorsjo/vo-aacenc) | C | [Apache 2.0](https://github.com/mstorsjo/vo-aacenc/blob/master/COPYING) | Subdependency and included as part of _gen2brain/aac-go_. |
| [hajimehoshi/go-mp3](https://github.com/hajimehoshi/go-mp3) | Go | [Apache 2.0](https://github.com/hajimehoshi/go-mp3/blob/main/LICENSE) | |
| [jfreymuth/oggvorbis](https://github.com/jfreymuth/oggvorbis) | Go | [MIT](https://github.com/jfreymuth/oggvorbis/blob/master/LICENSE) | |

View file

@ -5,7 +5,8 @@ package aac
import (
"fmt"
"git.gammaspectra.live/S.O.N.G/Kirika/audio"
"github.com/gen2brain/aac-go"
"git.gammaspectra.live/S.O.N.G/Kirika/vector"
"github.com/aam335/aac-go"
"io"
)
@ -21,7 +22,7 @@ func (f Format) Name() string {
}
func (f Format) EncoderDescription() string {
return "vo-aacenc (gen2brain/aac-go)"
return "vo-aacenc (aam335/aac-go)"
}
func (f Format) Encode(source audio.Source, writer io.WriteCloser, options map[string]interface{}) error {
@ -43,6 +44,8 @@ func (f Format) Encode(source audio.Source, writer io.WriteCloser, options map[s
bitrate = 192
case "128k":
bitrate = 128
case "64k":
bitrate = 64
default:
return fmt.Errorf("unknown setting bitrate=%s", strVal)
@ -77,8 +80,8 @@ func (f Format) Encode(source audio.Source, writer io.WriteCloser, options map[s
go func() {
defer pWriter.Close()
for block := range source.ToInt16().GetBlocks() {
if _, decodeErr := pWriter.Write(block); decodeErr != nil {
return nil
if _, decodeErr := pWriter.Write(vector.Int16ToBytes(block)); decodeErr != nil {
return
}
}
}()

View file

@ -46,10 +46,12 @@ func TestPacketizeADTS(t *testing.T) {
packetCount++
packetBytes += len(packet.GetData())
}
if packetCount != 16920 {
//Double checks to match vo-aacenc
if packetCount != 16920 && packetCount != 16917 {
t.Errorf("Wrong Packet Count %d != %d", packetCount, 16920)
}
if packetBytes != 6436973 {
if packetBytes != 6436973 && packetBytes != 6435831 {
t.Errorf("Wrong Packet Bytes %d != %d", packetBytes, 6436973)
}
}

2
go.mod
View file

@ -9,9 +9,9 @@ require (
git.gammaspectra.live/S.O.N.G/go-pus v0.0.0-20220720100458-4421c708d144
git.gammaspectra.live/S.O.N.G/go-tta v0.2.1-0.20220226150007-096de1072bd6
git.gammaspectra.live/S.O.N.G/goflac v0.0.0-20220515172202-6e490998d2a0
github.com/aam335/aac-go v0.0.0-20200408070016-52c23bd38988
github.com/dh1tw/gosamplerate v0.1.2
github.com/edgeware/mp4ff v0.29.0
github.com/gen2brain/aac-go v0.0.0-20180306134136-400c68157565
github.com/hajimehoshi/go-mp3 v0.3.3
github.com/jfreymuth/oggvorbis v1.0.3
github.com/kvark128/minimp3 v0.0.0-20220408223524-dd428325fce7

4
go.sum
View file

@ -10,6 +10,8 @@ git.gammaspectra.live/S.O.N.G/go-tta v0.2.1-0.20220226150007-096de1072bd6 h1:ITV
git.gammaspectra.live/S.O.N.G/go-tta v0.2.1-0.20220226150007-096de1072bd6/go.mod h1:cobkT8u8vq/+ngLy+feKS2M2ZT2HoCec5riA/0Cex3Q=
git.gammaspectra.live/S.O.N.G/goflac v0.0.0-20220515172202-6e490998d2a0 h1:imcnwHUqaAJzws41B8sCSp/sUmVranNjAX205Jr4Jc0=
git.gammaspectra.live/S.O.N.G/goflac v0.0.0-20220515172202-6e490998d2a0/go.mod h1:/po1QgOh3xynbvi4sxdY6Iw8m5WPJfGGmry2boZD8fs=
github.com/aam335/aac-go v0.0.0-20200408070016-52c23bd38988 h1:DZeJTINv0mpfBVfDtQz9vWOn/Uwj3IiA9uP5UJnClZE=
github.com/aam335/aac-go v0.0.0-20200408070016-52c23bd38988/go.mod h1:JBA06GZmW2MVVBYRrKuaZ2AFMSDiPmafb/qmF/ATTUM=
github.com/cocoonlife/testify v0.0.0-20160218172820-792cc1faeb64 h1:LjPYdzoFSAJ5Tr/ElL8kzTJghXgpnOjJVbgd1UvZB1o=
github.com/d4l3k/messagediff v1.2.2-0.20190829033028-7e0a312ae40b/go.mod h1:Oozbb1TVXFac9FtSIxHBMnBCq2qeH/2KkEQxENCrlLo=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -17,8 +19,6 @@ github.com/dh1tw/gosamplerate v0.1.2 h1:oyqtZk67xB9B4l+vIZCZ3F0RYV/z66W58VOah11/
github.com/dh1tw/gosamplerate v0.1.2/go.mod h1:zooTyHpoR7hE+FLfdE3yjLHb2QA2NpMusNfuaZqEACM=
github.com/edgeware/mp4ff v0.29.0 h1:wRW0ng0+inNGTpy7vCcSHQ7h/V71cQYnnM6woeQCHbw=
github.com/edgeware/mp4ff v0.29.0/go.mod h1:GNUeA6tEFksH2CrjJF2FSGdJolba8yPGmo16qZTXsm8=
github.com/gen2brain/aac-go v0.0.0-20180306134136-400c68157565 h1:5cGj3eU0uEzpHDFwqmcKc6zM1+HNvzPIR6ZY7T1/MsA=
github.com/gen2brain/aac-go v0.0.0-20180306134136-400c68157565/go.mod h1:Tymn6PFuf0SYIYLOWIZWtatGOmi/5FLUNawJt9OgxJw=
github.com/go-audio/audio v1.0.0/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs=
github.com/go-audio/riff v1.0.0/go.mod h1:l3cQwc85y79NQFCRB7TiPoNiaijp6q8Z0Uv38rVG498=
github.com/go-audio/wav v1.0.0/go.mod h1:3yoReyQOsiARkvPl3ERCi8JFjihzG6WhjYpZCf5zAWE=