* Corrected parsing of MinFrameSize in NewStreamInfo (shift 24 bits right
instead of 32 bits).
* Move constant definitions closer to their intended use in NewStreamInfo.
* Simplified some error handling in NewStreamInfo:
- MinBlockSize
- MaxBlockSize
* Corrected error handling of SampleRate.
* Corrected error message for MaxBlockSize ("< 65535" was replaced with
"<= 65535").
* Change order of bits and mask.
- before: NumSamplesMask & bits.
- after: bits & NumSamplesMask.
* Simplify some expressions based on operator precedence, removing some
parentheses.
- before: uint8((BitsPerSampleMask&bits)>>36) + 1
- after: uint8(bits&BitsPerSampleMask>>36) + 1
* Add comments to the memers of BlockHeader and StreamInfo.
rsf: Minor alteration of newStream comment.
meta:
* Replace the parse method for all metadata block types with a function that
handles both allocation and parsing.
- before:
v = new(T)
func (v *T) parse(buf []byte) (err error)
- after:
func NewT(buf []byte) (v *T, err error)
* Move type definitions closer to the first function using them.
- For instance place the type definition of StreamInfo above the
NewStreamInfo function.
* Rewrite comments for exported identifiers according to godoc conventions.
* Rename DataHeader to BlockHeader.
* Add the type definition Type which is used to identify metadata block
types.
* Make BlockHeader.Length usage more convenient, by changing it's type from
uint32 to int.
* Rename buf (bytes.Buffer) to b, and rename block ([]byte) to buf.
* Use errors.New() instead of fmt.Errorf for errors that doesn't require
formatted output.
* Rename IsAllZero to isAllZero, since it doesn't have to be exported. Return
a bool instead of an error.
rsf:
* Renamed Stream.Metadata to Stream.MetaBlocks.
* Replace the parse method for all metadata block types with a function that
handles both allocation and parsing.
- before:
v = new(T)
func (v *T) parse(buf []byte) (err error)
- after:
func NewT(buf []byte) (v *T, err error)
* Replace headerTypes[header.BlockType].(type) switch statement with a
header.BlockType statement.