Commit graph

295 commits

Author SHA1 Message Date
Robin Eklind 0b3d4b0db5 update dependencies using go get -u ./...
In particular, bitio.Writer -> *bitio.Writer in github.com/icza/bitio

Updates #39.
2019-12-20 21:27:52 +01:00
Robin Eklind 4f9da84df5 travis: use CI scripts from mewmew/ci instead of Gist 2019-12-20 21:16:10 +01:00
Robin Eklind 41d812b2e4 readme: add release notes for version 1.0.6 2019-12-20 21:09:38 +01:00
Robin Eklind ce80303686 update .gitignore 2019-12-20 20:39:38 +01:00
Robin Eklind f296b7aa79 update go.mod 2019-02-23 00:13:44 +09:00
mewmew c28568d4b1 flac: add notice about Encoder API being experimental until 1.1.x 2018-08-20 14:59:42 +09:00
mewmew a17e4ae49e flac: add constant encoding of samples 2018-08-20 04:24:38 +09:00
Robin Eklind 3e3f4b5fcf
flac: add Encoder API to encode audio samples and metadata blocks (#32)
* flac: encode frame header

* flac: calculate CRC-8 when encoding frame headers

* flac: fix encoding of frame header

* flac: add preliminary subframe encoder

* flac: fix UTF-8 encoding of frame number

* frame: add sanity check for sample count in decodeLPC

Updates #31.

* flac: update flac encoding API, depricate flac.Encode

Encode has been removed in favour of using NewEncoder.
The Encode function was temporarily added to support
re-encoding FLAC streams to update the metadata, but
it had no support for encoding audio samples.

The added flac.Encoder has support for encoding both
metadata and audio samples. It also does not require
that you first decode a FLAC file to later re-encode
it by calling Encode (as was the previous behaviour).

* flac: add MD5 running hash of unencoded audio samples to StreamInfo

* flac: remove unused encodePadding

Reported by golangci

* flac: fix golangci lint issues

	frame/utf8.go:57:6: `decodeUTF8Int` is unused (deadcode)
	func decodeUTF8Int(r io.Reader) (n uint64, err error) {
		  ^
	internal/utf8/encode.go:32:16: unnecessary conversion (unconvert)
			bits = uint64(t2 | (x>>6)&mask2)
							 ^
	internal/utf8/encode.go:37:16: unnecessary conversion (unconvert)
			bits = uint64(t3 | (x>>(6*2))&mask3)
							 ^
	internal/utf8/encode.go:42:16: unnecessary conversion (unconvert)
			bits = uint64(t4 | (x>>(6*3))&mask4)
							 ^

* flac: fix golangci lint issues

	encode_frame.go:89:1: cyclomatic complexity 52 of func `(*Encoder).encodeFrameHeader` is high (> 30) (gocyclo)
	func (enc *Encoder) encodeFrameHeader(w io.Writer, hdr frame.Header) error {
	^
	internal/utf8/encode.go:66:17: unnecessary conversion (unconvert)
			bits := uint64(tx | (x>>uint(6*i))&maskx)
							  ^
	encode_subframe.go:105:46: unnecessary conversion (unconvert)
			if err := bw.WriteBits(uint64(sample), byte(hdr.BitsPerSample)); err != nil {
																	 ^

* flac: clarify that frame.Header.Num is calculated by the encoder

* flac: minor re-phrasing
2018-08-19 03:18:12 +09:00
mewmew 4309906bb8 frame: remove debug print of contiunation bytes
This has been tested with FLAC files containing
a lot of samples and a small block size, thus
having frame.Num make use of up to four
continuation bytes.
2018-08-19 04:21:43 +09:00
mewmew 8c556856f4 frame: make CRC mismatch warnings instead of fatal errors
Updates #31.
2018-08-19 03:50:28 +09:00
Henry Eklind 4d6d7bc3d0 Vendor our dependencies with vgo (#27)
* Vendor our dependencies with `vgo`

* flac: update go.mod
2018-08-17 03:16:13 +09:00
mewmew 3b70b1df45 flac: fix golangci metalint issues 2018-08-18 01:20:48 +09:00
mewmew da5a5e9313 cmd/flac2wav: update flac2wav to use go-audio instead of Azul3D 2018-08-18 01:09:46 +09:00
Henry Eklind d8cbdcb671
Merge pull request #28 from mdickers47/synchint
remove dependency on encodedbytes
2018-06-07 11:58:45 +09:00
Mikey Dickerson b3ae1b93a8 remove unnecessary conversion 2018-06-06 22:14:00 -04:00
Mikey Dickerson 147494a422 remove dependency on encodebytes 2018-06-06 22:05:04 -04:00
Henry Eklind fa00a54cd7
Merge pull request #26 from mewkiz/golangci
Add golangci metalinter
2018-05-28 10:48:39 +09:00
mewmew 8e870c4eed travis: add note to describe that G501 refers to blacklist of md5 check 2018-05-27 15:37:20 +02:00
mewmew 10505c0392 meta: simplify parseCueSheet by refactoring
Fixes lint issue reported by gocyclo:

meta/cuesheet.go:30:1: cyclomatic complexity 37 of func `(*Block).parseCueSheet` is high (> 30) (gocyclo)
func (block *Block) parseCueSheet() error {
^

Fixes #25.
2018-05-27 15:23:03 +02:00
mewmew 46e9cd6b14 frame: simplify parseHeader by refactoring
Fixes lint issue reported by gocyclo:

frame/frame.go:212:1: cyclomatic complexity 52 of func `(*Frame).parseHeader` is high (> 30) (gocyclo)
func (frame *Frame) parseHeader() error {
^

Updates #25.
2018-05-27 15:10:15 +02:00
mewmew f6859d9088 travis: skip maligned lint check
We want to keep the structures identical to spec
as they are used for parsing.
2018-05-27 14:43:04 +02:00
mewmew e8384a1c1b frame: use exclusion regexp instead of _ to skip error check of md5sum.Write and md5 import
golangci-lint run --enable-all -e "(Error return value of .md5sum\.Write. is not checked)"
2018-05-27 14:39:47 +02:00
mewmew 6d39a798cb cmd/go-metaflac: simplify control flow
Fix issue reported by megacheck:

cmd/go-metaflac/metaflac.go:82:2: unnecessary nil check around range (megacheck)
	if blockNums != nil {
	^

Updates #25.
2018-05-27 14:32:15 +02:00
mewmew 95b4b1d046 flac: fix issues reported by errcheck and unconvert
enc.go:178:35: unnecessary conversion (unconvert)
	if err := enc.bw.WriteBits(uint64(si.NSamples), 36); err != nil {
	                                 ^
enc.go:543:34: unnecessary conversion (unconvert)
	if _, err := enc.bw.Write([]byte(pic.Data)); err != nil {
	                                ^

frame/frame.go:161:17: Error return value of `md5sum.Write` is not checked (errcheck)
				md5sum.Write(buf[:1])
				            ^
frame/frame.go:165:17: Error return value of `md5sum.Write` is not checked (errcheck)
				md5sum.Write(buf[:2])
				            ^
frame/frame.go:170:17: Error return value of `md5sum.Write` is not checked (errcheck)
				md5sum.Write(buf[:])
				            ^

Updates #25.
2018-05-27 14:28:25 +02:00
mewmew e6f4bf95f2 frame: remove unused constant t1 used in UTF-8 decoding
frame/utf8.go:11:2: `t1` is unused (deadcode)
	t1 = 0x00 // 0000 0000

Updates #25.
2018-05-27 14:20:05 +02:00
mewmew 5955dc6a6b golangci: add golangci-lint 2018-05-26 11:30:21 +02:00
mewmew fcab6ed7a2 flac: minor update of comment 2018-05-25 18:15:07 +02:00
Henry Eklind 36cc17efed Skip ID3v2 data prepended to flac files on parsing (#21)
* Change signature to flacSignature

In order to disambiguate the introduction of the ID3v2 signature.

* Add check flac files containing ID3v2 data

* Implement skipId3v2

Note: a new import for decoding synchronized integers from ID3v2 headers
was introduced.

* Add error checking on the r.Discard calls

* Fix comments

* Use limited scope for error handling

* Capitalize ID in skipID3v2

* Fix comments

* Add testcase for skipping id3 data
2018-05-25 17:27:20 +02:00
Robin Eklind 50441e5efb
Fix Travis build (#23)
bump Go version to latest stable
2018-05-25 00:00:01 +02:00
mewmew ffd35219d3 flac: fix Close method to close underlying file descriptor 2018-04-08 17:47:05 +02:00
mewmew d1bcf309b2 Merge branch 'master' of github.com:mewkiz/flac 2017-12-26 15:14:36 +01:00
mewmew 9c66335d65 frame: fix typo reported by misspell 2017-12-26 15:14:11 +01:00
Robin Eklind d30adc1714 Merge pull request #18 from chewxy/master
Added 16kHz test file
2017-10-01 13:57:18 +02:00
chewxy 43fbacf007 Added 8297-275156-0011.flac, which is a 16kHz sampled file, derived from the LibriSpeech ASR corpus by Vassil Panayotov and Daniel Povey. The file is CCBY-4.0 2017-10-01 09:09:15 +11:00
mewmew b49238df85 cmd/flac2wav: fix build 2017-06-03 16:16:49 +02:00
Robin Eklind 75b847e4b4 Merge pull request #17 from karlek/license
Add LICENSE file to follow sensible standards
2017-06-02 09:49:03 +02:00
Henry Eklind 368256954b
Add LICENSE file to follow sensible standards 2017-06-02 09:17:02 +02:00
mewmew e0b198eedb flac/meta: Fix build of test cases. 2016-12-16 00:03:05 +01:00
Henry Eklind b05b58d3c0
flac: lint comment 2016-10-17 17:59:41 +02:00
Henry Eklind 57079a7bf9
meta_test: remove erroneous Close 2016-10-17 17:53:02 +02:00
Henry Eklind f65e4706bd
flac: fix placeholder argument return values 2016-10-15 20:30:14 +02:00
Henry Eklind 4a859d4c98
flac: fix nil pointer assignment segmentation fault 2016-10-15 20:29:38 +02:00
mewmew c6cd3f7103 flac: Recalculate isLast for metadata blocks during encoding.
Updates #14.
2016-07-22 03:05:53 +02:00
mewmew f39c041f5f flac: Calculate length of metadata block bodies when encoding.
Updates #14.
2016-07-22 03:01:42 +02:00
Henry Eklind 439376e473
remove metaflac function 2016-07-22 01:22:50 +02:00
Henry Eklind 0dc1119122
denser error handling 2016-07-22 00:56:37 +02:00
mewmew 2ece18bf05 flac: Fix typo in readme. 2016-07-20 15:45:08 +02:00
mewmew 78330e7949 flac: Address comments to commit 306014a. Add license notice for missing-value.flac.
A clean solution to [1] is yet to be located.

[1]: 306014abef (commitcomment-18312389)
2016-07-20 15:40:33 +02:00
Henry Eklind 54d90790d7
gofmt 2016-07-20 11:42:38 +02:00
Henry Eklind 24b8faa674 Merge branch 'master' of https://github.com/mewkiz/flac 2016-07-20 11:26:22 +02:00