Update file properties after the decoding step by using SoX in "--i" mode. Required, because some properties (such as 'bits per sample') cannot be known beforehand.

This commit is contained in:
LoRd_MuldeR 2011-12-22 00:06:34 +01:00
parent 6f7dae6391
commit 1a238db3db
48 changed files with 377 additions and 170 deletions

View File

@ -309,6 +309,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
<ClCompile Include="src\Thread_Process.cpp" />
<ClCompile Include="src\Thread_RAMObserver.cpp" />
<ClCompile Include="src\Tool_Abstract.cpp" />
<ClCompile Include="src\Tool_WaveProperties.cpp" />
<ClCompile Include="src\WinSevenTaskbar.cpp" />
<ClCompile Include="tmp\MOC_Decoder_Abstract.cpp" />
<ClCompile Include="tmp\MOC_Dialog_About.cpp" />
@ -348,6 +349,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
<ClCompile Include="tmp\MOC_Thread_Process.cpp" />
<ClCompile Include="tmp\MOC_Thread_RAMObserver.cpp" />
<ClCompile Include="tmp\MOC_Tool_Abstract.cpp" />
<ClCompile Include="tmp\MOC_Tool_WaveProperties.cpp" />
<ClCompile Include="tmp\QRC_Documents.cpp" />
<ClCompile Include="tmp\QRC_Flags.cpp" />
<ClCompile Include="tmp\QRC_Icons.cpp" />
@ -450,6 +452,17 @@ del "$(TargetDir)imageformats\q???d4.dll"
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
</CustomBuild>
<ClInclude Include="src\Tools.h" />
<CustomBuild Include="src\Tool_WaveProperties.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<ClInclude Include="tmp\UIC_CueSheetImport.h" />
<ClInclude Include="tmp\UIC_DropBox.h" />
<ClInclude Include="tmp\UIC_LogViewDialog.h" />

View File

@ -340,6 +340,12 @@
<ClCompile Include="tmp\MOC_Encoder_AAC_QAAC.cpp">
<Filter>Generated Files\MOC</Filter>
</ClCompile>
<ClCompile Include="src\Tool_WaveProperties.cpp">
<Filter>Source Files\Misc</Filter>
</ClCompile>
<ClCompile Include="tmp\MOC_Tool_WaveProperties.cpp">
<Filter>Generated Files\MOC</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Config.h">
@ -635,6 +641,9 @@
<CustomBuild Include="src\Encoder_AAC_QAAC.h">
<Filter>Header Files\Encoders</Filter>
</CustomBuild>
<CustomBuild Include="src\Tool_WaveProperties.h">
<Filter>Header Files\Misc</Filter>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<None Include="res\MainIcon.ico" />

View File

