OSDN Git Service

Update file properties after the decoding step by using SoX in "--i" mode. Required...
authorlordmulder <mulder2@gmx.de>
Wed, 21 Dec 2011 23:06:34 +0000 (00:06 +0100)
committerlordmulder <mulder2@gmx.de>
Wed, 21 Dec 2011 23:06:34 +0000 (00:06 +0100)
48 files changed:
LameXP_VS2010.vcxproj
LameXP_VS2010.vcxproj.filters
etc/Translation/Blank.ts
etc/Translation/LameXP_DE.ts
etc/Translation/LameXP_ES.ts
etc/Translation/LameXP_FR.ts
etc/Translation/LameXP_IT.ts
etc/Translation/LameXP_KR.ts
etc/Translation/LameXP_PL.ts
etc/Translation/LameXP_RU.ts
etc/Translation/LameXP_TW.ts
etc/Translation/LameXP_UK.ts
etc/Translation/LameXP_ZH.ts
res/localization/LameXP_TW.qm
res/localization/LameXP_ZH.qm
src/Config.h
src/Decoder_AAC.cpp
src/Decoder_AC3.cpp
src/Decoder_ADPCM.cpp
src/Decoder_ALAC.cpp
src/Decoder_Avisynth.cpp
src/Decoder_FLAC.cpp
src/Decoder_MAC.cpp
src/Decoder_MP3.cpp
src/Decoder_Musepack.cpp
src/Decoder_Shorten.cpp
src/Decoder_Speex.cpp
src/Decoder_TTA.cpp
src/Decoder_Vorbis.cpp
src/Decoder_WMA.cpp
src/Decoder_WavPack.cpp
src/Encoder_AAC.cpp
src/Encoder_AAC.h
src/Encoder_AAC_FHG.cpp
src/Encoder_AAC_QAAC.cpp
src/Encoder_AC3.cpp
src/Encoder_FLAC.cpp
src/Encoder_MP3.cpp
src/Encoder_Vorbis.cpp
src/Filter_Downmix.cpp
src/Filter_Normalize.cpp
src/Filter_Resample.cpp
src/Filter_ToneAdjust.cpp
src/Thread_CueSplitter.cpp
src/Thread_Process.cpp
src/Thread_Process.h
src/Tool_WaveProperties.cpp [new file with mode: 0644]
src/Tool_WaveProperties.h [new file with mode: 0644]

