Commit graph

20 commits

Author SHA1 Message Date
mewmew 3311736ba4 meta: Minor cleanups of comments. Rename rsf.go to flac.go.
The name rsf will later be used for a command line tool, while the package will
be named flac.
2013-01-18 15:16:44 +01:00
mewmew 7a4afa3c0e frame: Initial parsing of subframes implemented, read more below.
meta: Minor alteration of comment.
rsf: Start using frame.NewFrame.

The changes to frame are as follows:
	* Frame struct no longer contains Footer. Instead NewFrame returns an error
	  if the CRC-16 verification fails.
	* Implement NewFrame which parses audio frames. Each audio frame consists of
	  a frame header, one subframe per channel and a footer containing a CRC-16
	  checksum.
	* Initial implementation of NewSubFrame which parses subframes. Currently
	  only the easiest case is fully supported.
		- Constant encoding is fully supported.
		- Fixed encoding can currently decode the "warm-up" samples. Rice0 and
		  rice1 still have to be implemented for full support.
		- LPC - not yet implemented.
		- Verbatim - not yet implemented. This one should be easy though.
	* NewSubHeader has almost been fully implemented. Only
	  "wasted-bits-per-sample" remains.

Note: This code uses the bitstream Reader from "github.com/mewkiz/pkg/bit",
which is convenient but also inefficient. When decoding has been fully
implemented we should use profiling to find the bottlenecks.
2013-01-15 04:15:39 +01:00
mewmew 1ae68c3ce4 meta: Handle invalid characters in CueSheet. 2012-11-13 00:43:03 +01:00
mewmew b41407fa4e frame: Implemented parsing of frame headers. More details below:
- Renamed Decode to NewHeader and modified it so it only parses the frame header data.
	- Implemented decoding of "UTF-8" coded integers.
	- Use CRC-8 to verify the header data (hashutil/crc8).
	- Removed CRC field from Header structure, since it should be enough to only return an error if the verification fails.
	- Renamed BlockSizeInterChannelSamples to BlockSize, err on the side of brevity.
	- Renamed ChannelAssignment to ChannelOrder and add corresponding iota constants.
rsf: Decode frame header using NewHeader.
2012-11-12 00:04:14 +01:00
mewmew 0cb5308f3e meta: Add NewBlock function which parses and returns a metadata block (header and body).
rsf: Use meta.NewBlock function and remove old code related to the MetaBlock type.

rsf: AdMoved MetaBlock to *meta.Block.
2012-11-11 01:20:15 +01:00
mewmew b384a18857 meta: Minor alteration of comments: replace '0' with 0.
rsf: Removed link to metadata decoder.
2012-11-11 00:56:54 +01:00
mewmew 7724662427 meta: Fixed parsing of IsAudit, was inverted.
- Corrected some comments.
   - Added handling of NULL terminated strings.
   - Renamed some return arguments, for instance:
      - app instead of ap
      - pic instead of p
rsf: Added MetaBlock type, which represents the header and body of a block.
2012-11-10 21:30:02 +01:00
mewmew 72d04abae2 rsf: Make error messages more informative by adding function names. Remove some old TODOs. 2012-11-07 23:35:34 +01:00
mewmew 019c1a34d2 meta: the NewCueSheet function now uses a io.Reader. 2012-11-07 22:21:50 +01:00
mewmew da213eb481 meta: the NewPicture function now uses an io.Reader. 2012-11-07 00:54:05 +01:00
mewmew 541c6f3ff8 rsf: Remove frame include.
meta: Minor alteration of NewApplication.
2012-11-07 00:28:32 +01:00
forsoki cbb1a1f5bb Merge branch 'iss53' 2012-11-07 00:13:58 +01:00
forsoki 61d28bcf08 Changed NewApplication to utilizing io.Reader, changed frame package 2012-11-07 00:12:25 +01:00
mewmew 14f8e29ba1 meta: Documentation and cleanup, more details below:
- Added reference URL for metadata block types.
   - Added pseudo code comments, documenting the on disk file format of
     different metadata block types.
   - Renamed a couple of struct members: from NumThings to ThingCount.
2012-11-06 23:53:33 +01:00
mewmew ed8a14a34a meta: Initial commit to use io.LimitedReader.
- Rename from NumSamples to SampleCount.
	- Add pseudo code describing the on disk file format of different metadata
	  block types.
	- More detailed error messages.
	- Add VerifyPadding function.
rsf: Initial commit to use io.LimitedReader.
2012-11-06 20:03:48 +01:00
mewmew c0d1919d3a meta: Changes related to NewStreamInfo, more detail below:
* 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.
2012-11-04 19:35:02 +01:00
mewmew c4011d9b32 all: Refacturing and updating of comments. More details below:
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.
2012-11-02 13:26:09 +01:00
mewmew 8bc470ebb4 rsf: Rewrite comments for exported identifiers according to godoc conventions.
Remove HasSignature from the Stream structure. If no signature is found, an error will be returned which is sufficient.
2012-11-01 23:52:26 +01:00
mewmew debfe1fcd3 rsf: Added readme. Updated import paths. 2012-11-01 21:27:51 +01:00
forsoki c540818b3f Initial commit 2012-11-01 21:15:38 +01:00