@ -2533,107 +2533,112 @@
<context>
<name>ProcessThread</name>
<message>
<location filename="../../src/Thread_Process.cpp" line="118"/>
<location filename="../../src/Thread_Process.cpp" line="124"/>
<source>Starting...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="126"/>
<location filename="../../src/Thread_Process.cpp" line="132"/>
<source>Not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="169"/>
<location filename="../../src/Thread_Process.cpp" line="165"/>
<source>The format of this file is NOT supported:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="169"/>
<location filename="../../src/Thread_Process.cpp" line="165"/>
<source>Container Format:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="169"/>
<location filename="../../src/Thread_Process.cpp" line="165"/>
<source>Audio Format:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="170"/>
<location filename="../../src/Thread_Process.cpp" line="166"/>
<source>Unsupported!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="215"/>
<location filename="../../src/Thread_Process.cpp" line="248"/>
<source>Done.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="215"/>
<location filename="../../src/Thread_Process.cpp" line="248"/>
<source>Aborted!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="215"/>
<location filename="../../src/Thread_Process.cpp" line="248"/>
<source>Failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="232"/>
<location filename="../../src/Thread_Process.cpp" line="265"/>
<source>Encoding</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="235"/>
<location filename="../../src/Thread_Process.cpp" line="268"/>
<source>Analyzing</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="271"/>
<source>Filtering</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="238"/>
<location filename="../../src/Thread_Process.cpp" line="274"/>
<source>Decoding</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="261"/>
<location filename="../../src/Thread_Process.cpp" line="297"/>
<source>The source audio file could not be found:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="268"/>
<location filename="../../src/Thread_Process.cpp" line="304"/>
<source>The source audio file could not be opened for reading:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="294"/>
<location filename="../../src/Thread_Process.cpp" line="330"/>
<source>The target output directory doesn&apos;t exist and could NOT be created:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="302"/>
<location filename="../../src/Thread_Process.cpp" line="338"/>
<source>The target output directory is NOT writable:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="312"/>
<location filename="../../src/Thread_Process.cpp" line="348"/>
<source>Unknown File Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="314"/>
<location filename="../../src/Thread_Process.cpp" line="350"/>
<source>Unknown Title</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="315"/>
<location filename="../../src/Thread_Process.cpp" line="351"/>
<source>Unknown Artist</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="316"/>
<location filename="../../src/Thread_Process.cpp" line="352"/>
<source>Unknown Album</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="318"/>
<location filename="../../src/Thread_Process.cpp" line="354"/>
<source>Unknown Comment</source>
<translation type="unfinished"></translation>
</message>

View File

@ -2042,6 +2042,10 @@
<source>Unknown Comment</source>
<translation>Unbekannter Kommentar</translation>
</message>
<message>
<source>Analyzing</source>
<translation>Prüfe</translation>
</message>
</context>
<context>
<name>ProcessingDialog</name>

View File

@ -2041,6 +2041,10 @@
<source>Unknown Comment</source>
<translation>Comentario desconocido</translation>
</message>
<message>
<source>Analyzing</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProcessingDialog</name>

View File

@ -2051,6 +2051,10 @@ Ouvrir le dossier récursivement...</translation>
<source>Unknown Comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analyzing</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProcessingDialog</name>

View File

@ -2042,6 +2042,10 @@
<source>Unknown Comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analyzing</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProcessingDialog</name>

View File

@ -2041,6 +2041,10 @@
<source>Unknown Comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analyzing</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProcessingDialog</name>

View File

