diff --git a/README.md b/README.md index 96ab0a8..31c07d8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![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) -[![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. @@ -16,40 +16,40 @@ Documentation provided by GoDoc. - [frame][flac/frame]: implements access to FLAC audio frames. - [meta][flac/meta]: implements access to FLAC metadata blocks. -[flac]: http://godoc.org/github.com/mewkiz/flac -[flac/frame]: http://godoc.org/github.com/mewkiz/flac/frame -[flac/meta]: http://godoc.org/github.com/mewkiz/flac/meta +[flac]: http://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo +[flac/frame]: http://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/frame +[flac/meta]: http://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta ## Changes * 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) - - 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. - - 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). - 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) - 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) - - Add API examples to documentation (see [#11](https://github.com/mewkiz/flac/issues/11)). - - Extend test cases (see [aadf80a](https://github.com/mewkiz/flac/commit/aadf80aa28c463a94b8d5c49757e5a0948613ce2)). + - Add API examples to documentation (see [#11](https://git.gammaspectra.live/S.O.N.G/flacgo/issues/11)). + - Extend test cases (see [aadf80a](https://git.gammaspectra.live/S.O.N.G/flacgo/commit/aadf80aa28c463a94b8d5c49757e5a0948613ce2)). * 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)). - - 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). + - 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://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) - - 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) - - 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. * Version 1.0.0 (2014-09-30) diff --git a/cmd/flac2wav/flac2wav.go b/cmd/flac2wav/flac2wav.go index 1afca46..f9ae113 100644 --- a/cmd/flac2wav/flac2wav.go +++ b/cmd/flac2wav/flac2wav.go @@ -8,9 +8,9 @@ import ( "log" "os" + "git.gammaspectra.live/S.O.N.G/flacgo" "github.com/go-audio/audio" "github.com/go-audio/wav" - "github.com/mewkiz/flac" "github.com/mewkiz/pkg/osutil" "github.com/mewkiz/pkg/pathutil" "github.com/pkg/errors" @@ -88,7 +88,7 @@ func flac2wav(path string, force bool) error { // as signed values (ref page 59-60 of [1]). // // [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 sample += midpointValue } diff --git a/cmd/go-metaflac/metaflac.go b/cmd/go-metaflac/metaflac.go index 4c8b210..0441759 100644 --- a/cmd/go-metaflac/metaflac.go +++ b/cmd/go-metaflac/metaflac.go @@ -25,8 +25,8 @@ import ( "strconv" "strings" - "github.com/mewkiz/flac" - "github.com/mewkiz/flac/meta" + "git.gammaspectra.live/S.O.N.G/flacgo" + "git.gammaspectra.live/S.O.N.G/flacgo/meta" ) // flagBlockNum contains an optional comma-separated list of block numbers to @@ -143,10 +143,11 @@ var typeName = map[meta.Type]string{ // is_last. // // Example: -// METADATA block #0 -// type: 0 (STREAMINFO) -// is last: false -// length: 34 +// +// METADATA block #0 +// type: 0 (STREAMINFO) +// is last: false +// length: 34 func listStreamInfoHeader(isLast bool) { fmt.Println("METADATA block #0") fmt.Println(" type: 0 (STREAMINFO)") @@ -155,10 +156,11 @@ func listStreamInfoHeader(isLast bool) { } // Example: -// METADATA block #0 -// type: 0 (STREAMINFO) -// is last: false -// length: 34 +// +// METADATA block #0 +// type: 0 (STREAMINFO) +// is last: false +// length: 34 func listHeader(header *meta.Header, blockNum int) { name, ok := typeName[header.Type] if !ok { @@ -171,15 +173,16 @@ func listHeader(header *meta.Header, blockNum int) { } // Example: -// minimum blocksize: 4608 samples -// maximum blocksize: 4608 samples -// minimum framesize: 0 bytes -// maximum framesize: 19024 bytes -// sample_rate: 44100 Hz -// channels: 2 -// bits-per-sample: 16 -// total samples: 151007220 -// MD5 signature: 2e6238f5d9fe5c19f3ead628f750fd3d +// +// minimum blocksize: 4608 samples +// maximum blocksize: 4608 samples +// minimum framesize: 0 bytes +// maximum framesize: 19024 bytes +// sample_rate: 44100 Hz +// channels: 2 +// bits-per-sample: 16 +// total samples: 151007220 +// MD5 signature: 2e6238f5d9fe5c19f3ead628f750fd3d func listStreamInfo(si *meta.StreamInfo) { fmt.Printf(" minimum blocksize: %d samples\n", si.BlockSizeMin) fmt.Printf(" maximum blocksize: %d samples\n", si.BlockSizeMax) @@ -193,9 +196,10 @@ func listStreamInfo(si *meta.StreamInfo) { } // Example: -// application ID: 46696361 -// data contents: -// Medieval CUE Splitter (www.medieval.it) +// +// application ID: 46696361 +// data contents: +// Medieval CUE Splitter (www.medieval.it) func listApplication(app *meta.Application) { fmt.Printf(" application ID: %d\n", app.ID) fmt.Println(" data contents:") @@ -205,10 +209,11 @@ func listApplication(app *meta.Application) { } // Example: -// seek points: 17 -// point 0: sample_number=0, stream_offset=0, frame_samples=4608 -// point 1: sample_number=2419200, stream_offset=3733871, frame_samples=4608 -// ... +// +// seek points: 17 +// 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) { fmt.Printf(" seek points: %d\n", len(st.Points)) for pointNum, point := range st.Points { @@ -221,11 +226,12 @@ func listSeekTable(st *meta.SeekTable) { } // Example: -// vendor string: reference libFLAC 1.2.1 20070917 -// comments: 10 -// comment[0]: ALBUM=「sugar sweet nightmare」 & 「化物語」劇伴音楽集 其の壹 -// comment[1]: ARTIST=神前暁 -// ... +// +// vendor string: reference libFLAC 1.2.1 20070917 +// comments: 10 +// comment[0]: ALBUM=「sugar sweet nightmare」 & 「化物語」劇伴音楽集 其の壹 +// comment[1]: ARTIST=神前暁 +// ... func listVorbisComment(vc *meta.VorbisComment) { fmt.Printf(" vendor string: %s\n", vc.Vendor) fmt.Printf(" comments: %d\n", len(vc.Tags)) @@ -235,34 +241,35 @@ func listVorbisComment(vc *meta.VorbisComment) { } // Example: -// media catalog number: -// lead-in: 88200 -// is CD: true -// number of tracks: 18 -// track[0] -// offset: 0 -// number: 1 -// ISRC: -// type: AUDIO -// pre-emphasis: false -// number of index points: 1 -// index[0] -// offset: 0 -// number: 1 -// track[1] -// offset: 2421384 -// number: 2 -// ISRC: -// type: AUDIO -// pre-emphasis: false -// number of index points: 1 -// index[0] -// offset: 0 -// number: 1 -// ... -// track[17] -// offset: 151007220 -// number: 170 (LEAD-OUT) +// +// media catalog number: +// lead-in: 88200 +// is CD: true +// number of tracks: 18 +// track[0] +// offset: 0 +// number: 1 +// ISRC: +// type: AUDIO +// pre-emphasis: false +// number of index points: 1 +// index[0] +// offset: 0 +// number: 1 +// track[1] +// offset: 2421384 +// number: 2 +// ISRC: +// type: AUDIO +// pre-emphasis: false +// number of index points: 1 +// index[0] +// offset: 0 +// number: 1 +// ... +// track[17] +// offset: 151007220 +// number: 170 (LEAD-OUT) func listCueSheet(cs *meta.CueSheet) { fmt.Printf(" media catalog number: %s\n", cs.MCN) fmt.Printf(" lead-in: %d\n", cs.NLeadInSamples) @@ -294,17 +301,18 @@ func listCueSheet(cs *meta.CueSheet) { } // Example: -// type: 3 (Cover (front)) -// MIME type: image/jpeg -// description: -// width: 0 -// height: 0 -// depth: 0 -// colors: 0 (unindexed) -// data length: 234569 -// data: -// 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........ +// +// type: 3 (Cover (front)) +// MIME type: image/jpeg +// description: +// width: 0 +// height: 0 +// depth: 0 +// colors: 0 (unindexed) +// data length: 234569 +// data: +// 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) { typeName := map[uint32]string{ 0: "Other", diff --git a/cmd/wav2flac/main.go b/cmd/wav2flac/main.go index 6743311..58513ca 100644 --- a/cmd/wav2flac/main.go +++ b/cmd/wav2flac/main.go @@ -6,11 +6,11 @@ import ( "log" "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/wav" - "github.com/mewkiz/flac" - "github.com/mewkiz/flac/frame" - "github.com/mewkiz/flac/meta" "github.com/mewkiz/pkg/osutil" "github.com/mewkiz/pkg/pathutil" "github.com/pkg/errors" diff --git a/enc_test.go b/enc_test.go index 85151c1..bcd5b3c 100644 --- a/enc_test.go +++ b/enc_test.go @@ -1,4 +1,5 @@ -//+build ignore +//go:build ignore +// +build ignore package flac_test @@ -7,8 +8,8 @@ import ( "io/ioutil" "testing" - "github.com/mewkiz/flac" - "github.com/mewkiz/flac/meta" + "git.gammaspectra.live/S.O.N.G/flacgo" + "git.gammaspectra.live/S.O.N.G/flacgo/meta" ) func TestEncode(t *testing.T) { diff --git a/encode.go b/encode.go index 9f9407c..0009461 100644 --- a/encode.go +++ b/encode.go @@ -5,8 +5,8 @@ import ( "hash" "io" + "git.gammaspectra.live/S.O.N.G/flacgo/meta" "github.com/icza/bitio" - "github.com/mewkiz/flac/meta" "github.com/mewkiz/pkg/errutil" ) diff --git a/encode_frame.go b/encode_frame.go index eb75f31..dc6c3bb 100644 --- a/encode_frame.go +++ b/encode_frame.go @@ -4,11 +4,11 @@ import ( "encoding/binary" "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/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" ) diff --git a/encode_meta.go b/encode_meta.go index 5508049..8ee8efe 100644 --- a/encode_meta.go +++ b/encode_meta.go @@ -5,9 +5,9 @@ import ( "fmt" "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/mewkiz/flac/internal/ioutilx" - "github.com/mewkiz/flac/meta" "github.com/mewkiz/pkg/errutil" ) diff --git a/encode_subframe.go b/encode_subframe.go index 6735695..6c2c39a 100644 --- a/encode_subframe.go +++ b/encode_subframe.go @@ -1,9 +1,9 @@ package flac 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/mewkiz/flac/frame" - iobits "github.com/mewkiz/flac/internal/bits" "github.com/mewkiz/pkg/errutil" ) diff --git a/example_test.go b/example_test.go index 55142c8..6b4e8b9 100644 --- a/example_test.go +++ b/example_test.go @@ -7,7 +7,7 @@ import ( "io" "log" - "github.com/mewkiz/flac" + "git.gammaspectra.live/S.O.N.G/flacgo" ) func ExampleParseFile() { diff --git a/flac.go b/flac.go index d64982e..12afdbf 100644 --- a/flac.go +++ b/flac.go @@ -18,9 +18,9 @@ // Please refer to the documentation of the meta [2] and the frame [3] packages // for a brief introduction of their respective formats. // -// [1]: https://www.xiph.org/flac/format.html#stream -// [2]: https://godoc.org/github.com/mewkiz/flac/meta -// [3]: https://godoc.org/github.com/mewkiz/flac/frame +// [1]: https://www.xiph.org/flac/format.html#stream +// [2]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta +// [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 // API is expected to change. @@ -34,8 +34,8 @@ import ( "io" "os" - "github.com/mewkiz/flac/frame" - "github.com/mewkiz/flac/meta" + "git.gammaspectra.live/S.O.N.G/flacgo/frame" + "git.gammaspectra.live/S.O.N.G/flacgo/meta" ) // A Stream contains the metadata blocks and provides access to the audio frames diff --git a/flac_test.go b/flac_test.go index b1a80a8..057b398 100644 --- a/flac_test.go +++ b/flac_test.go @@ -6,7 +6,7 @@ import ( "os" "testing" - "github.com/mewkiz/flac" + "git.gammaspectra.live/S.O.N.G/flacgo" ) func TestSkipID3v2(t *testing.T) { diff --git a/frame/frame.go b/frame/frame.go index 33ca71f..db72331 100644 --- a/frame/frame.go +++ b/frame/frame.go @@ -10,19 +10,20 @@ // of the channels and the difference between the channels, or store the average // of the channels and their difference. An encoder decorrelates audio samples // 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 // stored in frames. Blocks and subblocks contains unencoded audio samples while // frames and subframes contain encoded audio samples. A FLAC stream contains // one or more audio frames. // -// [1]: https://www.xiph.org/flac/format.html#architecture -// [2]: https://www.xiph.org/flac/format.html#blocking -// [3]: https://www.xiph.org/flac/format.html#interchannel -// [4]: https://www.xiph.org/flac/format.html#prediction -// [5]: https://godoc.org/github.com/mewkiz/flac/frame#Pred +// [1]: https://www.xiph.org/flac/format.html#architecture +// [2]: https://www.xiph.org/flac/format.html#blocking +// [3]: https://www.xiph.org/flac/format.html#interchannel +// [4]: https://www.xiph.org/flac/format.html#prediction +// [5]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/frame#Pred package frame import ( @@ -33,11 +34,11 @@ import ( "io" "log" - "github.com/mewkiz/flac/internal/bits" - "github.com/mewkiz/flac/internal/hashutil" - "github.com/mewkiz/flac/internal/hashutil/crc16" - "github.com/mewkiz/flac/internal/hashutil/crc8" - "github.com/mewkiz/flac/internal/utf8" + "git.gammaspectra.live/S.O.N.G/flacgo/internal/bits" + "git.gammaspectra.live/S.O.N.G/flacgo/internal/hashutil" + "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" ) // 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 // Channel assignments. The following abbreviations are used: -// C: center (directly in front) -// R: right (standard stereo) -// Sr: side right (directly to the right) -// Rs: right surround (back right) -// Cs: center surround (rear center) -// Ls: left surround (back left) -// Sl: side left (directly to the left) -// L: left (standard stereo) -// Lfe: low-frequency effect (placed according to room acoustics) +// +// C: center (directly in front) +// R: right (standard stereo) +// Sr: side right (directly to the right) +// Rs: right surround (back right) +// Cs: center surround (rear center) +// Ls: left surround (back left) +// Sl: side left (directly to the left) +// 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: -// L R C Lfe Ls Rs +// +// L R C Lfe Ls Rs const ( ChannelsMono Channels = iota // 1 channel: mono. ChannelsLR // 2 channels: left, right. @@ -582,8 +585,9 @@ func (channels Channels) Count() int { // subframes. // // 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() { switch frame.Channels { case ChannelsLeftSide: diff --git a/frame/frame_test.go b/frame/frame_test.go index 8ab1617..55fb3a0 100644 --- a/frame/frame_test.go +++ b/frame/frame_test.go @@ -6,7 +6,7 @@ import ( "io" "testing" - "github.com/mewkiz/flac" + "git.gammaspectra.live/S.O.N.G/flacgo" ) var golden = []struct { diff --git a/frame/subframe.go b/frame/subframe.go index 0a2ccd9..2c957b2 100644 --- a/frame/subframe.go +++ b/frame/subframe.go @@ -5,7 +5,7 @@ import ( "fmt" "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 @@ -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 // encoding. // -// x_0[n] = 0 -// x_1[n] = x[n-1] -// 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_4[n] = 4*x[n-1] - 6*x[n-2] + 4*x[n-3] - x[n-4] +// x_0[n] = 0 +// x_1[n] = x[n-1] +// 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_4[n] = 4*x[n-1] - 6*x[n-2] + 4*x[n-3] - x[n-4] var fixedCoeffs = [...][]int32{ // ref: Section 2.2 of http://www.hpl.hp.com/techreports/1999/HPL-1999-144.pdf 1: {1}, diff --git a/go.mod b/go.mod index 422d0a1..dde7ab5 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/mewkiz/flac +module git.gammaspectra.live/S.O.N.G/flacgo go 1.14 diff --git a/internal/hashutil/crc16/crc16.go b/internal/hashutil/crc16/crc16.go index 4e963c6..e2a3ecc 100644 --- a/internal/hashutil/crc16/crc16.go +++ b/internal/hashutil/crc16/crc16.go @@ -7,7 +7,7 @@ // http://www.ross.net/crc/download/crc_v3.txt for information. 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. const Size = 2 diff --git a/internal/hashutil/crc8/crc8.go b/internal/hashutil/crc8/crc8.go index f701373..8500268 100644 --- a/internal/hashutil/crc8/crc8.go +++ b/internal/hashutil/crc8/crc8.go @@ -7,7 +7,7 @@ // http://www.ross.net/crc/download/crc_v3.txt for information. 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. const Size = 1 diff --git a/internal/utf8/decode.go b/internal/utf8/decode.go index 852de39..82273a9 100644 --- a/internal/utf8/decode.go +++ b/internal/utf8/decode.go @@ -6,7 +6,7 @@ import ( "fmt" "io" - "github.com/mewkiz/flac/internal/ioutilx" + "git.gammaspectra.live/S.O.N.G/flacgo/internal/ioutilx" ) const ( @@ -40,24 +40,24 @@ const ( // ref: http://permalink.gmane.org/gmane.comp.audio.compression.flac.devel/3033 // // Algorithm description: -// - read one byte B0 from the stream -// - if B0 = 0xxxxxxx then the read value is B0 -> end -// - if B0 = 10xxxxxx, the encoding is invalid -// - if B0 = 11xxxxxx, set L to the number of leading binary 1s minus 1: -// B0 = 110xxxxx -> L = 1 -// B0 = 1110xxxx -> L = 2 -// B0 = 11110xxx -> L = 3 -// B0 = 111110xx -> L = 4 -// B0 = 1111110x -> L = 5 -// B0 = 11111110 -> L = 6 -// - assign the bits following the encoding (the x bits in the examples) to -// a variable R with a magnitude of at least 36 bits -// - loop from 1 to L -// - left shift R 6 bits -// - read B from the stream -// - if B does not match 10xxxxxx, the encoding is invalid -// - set R = R or -// - the read value is R +// - read one byte B0 from the stream +// - if B0 = 0xxxxxxx then the read value is B0 -> end +// - if B0 = 10xxxxxx, the encoding is invalid +// - if B0 = 11xxxxxx, set L to the number of leading binary 1s minus 1: +// B0 = 110xxxxx -> L = 1 +// B0 = 1110xxxx -> L = 2 +// B0 = 11110xxx -> L = 3 +// B0 = 111110xx -> L = 4 +// B0 = 1111110x -> L = 5 +// B0 = 11111110 -> L = 6 +// - assign the bits following the encoding (the x bits in the examples) to +// a variable R with a magnitude of at least 36 bits +// - loop from 1 to L +// - left shift R 6 bits +// - read B from the stream +// - if B does not match 10xxxxxx, the encoding is invalid +// - set R = R or +// - the read value is R func Decode(r io.Reader) (x uint64, err error) { c0, err := ioutilx.ReadByte(r) if err != nil { diff --git a/internal/utf8/encode.go b/internal/utf8/encode.go index 43f263b..2baa95a 100644 --- a/internal/utf8/encode.go +++ b/internal/utf8/encode.go @@ -3,7 +3,7 @@ package utf8 import ( "io" - "github.com/mewkiz/flac/internal/ioutilx" + "git.gammaspectra.live/S.O.N.G/flacgo/internal/ioutilx" "github.com/mewkiz/pkg/errutil" ) diff --git a/meta/meta.go b/meta/meta.go index 6d920b2..e3f1037 100644 --- a/meta/meta.go +++ b/meta/meta.go @@ -8,23 +8,24 @@ // // At the time of this writing, the FLAC metadata format defines seven different // metadata block types, namely: -// * StreamInfo [2] -// * Padding [3] -// * Application [4] -// * SeekTable [5] -// * VorbisComment [6] -// * CueSheet [7] -// * Picture [8] +// - StreamInfo [2] +// - Padding [3] +// - Application [4] +// - SeekTable [5] +// - VorbisComment [6] +// - CueSheet [7] +// - Picture [8] +// // Please refer to their respective documentation for further information. // -// [1]: https://www.xiph.org/flac/format.html#format_overview -// [2]: https://godoc.org/github.com/mewkiz/flac/meta#StreamInfo -// [3]: https://www.xiph.org/flac/format.html#metadata_block_padding -// [4]: https://godoc.org/github.com/mewkiz/flac/meta#Application -// [5]: https://godoc.org/github.com/mewkiz/flac/meta#SeekTable -// [6]: https://godoc.org/github.com/mewkiz/flac/meta#VorbisComment -// [7]: https://godoc.org/github.com/mewkiz/flac/meta#CueSheet -// [8]: https://godoc.org/github.com/mewkiz/flac/meta#Picture +// [1]: https://www.xiph.org/flac/format.html#format_overview +// [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 +// [4]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta#Application +// [5]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta#SeekTable +// [6]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta#VorbisComment +// [7]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta#CueSheet +// [8]: https://godoc.org/git.gammaspectra.live/S.O.N.G/flacgo/meta#Picture package meta import ( @@ -32,7 +33,7 @@ import ( "io" "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. diff --git a/meta/meta_test.go b/meta/meta_test.go index 2e2f82f..f744d42 100644 --- a/meta/meta_test.go +++ b/meta/meta_test.go @@ -6,8 +6,8 @@ import ( "reflect" "testing" - "github.com/mewkiz/flac" - "github.com/mewkiz/flac/meta" + "git.gammaspectra.live/S.O.N.G/flacgo" + "git.gammaspectra.live/S.O.N.G/flacgo/meta" ) var golden = []struct { diff --git a/meta/streaminfo.go b/meta/streaminfo.go index f72fbfc..a04a1b5 100644 --- a/meta/streaminfo.go +++ b/meta/streaminfo.go @@ -6,7 +6,7 @@ import ( "fmt" "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