update dependencies using go get -u ./...
In particular, bitio.Writer -> *bitio.Writer in github.com/icza/bitio Updates #39.
This commit is contained in:
parent
4f9da84df5
commit
0b3d4b0db5
|
@ -187,7 +187,7 @@ func (enc *Encoder) encodeFrameHeader(w io.Writer, hdr frame.Header) error {
|
|||
// encodeFrameHeaderBlockSize encodes the block size of the frame header,
|
||||
// writing to bw. It returns the number of bits used to store block size after
|
||||
// the frame header.
|
||||
func encodeFrameHeaderBlockSize(bw bitio.Writer, blockSize uint16) (nblockSizeSuffixBits byte, err error) {
|
||||
func encodeFrameHeaderBlockSize(bw *bitio.Writer, blockSize uint16) (nblockSizeSuffixBits byte, err error) {
|
||||
// Block size in inter-channel samples:
|
||||
// 0000 : reserved
|
||||
// 0001 : 192 samples
|
||||
|
@ -228,7 +228,7 @@ func encodeFrameHeaderBlockSize(bw bitio.Writer, blockSize uint16) (nblockSizeSu
|
|||
// encodeFrameHeaderSampleRate encodes the sample rate of the frame header,
|
||||
// writing to bw. It returns the bits and the number of bits used to store
|
||||
// sample rate after the frame header.
|
||||
func encodeFrameHeaderSampleRate(bw bitio.Writer, sampleRate uint32) (sampleRateSuffixBits uint64, nsampleRateSuffixBits byte, err error) {
|
||||
func encodeFrameHeaderSampleRate(bw *bitio.Writer, sampleRate uint32) (sampleRateSuffixBits uint64, nsampleRateSuffixBits byte, err error) {
|
||||
// Sample rate:
|
||||
// 0000 : get from STREAMINFO metadata block
|
||||
// 0001 : 88.2kHz
|
||||
|
@ -315,7 +315,7 @@ func encodeFrameHeaderSampleRate(bw bitio.Writer, sampleRate uint32) (sampleRate
|
|||
|
||||
// encodeFrameHeaderChannels encodes the channels assignment of the frame
|
||||
// header, writing to bw.
|
||||
func encodeFrameHeaderChannels(bw bitio.Writer, channels frame.Channels) error {
|
||||
func encodeFrameHeaderChannels(bw *bitio.Writer, channels frame.Channels) error {
|
||||
// Channel assignment.
|
||||
// 0000-0111 : (number of independent channels)-1. Where defined, the channel order follows SMPTE/ITU-R recommendations. The assignments are as follows:
|
||||
// 1 channel: mono
|
||||
|
@ -367,7 +367,7 @@ func encodeFrameHeaderChannels(bw bitio.Writer, channels frame.Channels) error {
|
|||
|
||||
// encodeFrameHeaderBitsPerSample encodes the bits-per-sample of the frame
|
||||
// header, writing to bw.
|
||||
func encodeFrameHeaderBitsPerSample(bw bitio.Writer, bps uint8) error {
|
||||
func encodeFrameHeaderBitsPerSample(bw *bitio.Writer, bps uint8) error {
|
||||
// Sample size in bits:
|
||||
// 000 : get from STREAMINFO metadata block
|
||||
// 001 : 8 bits per sample
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
// --- [ Metadata block ] ------------------------------------------------------
|
||||
|
||||
// encodeBlock encodes the metadata block, writing to bw.
|
||||
func encodeBlock(bw bitio.Writer, body interface{}, last bool) error {
|
||||
func encodeBlock(bw *bitio.Writer, body interface{}, last bool) error {
|
||||
switch body := body.(type) {
|
||||
case *meta.StreamInfo:
|
||||
return encodeStreamInfo(bw, body, last)
|
||||
|
@ -36,7 +36,7 @@ func encodeBlock(bw bitio.Writer, body interface{}, last bool) error {
|
|||
// --- [ Metadata block header ] -----------------------------------------------
|
||||
|
||||
// encodeBlockHeader encodes the metadata block header, writing to bw.
|
||||
func encodeBlockHeader(bw bitio.Writer, hdr *meta.Header) error {
|
||||
func encodeBlockHeader(bw *bitio.Writer, hdr *meta.Header) error {
|
||||
// 1 bit: IsLast.
|
||||
if err := bw.WriteBool(hdr.IsLast); err != nil {
|
||||
return errutil.Err(err)
|
||||
|
@ -55,7 +55,7 @@ func encodeBlockHeader(bw bitio.Writer, hdr *meta.Header) error {
|
|||
// --- [ StreamInfo ] ----------------------------------------------------------
|
||||
|
||||
// encodeStreamInfo encodes the StreamInfo metadata block, writing to bw.
|
||||
func encodeStreamInfo(bw bitio.Writer, info *meta.StreamInfo, last bool) error {
|
||||
func encodeStreamInfo(bw *bitio.Writer, info *meta.StreamInfo, last bool) error {
|
||||
// Store metadata block header.
|
||||
const nbits = 16 + 16 + 24 + 24 + 20 + 3 + 5 + 36 + 8*16
|
||||
hdr := &meta.Header{
|
||||
|
@ -110,7 +110,7 @@ func encodeStreamInfo(bw bitio.Writer, info *meta.StreamInfo, last bool) error {
|
|||
// --- [ Application ] ---------------------------------------------------------
|
||||
|
||||
// encodeApplication encodes the Application metadata block, writing to bw.
|
||||
func encodeApplication(bw bitio.Writer, app *meta.Application, last bool) error {
|
||||
func encodeApplication(bw *bitio.Writer, app *meta.Application, last bool) error {
|
||||
// Store metadata block header.
|
||||
nbits := int64(32 + 8*len(app.Data))
|
||||
hdr := &meta.Header{
|
||||
|
@ -137,7 +137,7 @@ func encodeApplication(bw bitio.Writer, app *meta.Application, last bool) error
|
|||
// --- [ SeekTable ] -----------------------------------------------------------
|
||||
|
||||
// encodeSeekTable encodes the SeekTable metadata block, writing to bw.
|
||||
func encodeSeekTable(bw bitio.Writer, table *meta.SeekTable, last bool) error {
|
||||
func encodeSeekTable(bw *bitio.Writer, table *meta.SeekTable, last bool) error {
|
||||
// Store metadata block header.
|
||||
nbits := int64((64 + 64 + 16) * len(table.Points))
|
||||
hdr := &meta.Header{
|
||||
|
@ -161,7 +161,7 @@ func encodeSeekTable(bw bitio.Writer, table *meta.SeekTable, last bool) error {
|
|||
// --- [ VorbisComment ] -------------------------------------------------------
|
||||
|
||||
// encodeVorbisComment encodes the VorbisComment metadata block, writing to bw.
|
||||
func encodeVorbisComment(bw bitio.Writer, comment *meta.VorbisComment, last bool) error {
|
||||
func encodeVorbisComment(bw *bitio.Writer, comment *meta.VorbisComment, last bool) error {
|
||||
// Store metadata block header.
|
||||
nbits := int64(32 + 8*len(comment.Vendor) + 32)
|
||||
for _, tag := range comment.Tags {
|
||||
|
@ -211,7 +211,7 @@ func encodeVorbisComment(bw bitio.Writer, comment *meta.VorbisComment, last bool
|
|||
// --- [ CueSheet ] ------------------------------------------------------------
|
||||
|
||||
// encodeCueSheet encodes the CueSheet metadata block, writing to bw.
|
||||
func encodeCueSheet(bw bitio.Writer, cs *meta.CueSheet, last bool) error {
|
||||
func encodeCueSheet(bw *bitio.Writer, cs *meta.CueSheet, last bool) error {
|
||||
// Store metadata block header.
|
||||
nbits := int64(8*128 + 64 + 1 + 7 + 8*258 + 8)
|
||||
for _, track := range cs.Tracks {
|
||||
|
@ -315,7 +315,7 @@ func encodeCueSheet(bw bitio.Writer, cs *meta.CueSheet, last bool) error {
|
|||
// --- [ Picture ] -------------------------------------------------------------
|
||||
|
||||
// encodePicture encodes the Picture metadata block, writing to bw.
|
||||
func encodePicture(bw bitio.Writer, pic *meta.Picture, last bool) error {
|
||||
func encodePicture(bw *bitio.Writer, pic *meta.Picture, last bool) error {
|
||||
// Store metadata block header.
|
||||
nbits := int64(32 + 32 + 8*len(pic.MIME) + 32 + 8*len(pic.Desc) + 32 + 32 + 32 + 32 + 32 + 8*len(pic.Data))
|
||||
hdr := &meta.Header{
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
// --- [ Subframe ] ------------------------------------------------------------
|
||||
|
||||
// encodeSubframe encodes the given subframe, writing to bw.
|
||||
func encodeSubframe(bw bitio.Writer, hdr frame.Header, subframe *frame.Subframe) error {
|
||||
func encodeSubframe(bw *bitio.Writer, hdr frame.Header, subframe *frame.Subframe) error {
|
||||
// Encode subframe header.
|
||||
if err := encodeSubframeHeader(bw, subframe.SubHeader); err != nil {
|
||||
return errutil.Err(err)
|
||||
|
@ -43,7 +43,7 @@ func encodeSubframe(bw bitio.Writer, hdr frame.Header, subframe *frame.Subframe)
|
|||
// --- [ Subframe header ] -----------------------------------------------------
|
||||
|
||||
// encodeSubframeHeader encodes the given subframe header, writing to bw.
|
||||
func encodeSubframeHeader(bw bitio.Writer, hdr frame.SubHeader) error {
|
||||
func encodeSubframeHeader(bw *bitio.Writer, hdr frame.SubHeader) error {
|
||||
// Zero bit padding, to prevent sync-fooling string of 1s.
|
||||
if err := bw.WriteBits(0x0, 1); err != nil {
|
||||
return errutil.Err(err)
|
||||
|
@ -95,7 +95,7 @@ func encodeSubframeHeader(bw bitio.Writer, hdr frame.SubHeader) error {
|
|||
// --- [ Constant samples ] ----------------------------------------------------
|
||||
|
||||
// encodeConstantSamples stores the given constant sample, writing to bw.
|
||||
func encodeConstantSamples(bw bitio.Writer, bps byte, samples []int32) error {
|
||||
func encodeConstantSamples(bw *bitio.Writer, bps byte, samples []int32) error {
|
||||
sample := samples[0]
|
||||
for _, s := range samples[1:] {
|
||||
if sample != s {
|
||||
|
@ -113,7 +113,7 @@ func encodeConstantSamples(bw bitio.Writer, bps byte, samples []int32) error {
|
|||
|
||||
// encodeVerbatimSamples stores the given samples verbatim (uncompressed),
|
||||
// writing to bw.
|
||||
func encodeVerbatimSamples(bw bitio.Writer, hdr frame.Header, samples []int32) error {
|
||||
func encodeVerbatimSamples(bw *bitio.Writer, hdr frame.Header, samples []int32) error {
|
||||
// Unencoded subblock; n = frame's bits-per-sample, i = frame's blocksize.
|
||||
if int(hdr.BlockSize) != len(samples) {
|
||||
return errutil.Newf("block size and sample count mismatch; expected %d, got %d", hdr.BlockSize, len(samples))
|
||||
|
|
11
go.mod
11
go.mod
|
@ -1,10 +1,11 @@
|
|||
module github.com/mewkiz/flac
|
||||
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/go-audio/audio v0.0.0-20181013203223-7b2a6ca21480
|
||||
github.com/go-audio/wav v0.0.0-20181013172942-de841e69b884
|
||||
github.com/icza/bitio v0.0.0-20180221120200-b25b30b42508
|
||||
github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6 // indirect
|
||||
github.com/mewkiz/pkg v0.0.0-20190222151137-b7948a1ad1b1
|
||||
github.com/go-audio/audio v1.0.0
|
||||
github.com/go-audio/wav v1.0.0
|
||||
github.com/icza/bitio v1.0.0
|
||||
github.com/mewkiz/pkg v0.0.0-20190919212034-518ade7978e2
|
||||
github.com/pkg/errors v0.8.1
|
||||
)
|
||||
|
|
24
go.sum
24
go.sum
|
@ -1,18 +1,16 @@
|
|||
github.com/go-audio/aiff v0.0.0-20180403003018-6c3a8a6aff12/go.mod h1:AMSAp6W1zd0koOdX6QDgGIuBDTUvLa2SLQtm7d9eM3c=
|
||||
github.com/go-audio/audio v0.0.0-20180206231410-b697a35b5608 h1:PHEBf8t8q21RNXEBzgg15sqaX06CdG1kngmhX+NvQAI=
|
||||
github.com/go-audio/audio v0.0.0-20180206231410-b697a35b5608/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs=
|
||||
github.com/go-audio/audio v0.0.0-20181013203223-7b2a6ca21480 h1:4sGU+UABMMsRJyD+Y2yzMYxq0GJFUsRRESI0P1gZ2ig=
|
||||
github.com/go-audio/audio v0.0.0-20181013203223-7b2a6ca21480/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs=
|
||||
github.com/go-audio/wav v0.0.0-20181013172942-de841e69b884 h1:2TaXIaVA4ff/MHHezOj83tCypALTFAcXOImcFWNa3jw=
|
||||
github.com/go-audio/wav v0.0.0-20181013172942-de841e69b884/go.mod h1:UiqzUyfX0zs3pJ/DPyvS5v8sN6s5bXPUDDIVA5v8dks=
|
||||
github.com/icza/bitio v0.0.0-20180221120200-b25b30b42508 h1:2LdkN1icT8cEFyB95fUbPE0TmQL9ZOjUv9MNJ1kg3XE=
|
||||
github.com/icza/bitio v0.0.0-20180221120200-b25b30b42508/go.mod h1:1+iKpsBoI5fsqBTrjxjM81vidVQcxXCmDrM9vc6EU2w=
|
||||
github.com/d4l3k/messagediff v1.2.2-0.20190829033028-7e0a312ae40b/go.mod h1:Oozbb1TVXFac9FtSIxHBMnBCq2qeH/2KkEQxENCrlLo=
|
||||
github.com/go-audio/audio v1.0.0 h1:zS9vebldgbQqktK4H0lUqWrG8P0NxCJVqcj7ZpNnwd4=
|
||||
github.com/go-audio/audio v1.0.0/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs=
|
||||
github.com/go-audio/riff v1.0.0 h1:d8iCGbDvox9BfLagY94fBynxSPHO80LmZCaOsmKxokA=
|
||||
github.com/go-audio/riff v1.0.0/go.mod h1:l3cQwc85y79NQFCRB7TiPoNiaijp6q8Z0Uv38rVG498=
|
||||
github.com/go-audio/wav v1.0.0 h1:WdSGLhtyud6bof6XHL28xKeCQRzCV06pOFo3LZsFdyE=
|
||||
github.com/go-audio/wav v1.0.0/go.mod h1:3yoReyQOsiARkvPl3ERCi8JFjihzG6WhjYpZCf5zAWE=
|
||||
github.com/icza/bitio v1.0.0 h1:squ/m1SHyFeCA6+6Gyol1AxV9nmPPlJFT8c2vKdj3U8=
|
||||
github.com/icza/bitio v1.0.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A=
|
||||
github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6 h1:8UsGZ2rr2ksmEru6lToqnXgA8Mz1DP11X4zSJ159C3k=
|
||||
github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6/go.mod h1:xQig96I1VNBDIWGCdTt54nHt6EeI639SmHycLYL7FkA=
|
||||
github.com/mattetti/audio v0.0.0-20180912171649-01576cde1f21 h1:Hc1iKlyxNHp3CV59G2E/qabUkHvEwOIJxDK0CJ7CRjA=
|
||||
github.com/mattetti/audio v0.0.0-20180912171649-01576cde1f21/go.mod h1:LlQmBGkOuV/SKzEDXBPKauvN2UqCgzXO2XjecTGj40s=
|
||||
github.com/mewkiz/pkg v0.0.0-20190222151137-b7948a1ad1b1 h1:Ytib0leH10tNoS0kWrEaPGk6ioIGSntEsOP+6h9oMgY=
|
||||
github.com/mewkiz/pkg v0.0.0-20190222151137-b7948a1ad1b1/go.mod h1:NefHmmDOyP6U1WiFFk+jFR3YdHoTeueo8nOZ6i1vZbA=
|
||||
github.com/mewkiz/pkg v0.0.0-20190919212034-518ade7978e2 h1:EyTNMdePWaoWsRSGQnXiSoQu0r6RS1eA557AwJhlzHU=
|
||||
github.com/mewkiz/pkg v0.0.0-20190919212034-518ade7978e2/go.mod h1:3E2FUC/qYUfM8+r9zAwpeHJzqRVVMIYnpzD/clwWxyA=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
golang.org/x/image v0.0.0-20190220214146-31aff87c08e9/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
|
|
|
@ -42,7 +42,7 @@ func (br *Reader) ReadUnary() (x uint64, err error) {
|
|||
// 4 => 00001
|
||||
// 5 => 000001
|
||||
// 6 => 0000001
|
||||
func WriteUnary(bw bitio.Writer, x uint64) error {
|
||||
func WriteUnary(bw *bitio.Writer, x uint64) error {
|
||||
bits := uint64(1)
|
||||
n := byte(1)
|
||||
for ; x > 0; x-- {
|
||||
|
|
Loading…
Reference in a new issue