Update module url

This commit is contained in:
DataHoarder 2022-07-17 00:07:10 +02:00
parent 42d25f4866
commit 42f940f815
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
23 changed files with 196 additions and 182 deletions

View file

@ -2,7 +2,7 @@
[![Build Status](https://travis-ci.org/mewkiz/flac.svg?branch=master)](https://travis-ci.org/mewkiz/flac) [![Build Status](https://travis-ci.org/mewkiz/flac.svg?branch=master)](https://travis-ci.org/mewkiz/flac)
[![Coverage Status](https://img.shields.io/coveralls/mewkiz/flac.svg)](https://coveralls.io/r/mewkiz/flac?branch=master) [![Coverage Status](https://img.shields.io/coveralls/mewkiz/flac.svg)](https://coveralls.io/r/mewkiz/flac?branch=master)
[![GoDoc](https://godoc.org/github.com/mewkiz/flac?status.svg)](https://godoc.org/github.com/mewkiz/flac) [![GoDoc](https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo?status.svg)](https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo)
This package provides access to [FLAC][1] (Free Lossless Audio Codec) streams. This package provides access to [FLAC][1] (Free Lossless Audio Codec) streams.
@ -16,40 +16,40 @@ Documentation provided by GoDoc.
- [frame][flac/frame]: implements access to FLAC audio frames. - [frame][flac/frame]: implements access to FLAC audio frames.
- [meta][flac/meta]: implements access to FLAC metadata blocks. - [meta][flac/meta]: implements access to FLAC metadata blocks.
[flac]: http://godoc.org/github.com/mewkiz/flac [flac]: http://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo
[flac/frame]: http://godoc.org/github.com/mewkiz/flac/frame [flac/frame]: http://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/frame
[flac/meta]: http://godoc.org/github.com/mewkiz/flac/meta [flac/meta]: http://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta
## Changes ## Changes
* Version 1.0.7 (2021-01-28) * Version 1.0.7 (2021-01-28)
- Add seek API (see [#44](https://github.com/mewkiz/flac/pull/44) and [#46](https://github.com/mewkiz/flac/pull/46)). Thanks to [Craig Swank](https://github.com/cswank). - Add seek API (see [#44](https://git.gammaspectra.live/S.O.N.G/flacgo/pull/44) and [#46](https://git.gammaspectra.live/S.O.N.G/flacgo/pull/46)). Thanks to [Craig Swank](https://github.com/cswank).
* Version 1.0.6 (2019-12-20) * Version 1.0.6 (2019-12-20)
- Add experimental Encoder API to encode audio samples and metadata blocks (see [#32](https://github.com/mewkiz/flac/pull/32)). - Add experimental Encoder API to encode audio samples and metadata blocks (see [#32](https://git.gammaspectra.live/S.O.N.G/flacgo/pull/32)).
- Use go.mod. - Use go.mod.
- Skip ID3v2 data prepended to flac files when parsing (see [36cc17e](https://github.com/mewkiz/flac/commit/36cc17efed51a9bae283d6a3a7a10997492945e7)). - Skip ID3v2 data prepended to flac files when parsing (see [36cc17e](https://git.gammaspectra.live/S.O.N.G/flacgo/commit/36cc17efed51a9bae283d6a3a7a10997492945e7)).
- Remove dependency on encodebytes. Thanks to [Mikey Dickerson](https://github.com/mdickers47). - Remove dependency on encodebytes. Thanks to [Mikey Dickerson](https://github.com/mdickers47).
- Add 16kHz test case. Thanks to [Chewxy](https://github.com/chewxy). - Add 16kHz test case. Thanks to [Chewxy](https://github.com/chewxy).
- Fix lint issues (see [#25](https://github.com/mewkiz/flac/issues/25)). - Fix lint issues (see [#25](https://git.gammaspectra.live/S.O.N.G/flacgo/issues/25)).
* Version 1.0.5 (2016-05-06) * Version 1.0.5 (2016-05-06)
- Simplify import paths. Drop use of gopkg.in, and rely on vendoring instead (see [azul3d/engine#1](https://github.com/azul3d/engine/issues/1)). - Simplify import paths. Drop use of gopkg.in, and rely on vendoring instead (see [azul3d/engine#1](https://github.com/azul3d/engine/issues/1)).
- Add FLAC decoding benchmark (see [d675e0a](https://github.com/mewkiz/flac/blob/d675e0aaccf2e43055f56b9b3feeddfdeed402e2/frame/frame_test.go#L60)) - Add FLAC decoding benchmark (see [d675e0a](https://git.gammaspectra.live/S.O.N.G/flacgo/blob/d675e0aaccf2e43055f56b9b3feeddfdeed402e2/frame/frame_test.go#L60))
* Version 1.0.4 (2016-02-11) * Version 1.0.4 (2016-02-11)
- Add API examples to documentation (see [#11](https://github.com/mewkiz/flac/issues/11)). - Add API examples to documentation (see [#11](https://git.gammaspectra.live/S.O.N.G/flacgo/issues/11)).
- Extend test cases (see [aadf80a](https://github.com/mewkiz/flac/commit/aadf80aa28c463a94b8d5c49757e5a0948613ce2)). - Extend test cases (see [aadf80a](https://git.gammaspectra.live/S.O.N.G/flacgo/commit/aadf80aa28c463a94b8d5c49757e5a0948613ce2)).
* Version 1.0.3 (2016-02-02) * Version 1.0.3 (2016-02-02)
- Implement decoding of FLAC files with wasted bits-per-sample (see [#12](https://github.com/mewkiz/flac/issues/12)). - Implement decoding of FLAC files with wasted bits-per-sample (see [#12](https://git.gammaspectra.live/S.O.N.G/flacgo/issues/12)).
- Stress test the library using [go-fuzz](https://github.com/dvyukov/go-fuzz) (see [#10](https://github.com/mewkiz/flac/pull/10)). Thanks to [Patrick Mézard](https://github.com/pmezard). - Stress test the library using [go-fuzz](https://github.com/dvyukov/go-fuzz) (see [#10](https://git.gammaspectra.live/S.O.N.G/flacgo/pull/10)). Thanks to [Patrick Mézard](https://github.com/pmezard).
* Version 1.0.2 (2015-06-05) * Version 1.0.2 (2015-06-05)
- Fix decoding of blocking strategy (see [#9](https://github.com/mewkiz/flac/pull/9)). Thanks to [Sergey Didyk](https://github.com/sdidyk). - Fix decoding of blocking strategy (see [#9](https://git.gammaspectra.live/S.O.N.G/flacgo/pull/9)). Thanks to [Sergey Didyk](https://github.com/sdidyk).
* Version 1.0.1 (2015-02-25) * Version 1.0.1 (2015-02-25)
- Fix two subframe decoding bugs (see [#7](https://github.com/mewkiz/flac/pull/7)). Thanks to [Jonathan MacMillan](https://github.com/perotinus). - Fix two subframe decoding bugs (see [#7](https://git.gammaspectra.live/S.O.N.G/flacgo/pull/7)). Thanks to [Jonathan MacMillan](https://github.com/perotinus).
- Add frame decoding test cases. - Add frame decoding test cases.
* Version 1.0.0 (2014-09-30) * Version 1.0.0 (2014-09-30)

View file

@ -8,9 +8,9 @@ import (
"log" "log"
"os" "os"
"git.gammaspectra.live/S.O.N.G/flacgo"
"github.com/go-audio/audio" "github.com/go-audio/audio"
"github.com/go-audio/wav" "github.com/go-audio/wav"
"github.com/mewkiz/flac"
"github.com/mewkiz/pkg/osutil" "github.com/mewkiz/pkg/osutil"
"github.com/mewkiz/pkg/pathutil" "github.com/mewkiz/pkg/pathutil"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -88,7 +88,7 @@ func flac2wav(path string, force bool) error {
// as signed values (ref page 59-60 of [1]). // as signed values (ref page 59-60 of [1]).
// //
// [1]: http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Docs/riffmci.pdf // [1]: http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Docs/riffmci.pdf
// ref: https://github.com/mewkiz/flac/issues/51#issuecomment-1046183409 // ref: https://git.gammaspectra.live/S.O.N.G/flacgo/issues/51#issuecomment-1046183409
const midpointValue = 0x80 const midpointValue = 0x80
sample += midpointValue sample += midpointValue
} }

View file

@ -25,8 +25,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/mewkiz/flac" "git.gammaspectra.live/S.O.N.G/flacgo"
"github.com/mewkiz/flac/meta" "git.gammaspectra.live/S.O.N.G/flacgo/meta"
) )
// flagBlockNum contains an optional comma-separated list of block numbers to // flagBlockNum contains an optional comma-separated list of block numbers to
@ -143,10 +143,11 @@ var typeName = map[meta.Type]string{
// is_last. // is_last.
// //
// Example: // Example:
// METADATA block #0 //
// type: 0 (STREAMINFO) // METADATA block #0
// is last: false // type: 0 (STREAMINFO)
// length: 34 // is last: false
// length: 34
func listStreamInfoHeader(isLast bool) { func listStreamInfoHeader(isLast bool) {
fmt.Println("METADATA block #0") fmt.Println("METADATA block #0")
fmt.Println(" type: 0 (STREAMINFO)") fmt.Println(" type: 0 (STREAMINFO)")
@ -155,10 +156,11 @@ func listStreamInfoHeader(isLast bool) {
} }
// Example: // Example:
// METADATA block #0 //
// type: 0 (STREAMINFO) // METADATA block #0
// is last: false // type: 0 (STREAMINFO)
// length: 34 // is last: false
// length: 34
func listHeader(header *meta.Header, blockNum int) { func listHeader(header *meta.Header, blockNum int) {
name, ok := typeName[header.Type] name, ok := typeName[header.Type]
if !ok { if !ok {
@ -171,15 +173,16 @@ func listHeader(header *meta.Header, blockNum int) {
} }
// Example: // Example:
// minimum blocksize: 4608 samples //
// maximum blocksize: 4608 samples // minimum blocksize: 4608 samples
// minimum framesize: 0 bytes // maximum blocksize: 4608 samples
// maximum framesize: 19024 bytes // minimum framesize: 0 bytes
// sample_rate: 44100 Hz // maximum framesize: 19024 bytes
// channels: 2 // sample_rate: 44100 Hz
// bits-per-sample: 16 // channels: 2
// total samples: 151007220 // bits-per-sample: 16
// MD5 signature: 2e6238f5d9fe5c19f3ead628f750fd3d // total samples: 151007220
// MD5 signature: 2e6238f5d9fe5c19f3ead628f750fd3d
func listStreamInfo(si *meta.StreamInfo) { func listStreamInfo(si *meta.StreamInfo) {
fmt.Printf(" minimum blocksize: %d samples\n", si.BlockSizeMin) fmt.Printf(" minimum blocksize: %d samples\n", si.BlockSizeMin)
fmt.Printf(" maximum blocksize: %d samples\n", si.BlockSizeMax) fmt.Printf(" maximum blocksize: %d samples\n", si.BlockSizeMax)
@ -193,9 +196,10 @@ func listStreamInfo(si *meta.StreamInfo) {
} }
// Example: // Example:
// application ID: 46696361 //
// data contents: // application ID: 46696361
// Medieval CUE Splitter (www.medieval.it) // data contents:
// Medieval CUE Splitter (www.medieval.it)
func listApplication(app *meta.Application) { func listApplication(app *meta.Application) {
fmt.Printf(" application ID: %d\n", app.ID) fmt.Printf(" application ID: %d\n", app.ID)
fmt.Println(" data contents:") fmt.Println(" data contents:")
@ -205,10 +209,11 @@ func listApplication(app *meta.Application) {
} }
// Example: // Example:
// seek points: 17 //
// point 0: sample_number=0, stream_offset=0, frame_samples=4608 // seek points: 17
// point 1: sample_number=2419200, stream_offset=3733871, frame_samples=4608 // point 0: sample_number=0, stream_offset=0, frame_samples=4608
// ... // point 1: sample_number=2419200, stream_offset=3733871, frame_samples=4608
// ...
func listSeekTable(st *meta.SeekTable) { func listSeekTable(st *meta.SeekTable) {
fmt.Printf(" seek points: %d\n", len(st.Points)) fmt.Printf(" seek points: %d\n", len(st.Points))
for pointNum, point := range st.Points { for pointNum, point := range st.Points {
@ -221,11 +226,12 @@ func listSeekTable(st *meta.SeekTable) {
} }
// Example: // Example:
// vendor string: reference libFLAC 1.2.1 20070917 //
// comments: 10 // vendor string: reference libFLAC 1.2.1 20070917
// comment[0]: ALBUM=「sugar sweet nightmare」 & 「化物語」劇伴音楽集 其の壹 // comments: 10
// comment[1]: ARTIST=神前暁 // comment[0]: ALBUM=「sugar sweet nightmare」 & 「化物語」劇伴音楽集 其の壹
// ... // comment[1]: ARTIST=神前暁
// ...
func listVorbisComment(vc *meta.VorbisComment) { func listVorbisComment(vc *meta.VorbisComment) {
fmt.Printf(" vendor string: %s\n", vc.Vendor) fmt.Printf(" vendor string: %s\n", vc.Vendor)
fmt.Printf(" comments: %d\n", len(vc.Tags)) fmt.Printf(" comments: %d\n", len(vc.Tags))
@ -235,34 +241,35 @@ func listVorbisComment(vc *meta.VorbisComment) {
} }
// Example: // Example:
// media catalog number: //
// lead-in: 88200 // media catalog number:
// is CD: true // lead-in: 88200
// number of tracks: 18 // is CD: true
// track[0] // number of tracks: 18
// offset: 0 // track[0]
// number: 1 // offset: 0
// ISRC: // number: 1
// type: AUDIO // ISRC:
// pre-emphasis: false // type: AUDIO
// number of index points: 1 // pre-emphasis: false
// index[0] // number of index points: 1
// offset: 0 // index[0]
// number: 1 // offset: 0
// track[1] // number: 1
// offset: 2421384 // track[1]
// number: 2 // offset: 2421384
// ISRC: // number: 2
// type: AUDIO // ISRC:
// pre-emphasis: false // type: AUDIO
// number of index points: 1 // pre-emphasis: false
// index[0] // number of index points: 1
// offset: 0 // index[0]
// number: 1 // offset: 0
// ... // number: 1
// track[17] // ...
// offset: 151007220 // track[17]
// number: 170 (LEAD-OUT) // offset: 151007220
// number: 170 (LEAD-OUT)
func listCueSheet(cs *meta.CueSheet) { func listCueSheet(cs *meta.CueSheet) {
fmt.Printf(" media catalog number: %s\n", cs.MCN) fmt.Printf(" media catalog number: %s\n", cs.MCN)
fmt.Printf(" lead-in: %d\n", cs.NLeadInSamples) fmt.Printf(" lead-in: %d\n", cs.NLeadInSamples)
@ -294,17 +301,18 @@ func listCueSheet(cs *meta.CueSheet) {
} }
// Example: // Example:
// type: 3 (Cover (front)) //
// MIME type: image/jpeg // type: 3 (Cover (front))
// description: // MIME type: image/jpeg
// width: 0 // description:
// height: 0 // width: 0
// depth: 0 // height: 0
// colors: 0 (unindexed) // depth: 0
// data length: 234569 // colors: 0 (unindexed)
// data: // data length: 234569
// 00000000: FF D8 FF E0 00 10 4A 46 49 46 00 01 01 01 00 60 ......JFIF.....` // data:
// 00000010: 00 60 00 00 FF DB 00 43 00 01 01 01 01 01 01 01 .`.....C........ // 00000000: FF D8 FF E0 00 10 4A 46 49 46 00 01 01 01 00 60 ......JFIF.....`
// 00000010: 00 60 00 00 FF DB 00 43 00 01 01 01 01 01 01 01 .`.....C........
func listPicture(pic *meta.Picture) { func listPicture(pic *meta.Picture) {
typeName := map[uint32]string{ typeName := map[uint32]string{
0: "Other", 0: "Other",

View file

@ -6,11 +6,11 @@ import (
"log" "log"
"os" "os"
"git.gammaspectra.live/S.O.N.G/flacgo"
"git.gammaspectra.live/S.O.N.G/flacgo/frame"
"git.gammaspectra.live/S.O.N.G/flacgo/meta"
"github.com/go-audio/audio" "github.com/go-audio/audio"
"github.com/go-audio/wav" "github.com/go-audio/wav"
"github.com/mewkiz/flac"
"github.com/mewkiz/flac/frame"
"github.com/mewkiz/flac/meta"
"github.com/mewkiz/pkg/osutil" "github.com/mewkiz/pkg/osutil"
"github.com/mewkiz/pkg/pathutil" "github.com/mewkiz/pkg/pathutil"
"github.com/pkg/errors" "github.com/pkg/errors"

View file

@ -1,4 +1,5 @@
//+build ignore //go:build ignore
// +build ignore
package flac_test package flac_test
@ -7,8 +8,8 @@ import (
"io/ioutil" "io/ioutil"
"testing" "testing"
"github.com/mewkiz/flac" "git.gammaspectra.live/S.O.N.G/flacgo"
"github.com/mewkiz/flac/meta" "git.gammaspectra.live/S.O.N.G/flacgo/meta"
) )
func TestEncode(t *testing.T) { func TestEncode(t *testing.T) {

View file

@ -5,8 +5,8 @@ import (
"hash" "hash"
"io" "io"
"git.gammaspectra.live/S.O.N.G/flacgo/meta"
"github.com/icza/bitio" "github.com/icza/bitio"
"github.com/mewkiz/flac/meta"
"github.com/mewkiz/pkg/errutil" "github.com/mewkiz/pkg/errutil"
) )

View file

@ -4,11 +4,11 @@ import (
"encoding/binary" "encoding/binary"
"io" "io"
"git.gammaspectra.live/S.O.N.G/flacgo/frame"
"git.gammaspectra.live/S.O.N.G/flacgo/internal/hashutil/crc16"
"git.gammaspectra.live/S.O.N.G/flacgo/internal/hashutil/crc8"
"git.gammaspectra.live/S.O.N.G/flacgo/internal/utf8"
"github.com/icza/bitio" "github.com/icza/bitio"
"github.com/mewkiz/flac/frame"
"github.com/mewkiz/flac/internal/hashutil/crc16"
"github.com/mewkiz/flac/internal/hashutil/crc8"
"github.com/mewkiz/flac/internal/utf8"
"github.com/mewkiz/pkg/errutil" "github.com/mewkiz/pkg/errutil"
) )

View file

@ -5,9 +5,9 @@ import (
"fmt" "fmt"
"io" "io"
"git.gammaspectra.live/S.O.N.G/flacgo/internal/ioutilx"
"git.gammaspectra.live/S.O.N.G/flacgo/meta"
"github.com/icza/bitio" "github.com/icza/bitio"
"github.com/mewkiz/flac/internal/ioutilx"
"github.com/mewkiz/flac/meta"
"github.com/mewkiz/pkg/errutil" "github.com/mewkiz/pkg/errutil"
) )

View file

@ -1,9 +1,9 @@
package flac package flac
import ( import (
"git.gammaspectra.live/S.O.N.G/flacgo/frame"
iobits "git.gammaspectra.live/S.O.N.G/flacgo/internal/bits"
"github.com/icza/bitio" "github.com/icza/bitio"
"github.com/mewkiz/flac/frame"
iobits "github.com/mewkiz/flac/internal/bits"
"github.com/mewkiz/pkg/errutil" "github.com/mewkiz/pkg/errutil"
) )

View file

@ -7,7 +7,7 @@ import (
"io" "io"
"log" "log"
"github.com/mewkiz/flac" "git.gammaspectra.live/S.O.N.G/flacgo"
) )
func ExampleParseFile() { func ExampleParseFile() {

10
flac.go
View file

@ -18,9 +18,9 @@
// Please refer to the documentation of the meta [2] and the frame [3] packages // Please refer to the documentation of the meta [2] and the frame [3] packages
// for a brief introduction of their respective formats. // for a brief introduction of their respective formats.
// //
// [1]: https://www.xiph.org/flac/format.html#stream // [1]: https://www.xiph.org/flac/format.html#stream
// [2]: https://godoc.org/github.com/mewkiz/flac/meta // [2]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta
// [3]: https://godoc.org/github.com/mewkiz/flac/frame // [3]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/frame
// //
// Note: the Encoder API is experimental until the 1.1.x release. As such, it's // Note: the Encoder API is experimental until the 1.1.x release. As such, it's
// API is expected to change. // API is expected to change.
@ -34,8 +34,8 @@ import (
"io" "io"
"os" "os"
"github.com/mewkiz/flac/frame" "git.gammaspectra.live/S.O.N.G/flacgo/frame"
"github.com/mewkiz/flac/meta" "git.gammaspectra.live/S.O.N.G/flacgo/meta"
) )
// A Stream contains the metadata blocks and provides access to the audio frames // A Stream contains the metadata blocks and provides access to the audio frames

View file

@ -6,7 +6,7 @@ import (
"os" "os"
"testing" "testing"
"github.com/mewkiz/flac" "git.gammaspectra.live/S.O.N.G/flacgo"
) )
func TestSkipID3v2(t *testing.T) { func TestSkipID3v2(t *testing.T) {

View file

@ -10,19 +10,20 @@
// of the channels and the difference between the channels, or store the average // of the channels and the difference between the channels, or store the average
// of the channels and their difference. An encoder decorrelates audio samples // of the channels and their difference. An encoder decorrelates audio samples
// as follows: // as follows:
// mid = (left + right)/2 // average of the channels //
// side = left - right // difference between the channels // mid = (left + right)/2 // average of the channels
// side = left - right // difference between the channels
// //
// The blocks are encoded using a variety of prediction methods [4][5] and // The blocks are encoded using a variety of prediction methods [4][5] and
// stored in frames. Blocks and subblocks contains unencoded audio samples while // stored in frames. Blocks and subblocks contains unencoded audio samples while
// frames and subframes contain encoded audio samples. A FLAC stream contains // frames and subframes contain encoded audio samples. A FLAC stream contains
// one or more audio frames. // one or more audio frames.
// //
// [1]: https://www.xiph.org/flac/format.html#architecture // [1]: https://www.xiph.org/flac/format.html#architecture
// [2]: https://www.xiph.org/flac/format.html#blocking // [2]: https://www.xiph.org/flac/format.html#blocking
// [3]: https://www.xiph.org/flac/format.html#interchannel // [3]: https://www.xiph.org/flac/format.html#interchannel
// [4]: https://www.xiph.org/flac/format.html#prediction // [4]: https://www.xiph.org/flac/format.html#prediction
// [5]: https://godoc.org/github.com/mewkiz/flac/frame#Pred // [5]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/frame#Pred
package frame package frame
import ( import (
@ -33,11 +34,11 @@ import (
"io" "io"
"log" "log"
"github.com/mewkiz/flac/internal/bits" "git.gammaspectra.live/S.O.N.G/flacgo/internal/bits"
"github.com/mewkiz/flac/internal/hashutil" "git.gammaspectra.live/S.O.N.G/flacgo/internal/hashutil"
"github.com/mewkiz/flac/internal/hashutil/crc16" "git.gammaspectra.live/S.O.N.G/flacgo/internal/hashutil/crc16"
"github.com/mewkiz/flac/internal/hashutil/crc8" "git.gammaspectra.live/S.O.N.G/flacgo/internal/hashutil/crc8"
"github.com/mewkiz/flac/internal/utf8" "git.gammaspectra.live/S.O.N.G/flacgo/internal/utf8"
) )
// A Frame contains the header and subframes of an audio frame. It holds the // A Frame contains the header and subframes of an audio frame. It holds the
@ -531,18 +532,20 @@ func (frame *Frame) parseSampleRate(br *bits.Reader, sampleRate uint64) error {
type Channels uint8 type Channels uint8
// Channel assignments. The following abbreviations are used: // Channel assignments. The following abbreviations are used:
// C: center (directly in front) //
// R: right (standard stereo) // C: center (directly in front)
// Sr: side right (directly to the right) // R: right (standard stereo)
// Rs: right surround (back right) // Sr: side right (directly to the right)
// Cs: center surround (rear center) // Rs: right surround (back right)
// Ls: left surround (back left) // Cs: center surround (rear center)
// Sl: side left (directly to the left) // Ls: left surround (back left)
// L: left (standard stereo) // Sl: side left (directly to the left)
// Lfe: low-frequency effect (placed according to room acoustics) // L: left (standard stereo)
// Lfe: low-frequency effect (placed according to room acoustics)
// //
// The first 6 channel constants follow the SMPTE/ITU-R channel order: // The first 6 channel constants follow the SMPTE/ITU-R channel order:
// L R C Lfe Ls Rs //
// L R C Lfe Ls Rs
const ( const (
ChannelsMono Channels = iota // 1 channel: mono. ChannelsMono Channels = iota // 1 channel: mono.
ChannelsLR // 2 channels: left, right. ChannelsLR // 2 channels: left, right.
@ -582,8 +585,9 @@ func (channels Channels) Count() int {
// subframes. // subframes.
// //
// An encoder decorrelates audio samples as follows: // An encoder decorrelates audio samples as follows:
// mid = (left + right)/2 //
// side = left - right // mid = (left + right)/2
// side = left - right
func (frame *Frame) correlate() { func (frame *Frame) correlate() {
switch frame.Channels { switch frame.Channels {
case ChannelsLeftSide: case ChannelsLeftSide:

View file

@ -6,7 +6,7 @@ import (
"io" "io"
"testing" "testing"
"github.com/mewkiz/flac" "git.gammaspectra.live/S.O.N.G/flacgo"
) )
var golden = []struct { var golden = []struct {

View file

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"log" "log"
"github.com/mewkiz/flac/internal/bits" "git.gammaspectra.live/S.O.N.G/flacgo/internal/bits"
) )
// A Subframe contains the encoded audio samples from one channel of an audio // A Subframe contains the encoded audio samples from one channel of an audio
@ -237,11 +237,11 @@ func (subframe *Subframe) decodeVerbatim(br *bits.Reader, bps uint) error {
// fixedCoeffs maps from prediction order to the LPC coefficients used in fixed // fixedCoeffs maps from prediction order to the LPC coefficients used in fixed
// encoding. // encoding.
// //
// x_0[n] = 0 // x_0[n] = 0
// x_1[n] = x[n-1] // x_1[n] = x[n-1]
// x_2[n] = 2*x[n-1] - x[n-2] // x_2[n] = 2*x[n-1] - x[n-2]
// x_3[n] = 3*x[n-1] - 3*x[n-2] + x[n-3] // x_3[n] = 3*x[n-1] - 3*x[n-2] + x[n-3]
// x_4[n] = 4*x[n-1] - 6*x[n-2] + 4*x[n-3] - x[n-4] // x_4[n] = 4*x[n-1] - 6*x[n-2] + 4*x[n-3] - x[n-4]
var fixedCoeffs = [...][]int32{ var fixedCoeffs = [...][]int32{
// ref: Section 2.2 of http://www.hpl.hp.com/techreports/1999/HPL-1999-144.pdf // ref: Section 2.2 of http://www.hpl.hp.com/techreports/1999/HPL-1999-144.pdf
1: {1}, 1: {1},

2
go.mod
View file

@ -1,4 +1,4 @@
module github.com/mewkiz/flac module git.gammaspectra.live/S.O.N.G/flacgo
go 1.14 go 1.14

View file

@ -7,7 +7,7 @@
// http://www.ross.net/crc/download/crc_v3.txt for information. // http://www.ross.net/crc/download/crc_v3.txt for information.
package crc16 package crc16
import "github.com/mewkiz/flac/internal/hashutil" import "git.gammaspectra.live/S.O.N.G/flacgo/internal/hashutil"
// Size of a CRC-16 checksum in bytes. // Size of a CRC-16 checksum in bytes.
const Size = 2 const Size = 2

View file

@ -7,7 +7,7 @@
// http://www.ross.net/crc/download/crc_v3.txt for information. // http://www.ross.net/crc/download/crc_v3.txt for information.
package crc8 package crc8
import "github.com/mewkiz/flac/internal/hashutil" import "git.gammaspectra.live/S.O.N.G/flacgo/internal/hashutil"
// Size of a CRC-8 checksum in bytes. // Size of a CRC-8 checksum in bytes.
const Size = 1 const Size = 1

View file

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"io" "io"
"github.com/mewkiz/flac/internal/ioutilx" "git.gammaspectra.live/S.O.N.G/flacgo/internal/ioutilx"
) )
const ( const (
@ -40,24 +40,24 @@ const (
// ref: http://permalink.gmane.org/gmane.comp.audio.compression.flac.devel/3033 // ref: http://permalink.gmane.org/gmane.comp.audio.compression.flac.devel/3033
// //
// Algorithm description: // Algorithm description:
// - read one byte B0 from the stream // - read one byte B0 from the stream
// - if B0 = 0xxxxxxx then the read value is B0 -> end // - if B0 = 0xxxxxxx then the read value is B0 -> end
// - if B0 = 10xxxxxx, the encoding is invalid // - if B0 = 10xxxxxx, the encoding is invalid
// - if B0 = 11xxxxxx, set L to the number of leading binary 1s minus 1: // - if B0 = 11xxxxxx, set L to the number of leading binary 1s minus 1:
// B0 = 110xxxxx -> L = 1 // B0 = 110xxxxx -> L = 1
// B0 = 1110xxxx -> L = 2 // B0 = 1110xxxx -> L = 2
// B0 = 11110xxx -> L = 3 // B0 = 11110xxx -> L = 3
// B0 = 111110xx -> L = 4 // B0 = 111110xx -> L = 4
// B0 = 1111110x -> L = 5 // B0 = 1111110x -> L = 5
// B0 = 11111110 -> L = 6 // B0 = 11111110 -> L = 6
// - assign the bits following the encoding (the x bits in the examples) to // - assign the bits following the encoding (the x bits in the examples) to
// a variable R with a magnitude of at least 36 bits // a variable R with a magnitude of at least 36 bits
// - loop from 1 to L // - loop from 1 to L
// - left shift R 6 bits // - left shift R 6 bits
// - read B from the stream // - read B from the stream
// - if B does not match 10xxxxxx, the encoding is invalid // - if B does not match 10xxxxxx, the encoding is invalid
// - set R = R or <the lower 6 bits from B> // - set R = R or <the lower 6 bits from B>
// - the read value is R // - the read value is R
func Decode(r io.Reader) (x uint64, err error) { func Decode(r io.Reader) (x uint64, err error) {
c0, err := ioutilx.ReadByte(r) c0, err := ioutilx.ReadByte(r)
if err != nil { if err != nil {

View file

@ -3,7 +3,7 @@ package utf8
import ( import (
"io" "io"
"github.com/mewkiz/flac/internal/ioutilx" "git.gammaspectra.live/S.O.N.G/flacgo/internal/ioutilx"
"github.com/mewkiz/pkg/errutil" "github.com/mewkiz/pkg/errutil"
) )

View file

@ -8,23 +8,24 @@
// //
// At the time of this writing, the FLAC metadata format defines seven different // At the time of this writing, the FLAC metadata format defines seven different
// metadata block types, namely: // metadata block types, namely:
// * StreamInfo [2] // - StreamInfo [2]
// * Padding [3] // - Padding [3]
// * Application [4] // - Application [4]
// * SeekTable [5] // - SeekTable [5]
// * VorbisComment [6] // - VorbisComment [6]
// * CueSheet [7] // - CueSheet [7]
// * Picture [8] // - Picture [8]
//
// Please refer to their respective documentation for further information. // Please refer to their respective documentation for further information.
// //
// [1]: https://www.xiph.org/flac/format.html#format_overview // [1]: https://www.xiph.org/flac/format.html#format_overview
// [2]: https://godoc.org/github.com/mewkiz/flac/meta#StreamInfo // [2]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta#StreamInfo
// [3]: https://www.xiph.org/flac/format.html#metadata_block_padding // [3]: https://www.xiph.org/flac/format.html#metadata_block_padding
// [4]: https://godoc.org/github.com/mewkiz/flac/meta#Application // [4]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta#Application
// [5]: https://godoc.org/github.com/mewkiz/flac/meta#SeekTable // [5]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta#SeekTable
// [6]: https://godoc.org/github.com/mewkiz/flac/meta#VorbisComment // [6]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta#VorbisComment
// [7]: https://godoc.org/github.com/mewkiz/flac/meta#CueSheet // [7]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta#CueSheet
// [8]: https://godoc.org/github.com/mewkiz/flac/meta#Picture // [8]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta#Picture
package meta package meta
import ( import (
@ -32,7 +33,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"github.com/mewkiz/flac/internal/bits" "git.gammaspectra.live/S.O.N.G/flacgo/internal/bits"
) )
// A Block contains the header and body of a metadata block. // A Block contains the header and body of a metadata block.

View file

@ -6,8 +6,8 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/mewkiz/flac" "git.gammaspectra.live/S.O.N.G/flacgo"
"github.com/mewkiz/flac/meta" "git.gammaspectra.live/S.O.N.G/flacgo/meta"
) )
var golden = []struct { var golden = []struct {

View file

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"io" "io"
"github.com/mewkiz/flac/internal/bits" "git.gammaspectra.live/S.O.N.G/flacgo/internal/bits"
) )
// StreamInfo contains the basic properties of a FLAC audio stream, such as its // StreamInfo contains the basic properties of a FLAC audio stream, such as its