audio/vorbis: Accept ReadSeekCloser instead of Reader

This commit is contained in:
Hajime Hoshi 2016-03-30 03:15:31 +09:00
parent e0a058bcc3
commit 4dba239cb5
2 changed files with 2 additions and 4 deletions

View File

@ -20,7 +20,6 @@ import (
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
"github.com/hajimehoshi/ebiten/exp/audio"
@ -29,7 +28,7 @@ import (
// TODO: src should be ReadCloser?
func Decode(context *audio.Context, src io.Reader) (*Stream, error) {
func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
decoded, channels, sampleRate, err := vorbis.Decode(src)
if err != nil {
return nil, err

View File

@ -18,7 +18,6 @@ package vorbis
import (
"bytes"
"io"
"io/ioutil"
"runtime"
@ -29,7 +28,7 @@ import (
// TODO: This just uses decodeAudioData can treat audio files other than Ogg/Vorbis.
// TODO: This doesn't work on iOS which doesn't have Ogg/Vorbis decoder.
func Decode(context *audio.Context, src io.Reader) (*Stream, error) {
func Decode(context *audio.Context, src audio.ReadSeekCloser) (*Stream, error) {
b, err := ioutil.ReadAll(src)
if err != nil {
return nil, err