audio/vorbis: decode should accept io.ReadCloser

This commit is contained in:
Hajime Hoshi 2016-04-02 20:09:35 +09:00
parent f73b679fe6
commit d5ac3f831d

View File

@ -5548,13 +5548,14 @@ func cFloatsToSlice(p *C.float, n int) []float32 {
// decode accepts an ogg stream and returns a decorded stream.
// The decorded format is 1 or 2-channel interleaved littleendian int16 values.
func decode(in io.Reader) ([]byte, int, int, error) {
// TODO: in should be io.ReadCloser
func decode(in io.ReadCloser) ([]byte, int, int, error) {
mem, err := ioutil.ReadAll(in)
if err != nil {
return nil, 0, 0, err
}
if err := in.Close(); err != nil {
return nil, 0, 0, err
}
channelNum := C.int(0)
sampleRate := C.int(0)
output := (*C.short)(nil)