Skip to content

Commit

Permalink
Doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
zaf committed Jan 2, 2017
1 parent 93080f2 commit c92d33e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
23 changes: 11 additions & 12 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,23 @@ type Decoder struct {
}
```

Decoder implements an io.Reader interface. It reads G711 PCM data and decodes it
to 16bit 8000Hz LPCM
Decoder reads G711 PCM data and decodes it to 16bit 8000Hz LPCM

#### func NewAlawDecoder

```go
func NewAlawDecoder(reader io.Reader) (*Decoder, error)
```
NewAlawDecoder returns a pointer to a Decoder. It takes as input the source data
Reader.
NewAlawDecoder returns a pointer to a Decoder that implements an io.Reader. It
takes as input the source data Reader.

#### func NewUlawDecoder

```go
func NewUlawDecoder(reader io.Reader) (*Decoder, error)
```
NewUlawDecoder returns a pointer to a Decoder It takes as input the source data
Reader.
NewUlawDecoder returns a pointer to a Decoder that implements an io.Reader. It
takes as input the source data Reader.

#### func (*Decoder) Read

Expand All @@ -151,24 +150,24 @@ type Encoder struct {
}
```

Encoder implements an io.Writer interface. It encodes 16bit 8000Hz LPCM data to
G711 PCM or directly transcodes between A-law and u-law
Encoder encodes 16bit 8000Hz LPCM data to G711 PCM or directly transcodes
between A-law and u-law

#### func NewAlawEncoder

```go
func NewAlawEncoder(writer io.Writer, input int) (*Encoder, error)
```
NewAlawEncoder returns a pointer to an Encoder. It takes as input the
destination data Writer and the input encoding format.
NewAlawEncoder returns a pointer to an Encoder that implements an io.Writer. It
takes as input the destination data Writer and the input encoding format.

#### func NewUlawEncoder

```go
func NewUlawEncoder(writer io.Writer, input int) (*Encoder, error)
```
NewUlawEncoder returns a pointer to an Encoder. It takes as input the
destination data Writer and the input encoding format.
NewUlawEncoder returns a pointer to an Encoder that implements an io.Writer. It
takes as input the destination data Writer and the input encoding format.

#### func (*Encoder) Reset

Expand Down
15 changes: 7 additions & 8 deletions g711.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,22 @@ const (
Lpcm // Lpcm 16bit signed linear data
)

// Decoder implements an io.Reader interface. It reads G711 PCM data and decodes
// it to 16bit 8000Hz LPCM
// Decoder reads G711 PCM data and decodes it to 16bit 8000Hz LPCM
type Decoder struct {
decode func([]byte) []byte // decoding function
source io.Reader // source data
}

// Encoder implements an io.Writer interface. It encodes 16bit 8000Hz LPCM data to
// G711 PCM or directly transcodes between A-law and u-law
// Encoder encodes 16bit 8000Hz LPCM data to G711 PCM or
// directly transcodes between A-law and u-law
type Encoder struct {
input int // input format
encode func([]byte) []byte // encoding function
transcode func([]byte) []byte // transcoding function
destination io.Writer // output data
}

// NewAlawDecoder returns a pointer to a Decoder.
// NewAlawDecoder returns a pointer to a Decoder that implements an io.Reader.
// It takes as input the source data Reader.
func NewAlawDecoder(reader io.Reader) (*Decoder, error) {
if reader == nil {
Expand All @@ -55,7 +54,7 @@ func NewAlawDecoder(reader io.Reader) (*Decoder, error) {
return &r, nil
}

// NewUlawDecoder returns a pointer to a Decoder
// NewUlawDecoder returns a pointer to a Decoder that implements an io.Reader.
// It takes as input the source data Reader.
func NewUlawDecoder(reader io.Reader) (*Decoder, error) {
if reader == nil {
Expand All @@ -68,7 +67,7 @@ func NewUlawDecoder(reader io.Reader) (*Decoder, error) {
return &r, nil
}

// NewAlawEncoder returns a pointer to an Encoder.
// NewAlawEncoder returns a pointer to an Encoder that implements an io.Writer.
// It takes as input the destination data Writer and the input encoding format.
func NewAlawEncoder(writer io.Writer, input int) (*Encoder, error) {
if writer == nil {
Expand All @@ -86,7 +85,7 @@ func NewAlawEncoder(writer io.Writer, input int) (*Encoder, error) {
return &w, nil
}

// NewUlawEncoder returns a pointer to an Encoder.
// NewUlawEncoder returns a pointer to an Encoder that implements an io.Writer.
// It takes as input the destination data Writer and the input encoding format.
func NewUlawEncoder(writer io.Writer, input int) (*Encoder, error) {
if writer == nil {
Expand Down

0 comments on commit c92d33e

Please sign in to comment.