this.in = in;
decoder = new FLACDecoder(in);
try {
streamInfo = decoder.readStreamInfo();
//metaDataLength = streamInfo.getLength() + 8;
Metadata metadata;
do {
metadata = decoder.readNextMetadata();
//metaDataLength += metadata.getLength() + 4;
if (metadata instanceof SeekTable){
seekTable = (SeekTable) metadata;
}
} while (!metadata.isLast());
metaDataLength = (int) decoder.getTotalBytesRead();
duration = (int) (streamInfo.getTotalSamples() * 1000.0 / streamInfo.getSampleRate());
bitrate = (int) (((in.getLength() - metaDataLength) * 8.0) / (streamInfo.getTotalSamples() / streamInfo.getSampleRate()));
audioInfo = new AudioInfo("FLAC", true, bitrate / 1000, streamInfo.getSampleRate(), streamInfo.getChannels(), in.getLength(), getDuration());
fmt = new AudioFormat(streamInfo.getSampleRate(), 16, streamInfo.getChannels(), true, false);