@ -2533,107 +2533,112 @@
<context>
<name>ProcessThread</name>
<message>
<location filename="../../src/Thread_Process.cpp" line="118"/>
<location filename="../../src/Thread_Process.cpp" line="124"/>
<source>Starting...</source>
<translation type="unfinished">Rozpoczynanie...</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="126"/>
<location filename="../../src/Thread_Process.cpp" line="132"/>
<source>Not found!</source>
<translation type="unfinished">Nie znaleziono!</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="169"/>
<location filename="../../src/Thread_Process.cpp" line="165"/>
<source>The format of this file is NOT supported:</source>
<translation type="unfinished">Format tego pliku NIE jest obsługiwany:</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="169"/>
<location filename="../../src/Thread_Process.cpp" line="165"/>
<source>Container Format:</source>
<translation type="unfinished">Format kontenera:</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="169"/>
<location filename="../../src/Thread_Process.cpp" line="165"/>
<source>Audio Format:</source>
<translation type="unfinished">Format dźwięku:</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="170"/>
<location filename="../../src/Thread_Process.cpp" line="166"/>
<source>Unsupported!</source>
<translation type="unfinished">Nieobsługiwany!</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="215"/>
<location filename="../../src/Thread_Process.cpp" line="248"/>
<source>Done.</source>
<translation type="unfinished">Zrobione.</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="215"/>
<location filename="../../src/Thread_Process.cpp" line="248"/>
<source>Aborted!</source>
<translation type="unfinished">Przerwane!</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="215"/>
<location filename="../../src/Thread_Process.cpp" line="248"/>
<source>Failed!</source>
<translation type="unfinished">Niepowodzenie!</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="232"/>
<location filename="../../src/Thread_Process.cpp" line="265"/>
<source>Encoding</source>
<translation type="unfinished">Kompresowanie</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="235"/>
<location filename="../../src/Thread_Process.cpp" line="268"/>
<source>Analyzing</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="271"/>
<source>Filtering</source>
<translation type="unfinished">Filtrowanie</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="238"/>
<location filename="../../src/Thread_Process.cpp" line="274"/>
<source>Decoding</source>
<translation type="unfinished">Dekodowanie</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="261"/>
<location filename="../../src/Thread_Process.cpp" line="297"/>
<source>The source audio file could not be found:</source>
<translation type="unfinished">Źródłowy plik dźwiękowy nie został odnaleziony:</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="268"/>
<location filename="../../src/Thread_Process.cpp" line="304"/>
<source>The source audio file could not be opened for reading:</source>
<translation type="unfinished">Źródłowy plik dźwiękowy nie mógł zostać otworzony:</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="294"/>
<location filename="../../src/Thread_Process.cpp" line="330"/>
<source>The target output directory doesn&apos;t exist and could NOT be created:</source>
<translation type="unfinished">Lokalizacja docelowa nie istnieje lu NIE mogła zostać utworzona:</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="302"/>
<location filename="../../src/Thread_Process.cpp" line="338"/>
<source>The target output directory is NOT writable:</source>
<translation type="unfinished">Nie można zapisać do lokalizacji docelowej:</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="312"/>
<location filename="../../src/Thread_Process.cpp" line="348"/>
<source>Unknown File Name</source>
<translation type="unfinished">Nieznana nazwa pliku</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="314"/>
<location filename="../../src/Thread_Process.cpp" line="350"/>
<source>Unknown Title</source>
<translation type="unfinished">Nieznany Tytuł</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="315"/>
<location filename="../../src/Thread_Process.cpp" line="351"/>
<source>Unknown Artist</source>
<translation type="unfinished">Nieznany Artysta</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="316"/>
<location filename="../../src/Thread_Process.cpp" line="352"/>
<source>Unknown Album</source>
<translation type="unfinished">Nieznany Album</translation>
</message>
<message>
<location filename="../../src/Thread_Process.cpp" line="318"/>
<location filename="../../src/Thread_Process.cpp" line="354"/>
<source>Unknown Comment</source>
<translation type="unfinished">Nieznany Komentarz</translation>
</message>

View File

@ -2048,6 +2048,10 @@
<source>Unknown Comment</source>
<translation type="unfinished">Неизвестный Комментарий</translation>
</message>
<message>
<source>Analyzing</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProcessingDialog</name>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="zh_TW" sourcelanguage="tw">
<context>
@ -2041,6 +2041,10 @@
<source>Unknown Comment</source>
<translation></translation>
</message>
<message>
<source>Analyzing</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProcessingDialog</name>

View File

@ -1728,7 +1728,7 @@
</message>
<message>
<source>Skipping update check this time, please be patient...</source>
<translation>Наразі йде переривання перевірки оновлень, будь ласка, зачекайте...</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
@ -2042,6 +2042,10 @@
<source>Unknown Comment</source>
<translation>Невідомий коментар</translation>
</message>
<message>
<source>Analyzing</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProcessingDialog</name>
@ -2213,7 +2217,7 @@
</message>
<message>
<source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source>
<translation>Додаток &apos;%1&apos; був створений для Qt &apos;%2&apos;, але знайдено Qt &apos;%3&apos;.</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="zh_CN" sourcelanguage="cn">
<context>
@ -2041,6 +2041,10 @@
<source>Unknown Comment</source>
<translation></translation>
</message>
<message>
<source>Analyzing</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProcessingDialog</name>

Binary file not shown.

Binary file not shown.

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 11
#define VER_LAMEXP_BUILD 823
#define VER_LAMEXP_BUILD 825
///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!)

