flac: add Encoder API to encode audio samples and metadata blocks by mewmew · Pull Request #32 · mewkiz/flac
This was referenced
Aug 18, 2018Encode 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).
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)
^
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 {
^
This was referenced
Sep 13, 2018mewmew added a commit that referenced this pull request
Dec 13, 2021This change adds enc.go, which was removed in #32. To fix the build, a single change is made to enc.go, namely, updating the type of bw in the encoder struct from bitio.Writer to *bitio.Writer. Note: encoding metadata with mewkiz/flac is unsupported (for now), so maintenance of the metadata encoding feature will be governed by the Go community at large, when such need arrise. Furthermore, the metadata encoding as implemented by enc.go has not been tested locally. It is quite possible that is has broken, but if not, feel free to use! To use FLAC metadta encoding, pin the "unsupported-metadata-encoding" branch of mewkiz/flac in your go.mod. ref: #40 (comment)
wader
mentioned this pull request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters