audio/mp3: Remove eof const

This commit is contained in:
Hajime Hoshi 2017-06-17 06:59:27 +09:00
parent 541a633361
commit 408b37dd7a

View File

@ -18,19 +18,13 @@ package mp3
// #include "pdmp3.h" // #include "pdmp3.h"
// //
// //extern t_mpeg1_main_data g_main_data; // extern t_mpeg1_header g_frame_header;
// extern t_mpeg1_header g_frame_header;
// //extern t_mpeg1_side_info g_side_info;
import "C" import "C"
import ( import (
"io" "io"
) )
const (
eof = 0xffffffff
)
var ( var (
reader io.Reader reader io.Reader
readerCache []uint8 readerCache []uint8
@ -124,10 +118,14 @@ func getBytes(buf []int) (int, error) {
return len(buf), nil return len(buf), nil
} }
func getFilepos() int { func isEOF() bool {
if len(readerCache) == 0 && readerEOF { if len(readerCache) == 0 && readerEOF {
return eof return true
} }
return false
}
func getFilepos() int {
return readerPos return readerPos
} }
@ -135,7 +133,7 @@ func decode(r io.Reader, w io.Writer) error {
// TODO: Decoder should know number of channels // TODO: Decoder should know number of channels
reader = r reader = r
writer = w writer = w
for getFilepos() != eof { for !isEOF() {
err := readFrame() err := readFrame()
if err == nil { if err == nil {
if err := decodeL3(); err != nil { if err := decodeL3(); err != nil {
@ -143,7 +141,7 @@ func decode(r io.Reader, w io.Writer) error {
} }
continue continue
} }
if getFilepos() == eof { if isEOF() {
break break
} }
return err return err