audioFormat = new AudioFormat((float) track.getSampleRate(), bps * 8, track.getChannelCount(), true, false);
}
private void parseGaplessInfo(Movie movie) {
gaplessPadding = track.getLastFramePadding();
MetaData metaData = movie.getMetaData();
String iTunSMPB = metaData.get(MetaData.Field.GAPLESS_PLAYBACK);
if (iTunSMPB != null && iTunSMPB.length() > 0) {
String[] data = iTunSMPB.trim().split(" ");
gaplessDelay = Integer.parseInt(data[1], 16);
gaplessPadding = (int) (track.getSampleDuration(0) - Integer.parseInt(data[2], 16));
} else {
//now estimate gapless delay based on the tool
String tool = metaData.get(MetaData.Field.ENCODER_TOOL);
if (tool != null && !tool.isEmpty()) {
if (tool.startsWith("Nero")) {
gaplessDelay = (int) (track.getSampleDuration(0) * 2 + 576);
} else if (tool.startsWith("FAAC")) {
gaplessDelay = (int) track.getSampleDuration(0);