rsf: Added readme. Updated import paths.
This commit is contained in:
parent
c540818b3f
commit
debfe1fcd3
24
README.md
24
README.md
|
@ -1 +1,23 @@
|
|||
"Edit me"
|
||||
rsf
|
||||
===
|
||||
|
||||
The rsf (Royal Straight fLaC) package provides support for reading [flac][]
|
||||
(Free Lossless Audio Codec) files.
|
||||
|
||||
[flac]: http://flac.sourceforge.net/
|
||||
|
||||
documentation
|
||||
-------------
|
||||
|
||||
Documentation provided by GoPkgDoc:
|
||||
|
||||
- [rsf][]
|
||||
|
||||
[rsf]: http://go.pkgdoc.org/github.com/mewkiz/rsf
|
||||
|
||||
public domain
|
||||
-------------
|
||||
|
||||
This code is hereby release this code into the *[public domain][]*.
|
||||
|
||||
[public domain]: https://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package frame
|
||||
|
||||
import "bytes"
|
||||
import dbg "fmt"
|
||||
import "encoding/binary"
|
||||
import "fmt"
|
||||
import dbg "fmt"
|
||||
|
||||
const (
|
||||
ErrIsNotNil = "the reserved bits are not all 0"
|
||||
|
@ -133,7 +133,7 @@ func Decode(block []byte) (f *Frame, err error) {
|
|||
// <?> if(variable blocksize)
|
||||
// <8-56>:"UTF-8" coded sample number (decoded number is 36 bits)
|
||||
// else
|
||||
// <8-48>:"UTF-8" coded frame number (decoded number is 31 bits)
|
||||
// <8-48>:"UTF-8" coded frame number (decoded number is 31 bits)
|
||||
if f.Header.HasVariableBlockSize {
|
||||
|
||||
} else {
|
||||
|
@ -146,9 +146,9 @@ func Decode(block []byte) (f *Frame, err error) {
|
|||
dbg.Println(readValue)
|
||||
}
|
||||
|
||||
// - If blocksize index = 6, read 8 bits from the stream. The true block
|
||||
// - If blocksize index = 6, read 8 bits from the stream. The true block
|
||||
// size is the read value + 1.
|
||||
// - If blocksize index = 7, read 16 bits from the stream. The true block
|
||||
// - If blocksize index = 7, read 16 bits from the stream. The true block
|
||||
// size is the read value + 1.
|
||||
///I have no idea how to decrypt this part of the spec:
|
||||
// <?> if(blocksize bits == 011x)
|
||||
|
@ -159,14 +159,14 @@ func Decode(block []byte) (f *Frame, err error) {
|
|||
dbg.Println("True block size is:", binary.BigEndian.Uint16(buf.Next(2))+1)
|
||||
}
|
||||
|
||||
// - If sample index is 12, read 8 bits from the stream. The true sample
|
||||
// - If sample index is 12, read 8 bits from the stream. The true sample
|
||||
// rate is the read value * 1000.
|
||||
// - If sample index is 13, read 16 bits from the stream. The true sample
|
||||
// - If sample index is 13, read 16 bits from the stream. The true sample
|
||||
// rate is the read value.
|
||||
// - If sample index is 14, read 16 bits from the stream. The true sample
|
||||
// - If sample index is 14, read 16 bits from the stream. The true sample
|
||||
// rate is the read value * 10.
|
||||
// <?> if(sample rate bits == 11xx)
|
||||
// 8/16 bit sample rate
|
||||
// 8/16 bit sample rate
|
||||
switch f.Header.SampleRate {
|
||||
case 12:
|
||||
dbg.Println("True sample rate is:", uint64(buf.Next(1)[0])*1000)
|
||||
|
@ -227,7 +227,7 @@ func getUTF8Num(block []byte) (readValue uint64, err error) {
|
|||
/*
|
||||
|
||||
|
||||
- assign the bits following the encoding (the x bits in the examples) to
|
||||
- assign the bits following the encoding (the x bits in the examples) to
|
||||
a variable R with a magnitude of at least 56 bits
|
||||
- loop from 1 to L
|
||||
- left shift R 6 bits
|
||||
|
@ -236,19 +236,19 @@ func getUTF8Num(block []byte) (readValue uint64, err error) {
|
|||
- set R = R or <the lower 6 bits from B>
|
||||
- the read value is R
|
||||
|
||||
The following two fields depend on the block size and sample rate index
|
||||
The following two fields depend on the block size and sample rate index
|
||||
read earlier in the header:
|
||||
|
||||
- If blocksize index = 6, read 8 bits from the stream. The true block
|
||||
- If blocksize index = 6, read 8 bits from the stream. The true block
|
||||
size is the read value + 1.
|
||||
- If blocksize index = 7, read 16 bits from the stream. The true block
|
||||
- If blocksize index = 7, read 16 bits from the stream. The true block
|
||||
size is the read value + 1.
|
||||
|
||||
- If sample index is 12, read 8 bits from the stream. The true sample
|
||||
- If sample index is 12, read 8 bits from the stream. The true sample
|
||||
rate is the read value * 1000.
|
||||
- If sample index is 13, read 16 bits from the stream. The true sample
|
||||
- If sample index is 13, read 16 bits from the stream. The true sample
|
||||
rate is the read value.
|
||||
- If sample index is 14, read 16 bits from the stream. The true sample
|
||||
- If sample index is 14, read 16 bits from the stream. The true sample
|
||||
rate is the read value * 10.
|
||||
*/
|
||||
return 0, nil
|
||||
|
|
10
meta/meta.go
10
meta/meta.go
|
@ -2,9 +2,9 @@
|
|||
package meta
|
||||
|
||||
import "bytes"
|
||||
import "strings"
|
||||
import "fmt"
|
||||
import "encoding/binary"
|
||||
import "fmt"
|
||||
import "strings"
|
||||
|
||||
//Formatted error messages
|
||||
const (
|
||||
|
@ -58,7 +58,7 @@ type DataHeader struct {
|
|||
Length uint32
|
||||
}
|
||||
|
||||
// This block has information about the whole stream. It must be present as the first metadata block in the stream.
|
||||
// This block has information about the whole stream. It must be present as the first metadata block in the stream.
|
||||
type StreamInfo struct {
|
||||
MinBlockSize uint16
|
||||
MaxBlockSize uint16
|
||||
|
@ -123,7 +123,7 @@ type CueSheetTrackIndex struct {
|
|||
IndexPointNum uint8
|
||||
}
|
||||
|
||||
//This block is for storing pictures associated with the file, most commonly cover art from CDs. There may be more than one PICTURE block in a file.
|
||||
//This block is for storing pictures associated with the file, most commonly cover art from CDs. There may be more than one PICTURE block in a file.
|
||||
type Picture struct {
|
||||
Type uint32
|
||||
MIME string
|
||||
|
@ -146,7 +146,7 @@ func IsAllZero(buf []byte) (err error) {
|
|||
return nil
|
||||
}
|
||||
|
||||
//Parse a metadata header
|
||||
//Parse a metadata header
|
||||
func (h *DataHeader) Parse(block []byte) (err error) {
|
||||
const (
|
||||
LastBlockMask = 0x80000000
|
||||
|
|
7
rsf.go
7
rsf.go
|
@ -17,13 +17,14 @@ Links:
|
|||
package rsf
|
||||
|
||||
import "bytes"
|
||||
import dbg "fmt"
|
||||
import "fmt"
|
||||
import "github.com/karlek/rsf/frame"
|
||||
import "github.com/karlek/rsf/meta"
|
||||
import "io"
|
||||
import "io/ioutil"
|
||||
import "os"
|
||||
import dbg "fmt"
|
||||
|
||||
import "github.com/mewkiz/rsf/frame"
|
||||
import "github.com/mewkiz/rsf/meta"
|
||||
|
||||
const (
|
||||
//The first four bytes of all flac files
|
||||
|
|
Loading…
Reference in a new issue