diff --git a/compress.cpp b/compress.cpp index f3d9c5c1..df93aa92 100644 --- a/compress.cpp +++ b/compress.cpp @@ -910,17 +910,14 @@ void CompressionTool::parseAudioArguments() { // Need workaround to be sign-correct switch (_format) { case AUDIO_MP3: - tempEncoded = TEMP_MP3; if (!processMp3Parms()) throw ToolException("Could not parse command line arguments, use --help for options"); break; case AUDIO_VORBIS: - tempEncoded = TEMP_OGG; if (!processOggParms()) throw ToolException("Could not parse command line arguments, use --help for options"); break; case AUDIO_FLAC: - tempEncoded = TEMP_FLAC; if (!processFlacParms()) throw ToolException("Could not parse arguments: Use --help for options"); break; @@ -929,6 +926,22 @@ void CompressionTool::parseAudioArguments() { } } +void CompressionTool::setTempFileName() { + switch (_format) { + case AUDIO_MP3: + tempEncoded = TEMP_MP3; + break; + case AUDIO_VORBIS: + tempEncoded = TEMP_OGG; + break; + case AUDIO_FLAC: + tempEncoded = TEMP_FLAC; + break; + default: // cannot occur but we check anyway to avoid compiler warnings + throw ToolException("Unknown audio format, should be impossible!"); + } +} + std::string CompressionTool::getHelp() const { std::ostringstream os; diff --git a/compress.h b/compress.h index 0e0fd580..c64e0385 100644 --- a/compress.h +++ b/compress.h @@ -127,6 +127,8 @@ public: bool processOggParms(); bool processFlacParms(); + void setTempFileName(); + void extractAndEncodeVOC(const char *outName, File &input, AudioFormat compMode); void extractAndEncodeWAV(const char *outName, File &input, AudioFormat compMode); diff --git a/tool.cpp b/tool.cpp index a47d8145..dfe5ce37 100644 --- a/tool.cpp +++ b/tool.cpp @@ -135,6 +135,8 @@ void Tool::run() { _abort = false; + setTempFileName(); + // Change output to directory if necessary if (_outputToDirectory && _outputPath.empty() == false) { // Ensure last character is a /, this way we force directory output @@ -259,6 +261,9 @@ void Tool::updateProgress(int done, int total) { void Tool::parseAudioArguments() { } +void Tool::setTempFileName() { +} + void Tool::parseOutputArguments() { if (_arguments.empty()) return; diff --git a/tool.h b/tool.h index 2fa3beb8..7f76e5a7 100644 --- a/tool.h +++ b/tool.h @@ -190,6 +190,7 @@ public: protected: virtual void parseAudioArguments(); + virtual void setTempFileName(); void parseOutputArguments(); /** Parses the arguments only this tool takes. */