[Scummvm-cvs-logs] SF.net SVN: scummvm:[42833] tools/branches/gsoc2009-gui
Remere at users.sourceforge.net
Remere at users.sourceforge.net
Mon Jul 27 05:11:58 CEST 2009
Revision: 42833
http://scummvm.svn.sourceforge.net/scummvm/?rev=42833&view=rev
Author: Remere
Date: 2009-07-27 03:11:58 +0000 (Mon, 27 Jul 2009)
Log Message:
-----------
*Removed macro hack to display the common compression help message and replaced it with streams instead.
Modified Paths:
--------------
tools/branches/gsoc2009-gui/compress.cpp
tools/branches/gsoc2009-gui/compress.h
tools/branches/gsoc2009-gui/compress_agos.cpp
tools/branches/gsoc2009-gui/compress_kyra.cpp
tools/branches/gsoc2009-gui/compress_queen.cpp
tools/branches/gsoc2009-gui/compress_saga.cpp
tools/branches/gsoc2009-gui/compress_scumm_san.cpp
tools/branches/gsoc2009-gui/compress_scumm_sou.cpp
tools/branches/gsoc2009-gui/compress_sword1.cpp
tools/branches/gsoc2009-gui/compress_sword2.cpp
tools/branches/gsoc2009-gui/compress_tinsel.cpp
tools/branches/gsoc2009-gui/compress_touche.cpp
tools/branches/gsoc2009-gui/extract_scumm_mac.cpp
tools/branches/gsoc2009-gui/tool.cpp
tools/branches/gsoc2009-gui/tool.h
Modified: tools/branches/gsoc2009-gui/compress.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress.cpp 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/compress.cpp 2009-07-27 03:11:58 UTC (rev 42833)
@@ -22,6 +22,8 @@
#include "compress.h"
+#include <sstream>
+
typedef struct {
uint32 minBitr;
uint32 maxBitr;
@@ -914,3 +916,60 @@
}
_arguments_parsed = (size_t)arg;
}
+
+std::string CompressionTool::getHelp() const {
+ std::ostringstream os;
+
+ // Standard help text + our additions
+ os << Tool::getHelp();
+
+ if (_supportedFormats == AUDIO_NONE)
+ return os.str();
+
+ os << "\nParams:\n";
+
+ if (_supportedFormats & AUDIO_MP3)
+ os << " --mp3 encode to MP3 format (default)\n";
+ if (_supportedFormats & AUDIO_VORBIS)
+ os << " --vorbis encode to Vorbis format\n";
+ if (_supportedFormats & AUDIO_FLAC)
+ os << " --flac encode to Flac format\n";
+ os << "(If one of these is specified, it must be the first parameter.)\n";
+
+ if (_supportedFormats & AUDIO_MP3) {
+ os << "\nMP3 mode params:\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 << " --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 << " -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";
+ }
+
+ if (_supportedFormats & AUDIO_VORBIS) {
+ os << "\nVorbis mode params:\n";
+ os << " -b <rate> <rate> is the nominal bitrate (default:unset)\n";
+ os << " -m <rate> <rate> is the minimum bitrate (default:unset)\n";
+ os << " -M <rate> <rate> is the maximum bitrate (default:unset)\n";
+ os << " -q <value> specifies the value (0 - 10) of VBR quality (10=best) (default:" << oggqualDef << ")\n";
+ os << " --silent the output of oggenc is hidden (default:disabled)\n";
+ }
+
+ if (_supportedFormats & AUDIO_FLAC) {
+ os << "\nFlac mode params:\n";
+ os << " --fast FLAC uses compression level 0\n";
+ os << " --best FLAC uses compression level 8\n";
+ os << " -<value> specifies the value (0 - 8) of compression (8=best)(default:" << flacCompressDef << ")\n";
+ os << " -b <value> specifies a blocksize of <value> samples (default:" << flacBlocksizeDef << ")\n";
+ os << " --verify files are encoded and then decoded to check accuracy\n";
+ os << " --silent the output of FLAC is hidden (default:disabled)\n";
+ }
+
+ os << "\n --help this help message\n";
+
+ os << "\n\nIf a parameter is not given the default value is used\n";
+ os << "If using VBR mode for MP3 -b and -B must be multiples of 8; the maximum is 160!\n";
+
+ return os.str();
+}
Modified: tools/branches/gsoc2009-gui/compress.h
===================================================================
--- tools/branches/gsoc2009-gui/compress.h 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/compress.h 2009-07-27 03:11:58 UTC (rev 42833)
@@ -40,18 +40,16 @@
/* These are the defaults parameters for the Lame invocation */
#define minBitrDef 24
-#define maxBitrDef_str "64"
-#define algqualDef_str "2"
-#define vbrqualDef_str "4"
+#define maxBitrDef 64
+#define algqualDef 2
+#define vbrqualDef 4
-#define INT_STR(x) #x
-
/* The default for oggenc invocation is to use the --quality option only */
-#define oggqualDef_str "3"
+#define oggqualDef 3
/* These are the default parameters for the FLAC invocation */
-#define flacCompressDef_str "8"
-#define flacBlocksizeDef_str "1152"
+#define flacCompressDef 8
+#define flacBlocksizeDef 1152
#define TEMP_WAV "tempfile.wav"
#define TEMP_RAW "tempfile.raw"
@@ -70,6 +68,8 @@
public:
CompressionTool(const std::string &name, ToolType type);
+ virtual std::string getHelp() const;
+
void parseAudioArguments();
public:
AudioFormat _format;
@@ -111,50 +111,4 @@
*/
const extern char *tempEncoded;
-
-/* Integer definitions for the constants above */
-#define maxBitrDef atoi(maxBitrDef_str)
-#define algqualDef atoi(algqualDef_str)
-#define vbrqualDef atoi(vbrqualDef_str)
-#define oggqualDef atoi(oggqualDef_str)
-#define flacCompressDef atoi(flacCompressDef_str)
-#define flacBlocksizeDef atoi(flacBlocksizeDef_str)
-
-/* Perhaps this should be in a seperate file */
-#define kCompressionAudioHelp \
- "\nParams:\n" \
- " --mp3 encode to MP3 format (default)\n" \
- " --vorbis encode to Vorbis format\n" \
- " --flac encode to Flac format\n" \
- "(If one of these is specified, it must be the first parameter.)\n" \
- \
- "\nMP3 mode params:\n" \
- " -b <rate> <rate> is the target bitrate(ABR)/minimal bitrate(VBR) (default:" INT_STR(minBitrDef) "%d)\n" \
- " -B <rate> <rate> is the maximum VBR/ABR bitrate (default:%" maxBitrDef_str ")\n" \
- " --vbr LAME uses the VBR mode (default)\n" \
- " --abr LAME uses the ABR mode\n" \
- " -V <value> specifies the value (0 - 9) of VBR quality (0=best) (default:" vbrqualDef_str "%d)\n" \
- " -q <value> specifies the MPEG algorithm quality (0-9; 0=best) (default:" algqualDef_str ")\n" \
- " --silent the output of LAME is hidden (default:disabled)\n" \
- \
- "\nVorbis mode params:\n" \
- " -b <rate> <rate> is the nominal bitrate (default:unset)\n" \
- " -m <rate> <rate> is the minimum bitrate (default:unset)\n" \
- " -M <rate> <rate> is the maximum bitrate (default:unset)\n" \
- " -q <value> specifies the value (0 - 10) of VBR quality (10=best) (default:" oggqualDef_str ")\n" \
- " --silent the output of oggenc is hidden (default:disabled)\n" \
- \
- "\nFlac mode params:\n" \
- " --fast FLAC uses compression level 0\n" \
- " --best FLAC uses compression level 8\n" \
- " -<value> specifies the value (0 - 8) of compression (8=best)(default:" flacCompressDef_str ")\n" \
- " -b <value> specifies a blocksize of <value> samples (default:" flacBlocksizeDef_str ")\n" \
- " --verify files are encoded and then decoded to check accuracy\n" \
- " --silent the output of FLAC is hidden (default:disabled)\n" \
- \
- "\n --help this help message\n" \
- \
- "\n\nIf a parameter is not given the default value is used\n" \
- "If using VBR mode for MP3 -b and -B must be multiples of 8; the maximum is 160!\n";
-
#endif
Modified: tools/branches/gsoc2009-gui/compress_agos.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_agos.cpp 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/compress_agos.cpp 2009-07-27 03:11:58 UTC (rev 42833)
@@ -35,7 +35,7 @@
_inputPaths.push_back(input);
_shorthelp = "Compresses Simon the Sorcer and Feeble Files data files.";
- _helptext = "\nUsage: " + getName() + " [mode params] [--mac] [-o outfile] <infile>\n" kCompressionAudioHelp
+ _helptext = "\nUsage: " + getName() + " [mode params] [--mac] [-o outfile] <infile>\n";
}
void CompressAgos::end() {
Modified: tools/branches/gsoc2009-gui/compress_kyra.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_kyra.cpp 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/compress_kyra.cpp 2009-07-27 03:11:58 UTC (rev 42833)
@@ -33,7 +33,7 @@
_inputPaths.push_back(input);
_shorthelp = "Used to compress Legend of Kyrandia games.";
- _helptext = "\nUsage: " + getName() + " [mode params] [-o outfile] <infile>\n" kCompressionAudioHelp;
+ _helptext = "\nUsage: " + getName() + " [mode params] [-o outfile] <infile>\n";
}
void CompressKyra::execute() {
Modified: tools/branches/gsoc2009-gui/compress_queen.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_queen.cpp 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/compress_queen.cpp 2009-07-27 03:11:58 UTC (rev 42833)
@@ -98,7 +98,7 @@
_inputPaths.push_back(input);
_shorthelp = "Used to compress Flight of the Amazon Queen data files.";
- _helptext = "\nUsage: " + getName() + " [mode] [mode params] [-o outputfile] <inputfile (queen.1)>\n" kCompressionAudioHelp;
+ _helptext = "\nUsage: " + getName() + " [mode] [mode params] [-o outputfile] <inputfile (queen.1)>\n";
}
const CompressQueen::GameVersion *CompressQueen::detectGameVersion(uint32 size) {
Modified: tools/branches/gsoc2009-gui/compress_saga.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_saga.cpp 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/compress_saga.cpp 2009-07-27 03:11:58 UTC (rev 42833)
@@ -121,7 +121,7 @@
_inputPaths.push_back(input);
_shorthelp = "Used to compress SAGA engine games such as Inherit the Earth.";
- _helptext = "\nUsage: " + getName() +" [mode] [mode params] [-o outputfile = infile.cmp] <inputfile>\n" kCompressionAudioHelp;
+ _helptext = "\nUsage: " + getName() +" [mode] [mode params] [-o outputfile = infile.cmp] <inputfile>\n";
}
bool CompressSaga::inspectInput(const Filename &filename) {
Modified: tools/branches/gsoc2009-gui/compress_scumm_san.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_san.cpp 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/compress_scumm_san.cpp 2009-07-27 03:11:58 UTC (rev 42833)
@@ -584,7 +584,7 @@
_shorthelp = "Used to compress the .san smush files.";
// TODO: Feature set seems more limited than what kCompressionAudioHelp contains
- _helptext = "\nUsage: " + getName() + " [mode] [mode-params] [-o outpufile = inputfile.san] <inputfile>\n" kCompressionAudioHelp;
+ _helptext = "\nUsage: " + getName() + " [mode] [mode-params] [-o outpufile = inputfile.san] <inputfile>\n";
}
void CompressScummSan::execute() {
Modified: tools/branches/gsoc2009-gui/compress_scumm_sou.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_sou.cpp 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/compress_scumm_sou.cpp 2009-07-27 03:11:58 UTC (rev 42833)
@@ -136,7 +136,7 @@
_inputPaths.push_back(input);
_shorthelp = "Used to compress the .sou data files.";
- _helptext = "\nUsage: " + getName() + " [mode] [mode params] monster.sou\n" kCompressionAudioHelp;
+ _helptext = "\nUsage: " + getName() + " [mode] [mode params] monster.sou\n";
}
void CompressScummSou::execute() {
Modified: tools/branches/gsoc2009-gui/compress_sword1.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword1.cpp 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/compress_sword1.cpp 2009-07-27 03:11:58 UTC (rev 42833)
@@ -577,8 +577,7 @@
_helptext = "\nUsage: " + getName() + " [only] [mode] [mode params] [-o outputdir] <inputdir>\n"
"only can be either:\n"
" --speech-only only encode speech clusters\n"
- " --music-only only encode music files\n"
- kCompressionAudioHelp;
+ " --music-only only encode music files\n";
}
void CompressSword1::parseExtraArguments() {
Modified: tools/branches/gsoc2009-gui/compress_sword2.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword2.cpp 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/compress_sword2.cpp 2009-07-27 03:11:58 UTC (rev 42833)
@@ -57,7 +57,7 @@
_inputPaths.push_back(input);
_shorthelp = "Used to compress Broken Sword 2 data files.";
- _helptext = "\nUsage: " + getName() + " [params] <file>\n\n" kCompressionAudioHelp;
+ _helptext = "\nUsage: " + getName() + " [params] <file>\n\n";
}
void CompressSword2::execute() {
Modified: tools/branches/gsoc2009-gui/compress_tinsel.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_tinsel.cpp 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/compress_tinsel.cpp 2009-07-27 03:11:58 UTC (rev 42833)
@@ -59,7 +59,7 @@
_inputPaths.push_back(input2);
_shorthelp = "Used to compress tinsel .smp files.";
- _helptext = "\nUsage: " + getName() + " [mode-params] [-o outputname] <infile.smp> <infile.idx>\n" + kCompressionAudioHelp;
+ _helptext = "\nUsage: " + getName() + " [mode-params] [-o outputname] <infile.smp> <infile.idx>\n";
}
/* Converts raw-data sample in input_smp of size SampleSize to requested dataformat and writes to output_smp */
Modified: tools/branches/gsoc2009-gui/compress_touche.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_touche.cpp 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/compress_touche.cpp 2009-07-27 03:11:58 UTC (rev 42833)
@@ -46,7 +46,7 @@
_inputPaths.push_back(input);
_shorthelp = "Used to compress Touche speech files (Vxxx and OBJ).";
- _helptext = "\nUsage: " + getName() + " [params] [-o outputfile TOUCHE.*] <inputdir>\n* differs with compression type.\n" kCompressionAudioHelp;
+ _helptext = "\nUsage: " + getName() + " [params] [-o outputfile TOUCHE.*] <inputdir>\n* differs with compression type.\n";
}
uint32 CompressTouche::compress_sound_data_file(uint32 current_offset, File &output, File &input, uint32 *offs_table, uint32 *size_table, int len) {
Modified: tools/branches/gsoc2009-gui/extract_scumm_mac.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_scumm_mac.cpp 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/extract_scumm_mac.cpp 2009-07-27 03:11:58 UTC (rev 42833)
@@ -35,7 +35,7 @@
_shorthelp = "Extract data from Lucas Art CDs, sometimes the CD appears to only hold an \n"
"application but there is a hidden data file.";
_helptext =
- "\nUsage: " + _name + " [-o <output dir> = out/] <file>\n" +
+ "\nUsage: " + getName() + " [-o <output dir> = out/] <file>\n" +
_shorthelp + "\n";
}
Modified: tools/branches/gsoc2009-gui/tool.cpp
===================================================================
--- tools/branches/gsoc2009-gui/tool.cpp 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/tool.cpp 2009-07-27 03:11:58 UTC (rev 42833)
@@ -67,7 +67,7 @@
// Check for help
if (_arguments.empty() || _arguments[0] == "-h" || _arguments[0] == "--help") {
- print(_helptext.c_str());
+ print(getHelp().c_str());
return 2;
}
Modified: tools/branches/gsoc2009-gui/tool.h
===================================================================
--- tools/branches/gsoc2009-gui/tool.h 2009-07-27 03:08:19 UTC (rev 42832)
+++ tools/branches/gsoc2009-gui/tool.h 2009-07-27 03:11:58 UTC (rev 42833)
@@ -102,10 +102,10 @@
std::string getName() const;
/** Returns the helpstring of the tool */
- std::string getHelp() const;
+ virtual std::string getHelp() const;
/** Returns the helpstring of the tool */
- std::string getShortHelp() const;
+ virtual std::string getShortHelp() const;
/** Returns the type of the tool */
ToolType getType() const;
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