[Scummvm-cvs-logs] SF.net SVN: scummvm:[48849] tools/trunk
criezy at users.sourceforge.net
criezy at users.sourceforge.net
Thu Apr 29 01:22:32 CEST 2010
Revision: 48849
http://scummvm.svn.sourceforge.net/scummvm/?rev=48849&view=rev
Author: criezy
Date: 2010-04-28 23:22:32 +0000 (Wed, 28 Apr 2010)
Log Message:
-----------
Improve arguments handling when using tools to compress to MP3.
Do not give a maximum bitrate to lame when encoding to ABR MP3 since the lame documentation says "this is NOT RECOMMENDED". Also use a different variable for ABR target bitrate and VBR minimum bitrate and make sure the VBR minimum bitrate is a multiple of 8 since this is required by lame. The ABR target bitrate however does not need to be a multiple of 8.
Also fix incorrect use of %d in the compression tool help.
Modified Paths:
--------------
tools/trunk/NEWS
tools/trunk/compress.cpp
tools/trunk/compress.h
Modified: tools/trunk/NEWS
===================================================================
--- tools/trunk/NEWS 2010-04-28 23:17:00 UTC (rev 48848)
+++ tools/trunk/NEWS 2010-04-28 23:22:32 UTC (rev 48849)
@@ -2,18 +2,20 @@
http://scummvm.svn.sourceforge.net/viewvc/scummvm/tools/trunk/?view=log
1.2.0 (????-??-??)
- - Fix bug #2984225: "Tools: configure should check if libwxgtk2.8-dev is installed"
- - Add version information to tools
- - Respect $BINDIR when installing (similar to ScummVM)
- - Fix bug #2983010: GUI Tools builds even if optioned out
+ - Fix bug #2984225: "Tools: configure should check if libwxgtk2.8-dev is installed".
+ - Add version information to tools.
+ - Respect $BINDIR when installing (similar to ScummVM).
+ - Fix bug #2983010: GUI Tools builds even if optioned out.
+ - Do not give a maximum bitrate to lame when encoding to ABR MP3 since the lame
+ documentation says "this is NOT RECOMMENDED".
1.1.1 (????-??-??)
First tools version to contain a NEWS file.
- Improve the way the images are loaded for the tools GUI. It increases the chances of success.
- - Fix bug #2984217: "Tools: The media directory is not intalled"
- - Fix bug #2905473: "GUI Tools: cannot use lame with compress_scumm_sou"
- - Patch #2982306: "set MP3 ABR bit rate in GUI Tools"
- - Patch #2982090: "Tools: include unistd.h for unlink"
+ - Fix bug #2984217: "Tools: The media directory is not intalled".
+ - Fix bug #2905473: "GUI Tools: cannot use lame with compress_scumm_sou".
+ - Patch #2982306: "set MP3 ABR bit rate in GUI Tools".
+ - Patch #2982090: "Tools: include unistd.h for unlink".
- Patch #2982091: "Tools: use $(INSTALL) instead of install".
- - Fix endian problem in create_sjisfnt
+ - Fix endian problem in create_sjisfnt.
Modified: tools/trunk/compress.cpp
===================================================================
--- tools/trunk/compress.cpp 2010-04-28 23:17:00 UTC (rev 48848)
+++ tools/trunk/compress.cpp 2010-04-28 23:22:32 UTC (rev 48849)
@@ -45,6 +45,7 @@
struct lameparams {
uint32 minBitr;
uint32 maxBitr;
+ uint32 targetBitr;
bool abr;
uint32 algqual;
uint32 vbrqual;
@@ -72,7 +73,7 @@
uint8 bitsPerSample;
};
-lameparams encparms = { minBitrDef, maxBitrDef, false, algqualDef, vbrqualDef, 0, "lame" };
+lameparams encparms = { minBitrDef, maxBitrDef, targetBitrDef, false, algqualDef, vbrqualDef, 0, "lame" };
oggencparams oggparms = { -1, -1, -1, (float)oggqualDef, 0 };
flaccparams flacparms = { flacCompressDef, flacBlocksizeDef, false, false };
rawtype rawAudioType = { false, false, 8 };
@@ -141,9 +142,11 @@
}
if (encparms.abr)
- tmp += sprintf(tmp, "--abr %d ", encparms.minBitr);
- else
+ tmp += sprintf(tmp, "--abr %d ", encparms.targetBitr);
+ else {
tmp += sprintf(tmp, "--vbr-new -b %d ", encparms.minBitr);
+ tmp += sprintf(tmp, "-B %d ", encparms.maxBitr);
+ }
/* Explicitly specify a target sample rate, to work around a bug (?)
* in newer lame versions (>= 3.95) which causes it to malfunction
@@ -162,7 +165,7 @@
tmp += sprintf(tmp, "-q %d ", encparms.algqual);
tmp += sprintf(tmp, "-V %d ", encparms.vbrqual);
- tmp += sprintf(tmp, "-B %d ", encparms.maxBitr);
+
tmp += sprintf(tmp, "\"%s\" \"%s\" ", inname, outname);
err = spawnSubprocess(fbuf) != 0;
@@ -794,7 +797,13 @@
}
void CompressionTool::setMp3ABRBitrate(const std::string& arg) {
- setMp3VBRMinBitrate(arg);
+ encparms.minBitr = atoi(arg.c_str());
+
+ if (encparms.targetBitr == 0 && arg != "0")
+ throw ToolException("Minimum bitrate (-b) must be a number.");
+
+ if (encparms.targetBitr < 8 || encparms.targetBitr > 160)
+ throw ToolException("Minimum bitrate out of bounds (-b), must be between 8 and 160.");
}
void CompressionTool::setMp3VBRMinBitrate(const std::string& arg) {
@@ -802,6 +811,9 @@
if (encparms.minBitr == 0 && arg != "0")
throw ToolException("Minimum bitrate (-b) must be a number.");
+
+ if ((encparms.minBitr % 8) != 0)
+ encparms.maxBitr -= encparms.minBitr % 8;
if (encparms.minBitr < 8 || encparms.minBitr > 160)
throw ToolException("Minimum bitrate out of bounds (-b), must be between 8 and 160.");
@@ -1114,11 +1126,11 @@
if (_supportedFormats & AUDIO_MP3) {
os << "\nMP3 mode params:\n";
os << " --lame-path <path> Path to the lame excutable to use (default: lame)\n";
- os << " -b <rate> <rate> is the target bitrate(ABR)/minimal bitrate(VBR) (default:" << minBitrDef << "%d)\n";
- os << " -B <rate> <rate> is the maximum VBR/ABR bitrate (default:%" << maxBitrDef << ")\n";
+ os << " -b <rate> <rate> is the target bitrate(ABR)/minimal bitrate(VBR) (default:" << targetBitrDef << " for ABR and " << minBitrDef << " for VBR)\n";
+ os << " -B <rate> <rate> is the maximum VBR bitrate (default:" << maxBitrDef << ")\n";
os << " --vbr LAME uses the VBR mode (default)\n";
os << " --abr LAME uses the ABR mode\n";
- os << " -V <value> specifies the value (0 - 9) of VBR quality (0=best) (default:" << vbrqualDef << "%d)\n";
+ os << " -V <value> specifies the value (0 - 9) of VBR quality (0=best) (default:" << vbrqualDef << ")\n";
os << " -q <value> specifies the MPEG algorithm quality (0-9; 0=best) (default:" << algqualDef << ")\n";
os << " --silent the output of LAME is hidden (default:disabled)\n";
}
Modified: tools/trunk/compress.h
===================================================================
--- tools/trunk/compress.h 2010-04-28 23:17:00 UTC (rev 48848)
+++ tools/trunk/compress.h 2010-04-28 23:22:32 UTC (rev 48849)
@@ -30,6 +30,7 @@
/* These are the defaults parameters for the Lame invocation */
minBitrDef = 24,
maxBitrDef = 64,
+ targetBitrDef = 32,
algqualDef = 2,
vbrqualDef = 4,
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