Commit graph

6 commits

Author SHA1 Message Date
DataHoarder 42f940f815
Update module url 2022-07-26 16:14:37 +02:00
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 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 3b70b1df45 flac: fix golangci metalint issues 2018-08-18 01:20:48 +09:00
mewmew 306014abef flac: Add preliminary encoding support.
Support for encoding metadata has been added.

Proper support for encoding audio samples is yet to be
implemented. For now, simply copy the original encoded
audio data from the source FLAC file.

The API mirrors that of image.Encode.

Updates #14.
2016-07-20 06:38:19 +02:00
mewmew 3f1d1096d8 internal: Add bits and hashutil packages to make the flac package self-contained. 2016-04-05 02:40:46 +02:00