< prev index next >

src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java

Print this page

        

*** 43,53 **** * @author Florian Bomers */ public final class AiffFileReader extends SunFileReader { @Override ! AudioFileFormat getAudioFileFormatImpl(final InputStream stream) throws UnsupportedAudioFileException, IOException { DataInputStream dis = new DataInputStream(stream); AudioFormat format = null; --- 43,53 ---- * @author Florian Bomers */ public final class AiffFileReader extends SunFileReader { @Override ! StandardFileFormat getAudioFileFormatImpl(final InputStream stream) throws UnsupportedAudioFileException, IOException { DataInputStream dis = new DataInputStream(stream); AudioFormat format = null;
*** 58,72 **** if (magic != AiffFileFormat.AIFF_MAGIC) { // not AIFF, throw exception throw new UnsupportedAudioFileException("not an AIFF file"); } ! int frameLength = 0; int length = dis.readInt(); int iffType = dis.readInt(); ! int totallength; if(length <= 0 ) { length = AudioSystem.NOT_SPECIFIED; totallength = AudioSystem.NOT_SPECIFIED; } else { totallength = length + 8; --- 58,72 ---- if (magic != AiffFileFormat.AIFF_MAGIC) { // not AIFF, throw exception throw new UnsupportedAudioFileException("not an AIFF file"); } ! long /* unsigned 32bit */ frameLength = 0; int length = dis.readInt(); int iffType = dis.readInt(); ! final long totallength; if(length <= 0 ) { length = AudioSystem.NOT_SPECIFIED; totallength = AudioSystem.NOT_SPECIFIED; } else { totallength = length + 8;
*** 104,119 **** // Read header info. int channels = dis.readUnsignedShort(); if (channels <= 0) { throw new UnsupportedAudioFileException("Invalid number of channels"); } ! frameLength = dis.readInt(); // numSampleFrames ! if (frameLength < 0) { ! // AiffFileFormat uses int, unlike AIS which uses long ! //TODO this (negative) value should be passed as long to AIS ! frameLength = AudioSystem.NOT_SPECIFIED; ! } int sampleSizeInBits = dis.readUnsignedShort(); if (sampleSizeInBits < 1 || sampleSizeInBits > 32) { throw new UnsupportedAudioFileException("Invalid AIFF/COMM sampleSize"); } --- 104,114 ---- // Read header info. int channels = dis.readUnsignedShort(); if (channels <= 0) { throw new UnsupportedAudioFileException("Invalid number of channels"); } ! frameLength = dis.readInt() & 0xffffffffL; // numSampleFrames int sampleSizeInBits = dis.readUnsignedShort(); if (sampleSizeInBits < 1 || sampleSizeInBits > 32) { throw new UnsupportedAudioFileException("Invalid AIFF/COMM sampleSize"); }
< prev index next >