[Scummvm-cvs-logs] SF.net SVN: scummvm:[47542] tools/trunk/compress.cpp
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Mon Jan 25 02:42:22 CET 2010
Revision: 47542
http://scummvm.svn.sourceforge.net/scummvm/?rev=47542&view=rev
Author: lordhoto
Date: 2010-01-25 01:42:22 +0000 (Mon, 25 Jan 2010)
Log Message:
-----------
Strip trailing whitespaces/tabs.
Modified Paths:
--------------
tools/trunk/compress.cpp
Modified: tools/trunk/compress.cpp
===================================================================
--- tools/trunk/compress.cpp 2010-01-25 01:39:44 UTC (rev 47541)
+++ tools/trunk/compress.cpp 2010-01-25 01:42:22 UTC (rev 47542)
@@ -609,19 +609,19 @@
inFile.read_throwsOnError(buf, 4);
if (memcmp(buf, "AIFF", 4) != 0)
error("Error: AIFF file has no 'AIFF' header");
-
+
bool foundCOMM = false;
bool foundSSND = false;
uint16 numChannels = 0, bitsPerSample = 0;
uint32 numSampleFrames = 0, offset = 0, blockSize = 0, soundOffset = 0;
uint32 sampleRate = 0;
-
+
while ((!foundCOMM || !foundSSND) && !inFile.err() && !inFile.eos()) {
-
+
inFile.read_throwsOnError(buf, 4);
uint32 length = inFile.readUint32BE();
uint32 pos = inFile.pos();
-
+
if (memcmp(buf, "COMM", 4) == 0) {
foundCOMM = true;
numChannels = inFile.readUint16BE();
@@ -635,12 +635,12 @@
inFile.read_throwsOnError(rate_buf, 10);
sampleRate = READ_BE_UINT32(rate_buf + 2);
byte exp = 30 - rate_buf[1];
-
+
while (exp--) {
last = sampleRate;
sampleRate >>= 1;
}
-
+
if (last & 0x00000001)
sampleRate++;
} else if (memcmp(buf, "SSND", 4) == 0) {
@@ -649,25 +649,25 @@
blockSize = inFile.readUint32BE();
soundOffset = inFile.pos();
}
-
+
inFile.seek(pos + length, SEEK_SET);
}
if (!foundCOMM)
error("Error: AIFF file has no 'COMM' chunk in 'AIFF' header");
-
+
if (!foundSSND)
error("Error: AIFF file has no 'COMM' chunk in 'SSND' header");
-
+
// Only a subset of the AIFF format is supported
if (numChannels < 1 || numChannels > 2)
error("Error: AIFF file has an unsupported number of channels");
-
+
if (bitsPerSample != 8 && bitsPerSample != 16)
error("Error: AIFF file has an unsupported number of bits per sample");
-
+
if (offset != 0 || blockSize != 0)
error("Error: AIFF file has block-aligned data, which is not supported");
-
+
// Get data and write to temporary file
uint32 size = numSampleFrames * numChannels * (bitsPerSample / 8);
inFile.seek(soundOffset, SEEK_SET);
@@ -677,12 +677,12 @@
tmpFile.write(aifData, size);
tmpFile.close();
free(aifData);
-
+
// Convert the temporary raw file to MP3/OGG/FLAC
// Samples are always signed, and big endian.
setRawAudioType(false, numChannels == 2, bitsPerSample);
encodeAudio(TEMP_RAW, true, sampleRate, outName, compmode);
-
+
// Delete temporary file
unlink(TEMP_RAW);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list