-
Notifications
You must be signed in to change notification settings - Fork 4
/
null.go
44 lines (34 loc) · 1.08 KB
/
null.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package codec
import (
"bufio"
"io"
"zikichombo.org/sound"
"zikichombo.org/sound/sample"
)
// Type NullCodec is a type whose values implement Codec and
// support nothing. It is useful for embedding codec implementations
// that only support some of the encoding/decoding functions.
//
type NullCodec struct {
}
func (c NullCodec) Extensions() []string {
return nil
}
func (c NullCodec) Sniff(*bufio.Reader) bool {
return false
}
func (c NullCodec) DefaultSampleCodec() sample.Codec {
return AnySampleCodec
}
func (c NullCodec) Decoder(io.ReadCloser) (sound.Source, sample.Codec, error) {
return nil, AnySampleCodec, ErrUnsupportedFunction
}
func (c NullCodec) SeekingDecoder(IoReadSeekCloser) (sound.SourceSeeker, sample.Codec, error) {
return nil, AnySampleCodec, ErrUnsupportedFunction
}
func (_ NullCodec) Encoder(w io.WriteCloser, v sound.Form, c sample.Codec) (sound.Sink, error) {
return nil, ErrUnsupportedFunction
}
func (_ NullCodec) RandomAccess(ws IoReadWriteSeekCloser, v sound.Form, c sample.Codec) (sound.RandomAccess, error) {
return nil, ErrUnsupportedFunction
}