View File

@ -104,7 +104,7 @@ bool AACDecoder::decode(const QString &sourceFile, const QString &outputFile, vo
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -104,7 +104,7 @@ bool AC3Decoder::decode(const QString &sourceFile, const QString &outputFile, vo
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -108,7 +108,7 @@ bool ADPCMDecoder::decode(const QString &sourceFile, const QString &outputFile,
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -100,7 +100,7 @@ bool ALACDecoder::decode(const QString &sourceFile, const QString &outputFile, v
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -106,7 +106,7 @@ bool AvisynthDecoder::decode(const QString &sourceFile, const QString &outputFil
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -105,7 +105,7 @@ bool FLACDecoder::decode(const QString &sourceFile, const QString &outputFile, v
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -105,7 +105,7 @@ bool MACDecoder::decode(const QString &sourceFile, const QString &outputFile, vo
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -120,7 +120,7 @@ bool MP3Decoder::decode(const QString &sourceFile, const QString &outputFile, vo
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
{
return false;
}

View File

@ -100,7 +100,7 @@ bool MusepackDecoder::decode(const QString &sourceFile, const QString &outputFil
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -101,7 +101,7 @@ bool ShortenDecoder::decode(const QString &sourceFile, const QString &outputFile
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -103,7 +103,7 @@ bool SpeexDecoder::decode(const QString &sourceFile, const QString &outputFile,
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -106,7 +106,7 @@ bool TTADecoder::decode(const QString &sourceFile, const QString &outputFile, vo
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -109,7 +109,7 @@ bool VorbisDecoder::decode(const QString &sourceFile, const QString &outputFile,
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -106,7 +106,7 @@ bool WMADecoder::decode(const QString &sourceFile, const QString &outputFile, vo
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -105,7 +105,7 @@ bool WavPackDecoder::decode(const QString &sourceFile, const QString &outputFile
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -48,7 +48,7 @@ AACEncoder::~AACEncoder(void)
bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag)
{
const unsigned int fileDuration = (metaInfo.fileDuration() > 0) ? metaInfo.fileDuration() : detectLength(sourceFile, abortFlag);
const unsigned int fileDuration = metaInfo.fileDuration();
QProcess process;
QStringList args;
@ -188,7 +188,7 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
{
return false;
}
@ -252,7 +252,7 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
{
return false;
}
@ -260,77 +260,6 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
return true;
}
unsigned int AACEncoder::detectLength(const QString &sourceFile, volatile bool *abortFlag)
{
unsigned int duration = 0;
QProcess process;
QStringList args;
args << "--i" << sourceFile;
if(!startProcess(process, m_binary_sox, args))
{
return duration;
}
bool bTimeout = false;
bool bAborted = false;
QRegExp regExp("Duration\\s*:\\s*(\\d\\d):(\\d\\d):(\\d\\d)\\.(\\d\\d)", Qt::CaseInsensitive);
while(process.state() != QProcess::NotRunning)
{
if(*abortFlag)
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
if(!process.bytesAvailable() && process.state() == QProcess::Running)
{
process.kill();
qWarning("SoX process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
bTimeout = true;
break;
}
while(process.bytesAvailable() > 0)
{
QByteArray line = process.readLine();
QString text = QString::fromUtf8(line.constData()).simplified();
if(regExp.lastIndexIn(text) >= 0)
{
bool ok[4] = {false, false, false, false};
unsigned int tmp1 = regExp.cap(1).toUInt(&ok[0]);
unsigned int tmp2 = regExp.cap(2).toUInt(&ok[1]);
unsigned int tmp3 = regExp.cap(3).toUInt(&ok[2]);
unsigned int tmp4 = regExp.cap(4).toUInt(&ok[3]);
if(ok[0] && ok[1] && ok[2] && ok[3])
{
duration = (tmp1 * 3600) + (tmp2 * 60) + tmp3 + qRound(static_cast<double>(tmp4) / 100.0);
}
}
if(!text.isEmpty())
{
emit messageLogged(text);
}
}
}
process.waitForFinished();
if(process.state() != QProcess::NotRunning)
{
process.kill();
process.waitForFinished(-1);
}
//qWarning("Duration detected is: %u", duration);
return duration;
}
QString AACEncoder::extension(void)
{
return "mp4";

View File

@ -47,6 +47,4 @@ private:
const QString m_binary_sox;
int m_configProfile;
bool m_configEnable2Pass;
unsigned int detectLength(const QString &sourceFile, volatile bool *abortFlag);
};

View File

@ -150,7 +150,7 @@ bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel &meta
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
{
return false;
}

View File

@ -159,7 +159,7 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
{
return false;
}

View File

@ -146,7 +146,7 @@ bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
{
return false;
}

View File

@ -124,7 +124,7 @@ bool FLACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
{
return false;
}

View File

@ -192,7 +192,7 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
{
return false;
}

View File

@ -150,7 +150,7 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel &meta
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
{
return false;
}

View File

@ -147,7 +147,7 @@ bool DownmixFilter::apply(const QString &sourceFile, const QString &outputFile,
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -114,7 +114,7 @@ bool NormalizeFilter::apply(const QString &sourceFile, const QString &outputFile
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -112,7 +112,7 @@ bool ResampleFilter::apply(const QString &sourceFile, const QString &outputFile,
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -121,7 +121,7 @@ bool ToneAdjustFilter::apply(const QString &sourceFile, const QString &outputFil
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
return false;
}

View File

@ -391,7 +391,7 @@ void CueSplitter::splitFile(const QString &output, const int trackNo, const QStr
process.waitForFinished(-1);
}
if(process.exitStatus() != QProcess::NormalExit || QFileInfo(output).size() == 0)
if(process.exitCode() != EXIT_SUCCESS || QFileInfo(output).size() == 0)
{
qWarning("Splitting has failed !!!");
m_nTracksSkipped++;

View File

@ -29,6 +29,7 @@
#include "Filter_Abstract.h"
#include "Filter_Downmix.h"
#include "Filter_Resample.h"
#include "Tool_WaveProperties.h"
#include "Registry_Decoder.h"
#include "Model_Settings.h"
@ -61,7 +62,8 @@ ProcessThread::ProcessThread(const AudioFileModel &audioFile, const QString &out
m_jobId(QUuid::createUuid()),
m_prependRelativeSourcePath(prependRelativeSourcePath),
m_renamePattern("<BaseName>"),
m_aborted(false)
m_aborted(false),
m_propDetect(new WaveProperties())
{
if(m_mutex_genFileName)
{
@ -71,6 +73,9 @@ ProcessThread::ProcessThread(const AudioFileModel &audioFile, const QString &out
connect(m_encoder, SIGNAL(statusUpdated(int)), this, SLOT(handleUpdate(int)), Qt::DirectConnection);
connect(m_encoder, SIGNAL(messageLogged(QString)), this, SLOT(handleMessage(QString)), Qt::DirectConnection);
connect(m_propDetect, SIGNAL(statusUpdated(int)), this, SLOT(handleUpdate(int)), Qt::DirectConnection);
connect(m_propDetect, SIGNAL(messageLogged(QString)), this, SLOT(handleMessage(QString)), Qt::DirectConnection);
m_currentStep = UnknownStep;
}
@ -87,6 +92,7 @@ ProcessThread::~ProcessThread(void)
}
LAMEXP_DELETE(m_encoder);
LAMEXP_DELETE(m_propDetect);
}
////////////////////////////////////////////////////////////
@ -130,7 +136,9 @@ void ProcessThread::processFile()
QString sourceFile = m_audioFile.filePath();
//------------------
//Decode source file
//------------------
if(!m_filters.isEmpty() || !m_encoder->isFormatSupported(m_audioFile.formatContainerType(), m_audioFile.formatContainerProfile(), m_audioFile.formatAudioType(), m_audioFile.formatAudioProfile(), m_audioFile.formatAudioVersion()))
{
m_currentStep = DecodingStep;
@ -159,31 +167,44 @@ void ProcessThread::processFile()
emit processStateFinished(m_jobId, outFileName, false);
return;
}
}
//Check audio properties
if(bSuccess)
{
//Do we need to take care of downsampling the input?
if(m_encoder->supportedSamplerates())
//Update audio properties after decode
if(bSuccess)
{
insertDownsampleFilter();
}
if(m_encoder->supportedSamplerates() || m_encoder->supportedBitdepths() || m_encoder->requiresDownmix())
{
m_currentStep = AnalyzeStep;
bSuccess = m_propDetect->detect(sourceFile, &m_audioFile, &m_aborted);
//Do we need to change the bits per sample of the input?
if(m_encoder->supportedBitdepths())
{
insertBitdepthFilter();
}
if(bSuccess)
{
handleMessage("\n-------------------------------\n");
//Do we need Stereo downmix?
if(m_encoder->requiresDownmix())
{
insertDownmixFilter();
//Do we need to take care of downsampling the input?
if(m_encoder->supportedSamplerates())
{
insertDownsampleFilter();
}
//Do we need to change the bits per sample of the input?
if(m_encoder->supportedBitdepths())
{
insertBitdepthFilter();
}
//Do we need Stereo downmix?
if(m_encoder->requiresDownmix())
{
insertDownmixFilter();
}
}
}
}
}
//-----------------------
//Apply all audio filters
//-----------------------
if(bSuccess)
{
while(!m_filters.isEmpty())
@ -205,7 +226,9 @@ void ProcessThread::processFile()
}
}
//-----------------
//Encode audio file
//-----------------
if(bSuccess)
{
m_currentStep = EncodingStep;
@ -241,6 +264,9 @@ void ProcessThread::handleUpdate(int progress)
case EncodingStep:
emit processStateChanged(m_jobId, QString("%1 (%2%)").arg(tr("Encoding"), QString::number(progress)), ProgressModel::JobRunning);
break;
case AnalyzeStep:
emit processStateChanged(m_jobId, QString("%1 (%2%)").arg(tr("Analyzing"), QString::number(progress)), ProgressModel::JobRunning);
break;
case FilteringStep:
emit processStateChanged(m_jobId, QString("%1 (%2%)").arg(tr("Filtering"), QString::number(progress)), ProgressModel::JobRunning);
break;

View File

@ -30,6 +30,7 @@
class QMutex;
class AbstractFilter;
class WaveProperties;
class ProcessThread: public QThread
{
@ -60,9 +61,10 @@ private:
enum ProcessStep
{
DecodingStep = 0,
FilteringStep = 1,
EncodingStep = 2,
UnknownStep = 3
AnalyzeStep = 1,
FilteringStep = 2,
EncodingStep = 3,
UnknownStep = 4
};
void processFile();
@ -83,6 +85,7 @@ private:
const bool m_prependRelativeSourcePath;
QList<AbstractFilter*> m_filters;
QString m_renamePattern;
WaveProperties *m_propDetect;
static QMutex *m_mutex_genFileName;
};

144
src/Tool_WaveProperties.cpp Normal file
View File

@ -0,0 +1,144 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// http://www.gnu.org/licenses/gpl-2.0.txt
///////////////////////////////////////////////////////////////////////////////
#include "Tool_WaveProperties.h"
#include "Global.h"
#include "Model_AudioFile.h"
#include <QProcess>
WaveProperties::WaveProperties(void)
:
m_binary(lamexp_lookup_tool("sox.exe"))
{
if(m_binary.isEmpty())
{
throw "Error initializing MP3 encoder. Tool 'lame.exe' is not registred!";
}
}
WaveProperties::~WaveProperties(void)
{
}
bool WaveProperties::detect(const QString &sourceFile, AudioFileModel *info, volatile bool *abortFlag)
{
QProcess process;
QStringList args;
args << "--i" << sourceFile;
if(!startProcess(process, m_binary, args))
{
return false;
}
bool bTimeout = false;
bool bAborted = false;
int progress = 0;
QRegExp regExp_precision("Precision\\s*:\\s*(\\d+)-bit", Qt::CaseInsensitive);
QRegExp regExp_samplerate("Sample Rate\\s*:\\s*(\\d+)", Qt::CaseInsensitive);
QRegExp regExp_duration("Duration\\s*:\\s*(\\d\\d):(\\d\\d):(\\d\\d)\\.(\\d\\d)", Qt::CaseInsensitive);
QRegExp regExp_channels("Channels\\s*:\\s*(\\d+)", Qt::CaseInsensitive);
while(process.state() != QProcess::NotRunning)
{
if(*abortFlag)
{
process.kill();
bAborted = true;
emit messageLogged("\nABORTED BY USER !!!");
break;
}
process.waitForReadyRead(m_processTimeoutInterval);
if(!process.bytesAvailable() && process.state() == QProcess::Running)
{
process.kill();
qWarning("SoX process timed out <-- killing!");
emit messageLogged("\nPROCESS TIMEOUT !!!");
bTimeout = true;
break;
}
while(process.bytesAvailable() > 0)
{
QByteArray line = process.readLine();
QString text = QString::fromUtf8(line.constData()).simplified();
if(regExp_precision.lastIndexIn(text) >= 0)
{
bool ok = false;
unsigned int tmp = regExp_precision.cap(1).toUInt(&ok);
if(ok) info->setFormatAudioBitdepth(tmp);
emit statusUpdated(qMin(progress += 25, 100));
}
if(regExp_samplerate.lastIndexIn(text) >= 0)
{
bool ok = false;
unsigned int tmp = regExp_samplerate.cap(1).toUInt(&ok);
if(ok) info->setFormatAudioSamplerate(tmp);
emit statusUpdated(qMin(progress += 25, 100));
}
if(regExp_duration.lastIndexIn(text) >= 0)
{
bool ok[4] = {false, false, false, false};
unsigned int tmp1 = regExp_duration.cap(1).toUInt(&ok[0]);
unsigned int tmp2 = regExp_duration.cap(2).toUInt(&ok[1]);
unsigned int tmp3 = regExp_duration.cap(3).toUInt(&ok[2]);
unsigned int tmp4 = regExp_duration.cap(4).toUInt(&ok[3]);
if(ok[0] && ok[1] && ok[2] && ok[3])
{
info->setFileDuration((tmp1 * 3600) + (tmp2 * 60) + tmp3 + qRound(static_cast<double>(tmp4) / 100.0));
}
emit statusUpdated(qMin(progress += 25, 100));
}
if(regExp_channels.lastIndexIn(text) >= 0)
{
bool ok = false;
unsigned int tmp = regExp_channels.cap(1).toUInt(&ok);
if(ok) info->setFormatAudioChannels(tmp);
emit statusUpdated(qMin(progress += 25, 100));
}
if(!text.isEmpty())
{
emit messageLogged(text);
}
}
}
process.waitForFinished();
if(process.state() != QProcess::NotRunning)
{
process.kill();
process.waitForFinished(-1);
}
emit statusUpdated(100);
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
{
return false;
}
return true;
}

39
src/Tool_WaveProperties.h Normal file
View File

@ -0,0 +1,39 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// http://www.gnu.org/licenses/gpl-2.0.txt
///////////////////////////////////////////////////////////////////////////////
#pragma once
#include "Tool_Abstract.h"
class AudioFileModel;
class WaveProperties : public AbstractTool
{
Q_OBJECT
public:
WaveProperties(void);
~WaveProperties(void);
bool detect(const QString &sourceFile, AudioFileModel *info, volatile bool *abortFlag);
private:
const QString m_binary;
};