diff --git a/.drone.yml b/.drone.yml index 966a419..6fa8a69 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,7 +8,7 @@ steps: image: golang:1.18-alpine commands: - apk update - - apk add --no-cache git gcc g++ musl-dev bash autoconf automake cmake make libtool gettext openssl-dev flac-dev opus-dev opusfile-dev libopusenc-dev vorbis-dev libsamplerate-dev lame-dev libebur128-dev fdk-aac-dev --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community + - apk add --no-cache git gcc g++ musl-dev bash autoconf automake cmake make libtool gettext openssl-dev flac-dev opus-dev opusfile-dev libopusenc-dev libvorbis-dev libsamplerate-dev lame-dev libebur128-dev fdk-aac-dev --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community - 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 build -v . diff --git a/README.md b/README.md index 2240e8c..62f3dba 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ Radio streamer ([kawa](https://github.com/Luminarys/kawa) drop-in compatible). # Improvements / differences from Kawa * Does not use libav ([see supported formats/codecs on Kirika](https://git.gammaspectra.live/S.O.N.G/Kirika#codecs-supported)) -* No Vorbis encoding support. * Supports HTTP clients that have more than 16 HTTP request headers or longer than 64 bytes per header. * Does not restart stream per-track, instead being a continuous stream without parameter changes. * Normalized channels / sample rates for all mounts. diff --git a/example_config.toml b/example_config.toml index 2b48480..0d52628 100644 --- a/example_config.toml +++ b/example_config.toml @@ -92,11 +92,11 @@ private=false # # container: the container format to use (ogg, flac, aac/adts, or mp3). See Kirika's supported format list. # -# codec: the audio codec to use (opus, flac, aac, or mp3) +# codec: the audio codec to use (opus, vorbis, flac, aac, or mp3) # # bitrate: the desired bitrate of the stream in Kb/s, if not specified (or 0) an appropriate # bitrate will be automatically selected based on the container/codec -# MeteorLight extension: bitrate can be a string (for example, v0-v9 on MP3). codec can also be he-aacv2. No vorbis support. +# MeteorLight extension: bitrate can be a string (for example, v0-v9 on MP3). codec can also be he-aacv2. # # # Additionally further options can be set on some codecs. @@ -130,9 +130,9 @@ codec="opus" bitrate=128 [[streams]] -mount="stream192.opus" +mount="stream192.vorbis" container="ogg" -codec="opus" +codec="vorbis" bitrate=192 [[streams]] diff --git a/go.mod b/go.mod index c5382d5..d65dea7 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.gammaspectra.live/S.O.N.G/MeteorLight go 1.18 require ( - git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220727144044-bae67a1c7588 + git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220728135206-2da6d5922082 github.com/BurntSushi/toml v1.2.0 github.com/dhowden/tag v0.0.0-20220618230019-adf36e896086 github.com/enriquebris/goconcurrentqueue v0.6.3 @@ -16,6 +16,7 @@ require ( git.gammaspectra.live/S.O.N.G/go-fdkaac v0.0.0-20220515171305-ffb0aafe2a61 // indirect git.gammaspectra.live/S.O.N.G/go-pus v0.0.0-20220721130634-3d5460c48ab6 // indirect git.gammaspectra.live/S.O.N.G/go-tta v0.2.1-0.20220226150007-096de1072bd6 // indirect + git.gammaspectra.live/S.O.N.G/go-vorbis v0.0.0-20220728124510-303b3425eec0 // indirect git.gammaspectra.live/S.O.N.G/goflac v0.0.0-20220515172202-6e490998d2a0 // indirect github.com/aam335/aac-go v0.0.0-20200408070016-52c23bd38988 // indirect github.com/dh1tw/gosamplerate v0.1.2 // indirect diff --git a/go.sum b/go.sum index 461f3d9..fb86aea 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220727144044-bae67a1c7588 h1:cQHMeqmjzz1Pgndjuj+a/dOs7E1UF7tgBvfyf3EWKew= -git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220727144044-bae67a1c7588/go.mod h1:xGdS9A9+npD2s9coQL3Qf17ddAtcrFoshhCAEcs8EOA= +git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220728135206-2da6d5922082 h1:W54Hb12yRwXQnF0kdR/fUEkXkRJxag7n8nlcFMZKg6k= +git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220728135206-2da6d5922082/go.mod h1:M4hLHeQyam39BCxp/0FDYIH8yaYfiRbG6xWhvvwlVn0= git.gammaspectra.live/S.O.N.G/flacgo v0.0.0-20220726151057-28f458bc5391 h1:us3yKKsnMe0FZVHRSFZCw113ddiNrZgKf5M5PNr3SQ4= git.gammaspectra.live/S.O.N.G/flacgo v0.0.0-20220726151057-28f458bc5391/go.mod h1:ZVHB/7Vrs9xxK1j98+SJ5TRYBc7Q9dIUaNJHEmysZcI= git.gammaspectra.live/S.O.N.G/go-alac v0.0.0-20220421115623-d0b3bfe57e0f h1:CxN7zlk5FdAieyRKQSbwBGBsvQ2cDF8JVCODZpzcRkA= @@ -12,6 +12,8 @@ git.gammaspectra.live/S.O.N.G/go-pus v0.0.0-20220721130634-3d5460c48ab6 h1:xWv02 git.gammaspectra.live/S.O.N.G/go-pus v0.0.0-20220721130634-3d5460c48ab6/go.mod h1:vkoHSHVM9p6vAUmXAik0gvaLcIfiQYrD6bQqVpOulUk= git.gammaspectra.live/S.O.N.G/go-tta v0.2.1-0.20220226150007-096de1072bd6 h1:ITVVisbHPnUclp3PBkCbXFeBhOCBcOjPdgjJ9wRH3TI= 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/go-vorbis v0.0.0-20220728124510-303b3425eec0 h1:kZA/fy9BhBgNGjY8OlQbIR4xkq9fmIeRQ+sXZ+m9Ic4= +git.gammaspectra.live/S.O.N.G/go-vorbis v0.0.0-20220728124510-303b3425eec0/go.mod h1:EZl7z0vfpaiu0ykpEkk6dh59XxBgWxAh4QPCCnkhICE= 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/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0= diff --git a/mount.go b/mount.go index 4891e0a..b988971 100644 --- a/mount.go +++ b/mount.go @@ -8,6 +8,7 @@ import ( "git.gammaspectra.live/S.O.N.G/Kirika/audio/format/flac" "git.gammaspectra.live/S.O.N.G/Kirika/audio/format/mp3" "git.gammaspectra.live/S.O.N.G/Kirika/audio/format/opus" + "git.gammaspectra.live/S.O.N.G/Kirika/audio/format/vorbis" "git.gammaspectra.live/S.O.N.G/Kirika/audio/packetizer" "github.com/enriquebris/goconcurrentqueue" "io" @@ -64,7 +65,12 @@ func NewStreamMount(source audio.Source, config *StreamConfig) *StreamMount { switch config.Codec { case "vorbis": - return nil + encoderFormat = vorbis.NewFormat() + if bitrate != nil { + options["bitrate"] = bitrate + } + mimeType = "audio/ogg;codecs=vorbis" + packetizerEntry = packetizer.NewOggPacketizer(reader) case "opus": encoderFormat = opus.NewFormat() if bitrate != nil {