index ba63268..dc19d48 100644 (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" />
index 5d0e2e7..b9af950 100644 (file)
     <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">
     <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" />
index c344187..3c16d2e 100644 (file)
 <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>
index f01321c..290fe7b 100644 (file)
         <source>Unknown Comment</source>
         <translation>Unbekannter Kommentar</translation>
     </message>
+    <message>
+        <source>Analyzing</source>
+        <translation>Prüfe</translation>
+    </message>
 </context>
 <context>
     <name>ProcessingDialog</name>
index 9611464..6584986 100644 (file)
         <source>Unknown Comment</source>
         <translation>Comentario desconocido</translation>
     </message>
+    <message>
+        <source>Analyzing</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>ProcessingDialog</name>
index b9d631b..5ed87c5 100644 (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>
index 51005aa..5405563 100644 (file)
         <source>Unknown Comment</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Analyzing</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>ProcessingDialog</name>
index 6475cff..8c43d15 100644 (file)
         <source>Unknown Comment</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Analyzing</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>ProcessingDialog</name>
index 6b40f2c..68535b5 100644 (file)
 <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>
index 2385fea..393faf4 100644 (file)
         <source>Unknown Comment</source>
         <translation type="unfinished">Неизвестный Комментарий</translation>
     </message>
+    <message>
+        <source>Analyzing</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>ProcessingDialog</name>
index dfdb75d..90f89e3 100644 (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>
         <source>Unknown Comment</source>
         <translation>未知評論</translation>
     </message>
+    <message>
+        <source>Analyzing</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>ProcessingDialog</name>
index 910e78b..047ab66 100644 (file)
     </message>
     <message>
         <source>Skipping update check this time, please be patient...</source>
-        <translation>Наразі йде переривання перевірки оновлень, будь ласка, зачекайте...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
         <source>Unknown Comment</source>
         <translation>Невідомий коментар</translation>
     </message>
+    <message>
+        <source>Analyzing</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>ProcessingDialog</name>
     </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>
index 4069c84..f267ec9 100644 (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>
         <source>Unknown Comment</source>
         <translation>未知评论</translation>
     </message>
+    <message>
+        <source>Analyzing</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>ProcessingDialog</name>
index ed4e557..191a92f 100644 (file)
Binary files a/res/localization/LameXP_TW.qm and b/res/localization/LameXP_TW.qm differ
index d1fda6e..509e540 100644 (file)
Binary files a/res/localization/LameXP_ZH.qm and b/res/localization/LameXP_ZH.qm differ
index 6cb62bc..edcd556 100644 (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!)
index c6915e1..b5cf67f 100644 (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;
        }
index a46d720..b8cd254 100644 (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;
        }
index f0689ee..648eba0 100644 (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;
        }
index f4af090..01be35b 100644 (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;
        }
index 98f71c4..e499970 100644 (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;
        }
index 09dbd9e..252aef2 100644 (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;
        }
index 5bbcd1e..9e855da 100644 (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;
        }
index 0c16f75..d460e2f 100644 (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;
        }
index 5174dab..9989447 100644 (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;
        }
index 682b67f..f003f1d 100644 (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;
        }
index 299333a..bd57ef8 100644 (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;
        }
index 4b104de..41b9c2d 100644 (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;
        }
index abe0bae..fe35198 100644 (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;
        }
index 58b29eb..7522e5d 100644 (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;
        }
index e6497b5..a8b9dcc 100644 (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;
        }
index 3c44f0b..36f609f 100644 (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";
index 5bf3cb0..176c7cf 100644 (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);
 };
index 1f1b7e1..a865a1b 100644 (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;
        }
index 9a69b66..8c1b0ff 100644 (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;
        }
index ed9cb60..3126a58 100644 (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;
        }
index 0f46c38..2cb5cf0 100644 (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;
        }
index 687ed7f..c9cb072 100644 (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;
        }
index a2cb397..302df0a 100644 (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;
        }
index 0784cee..4cf61a0 100644 (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;
        }
index 9b1b547..b6baf61 100644 (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;
        }
index 6d32742..a36e42e 100644 (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;
        }
index 0f2f6a1..2408043 100644 (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;
        }
index cd3b30e..536b172 100644 (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++;
index 864a298..e745911 100644 (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())
-               {
-                       insertDownsampleFilter();
-               }
 
-               //Do we need to change the bits per sample of the input?
-               if(m_encoder->supportedBitdepths())
+               //Update audio properties after decode
+               if(bSuccess)
                {
-                       insertBitdepthFilter();
-               }
-
-               //Do we need Stereo downmix?
-               if(m_encoder->requiresDownmix())
-               {
-                       insertDownmixFilter();
+                       if(m_encoder->supportedSamplerates() || m_encoder->supportedBitdepths() || m_encoder->requiresDownmix())
+                       {
+                               m_currentStep = AnalyzeStep;
+                               bSuccess = m_propDetect->detect(sourceFile, &m_audioFile, &m_aborted);
+
+                               if(bSuccess)
+                               {
+                                       handleMessage("\n-------------------------------\n");
+
+                                       //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;
index d34787c..2af7dd9 100644 (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;
 };
diff --git a/src/Tool_WaveProperties.cpp b/src/Tool_WaveProperties.cpp
new file mode 100644 (file)
index 0000000..292c084
--- /dev/null
@@ -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;
+}
diff --git a/src/Tool_WaveProperties.h b/src/Tool_WaveProperties.h
new file mode 100644 (file)
index 0000000..bf88327
--- /dev/null
@@ -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;
+};