From cde1950ddefd105d40933c87ea8288261946719f Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sat, 12 Nov 2016 16:49:29 +0100 Subject: [PATCH] Fixed a bug that would cause the encoding job to fail, when an audio filter is *skipped*. If a filter is skipped, it did *not* write an output file. However, before this fix, the ProcessThread would try to continue with the (empty) output file, resulting in the subsequent encoder invocation to fail. --- doc/Changelog.html | 1 + doc/Changelog.md | 1 + etc/Translation/Blank.ts | 40 ++++++++++++++++++------------------ etc/Translation/LameXP_DE.ts | 40 ++++++++++++++++++------------------ etc/Translation/LameXP_ES.ts | 40 ++++++++++++++++++------------------ etc/Translation/LameXP_FR.ts | 40 ++++++++++++++++++------------------ etc/Translation/LameXP_HU.ts | 40 ++++++++++++++++++------------------ etc/Translation/LameXP_IT.ts | 40 ++++++++++++++++++------------------ etc/Translation/LameXP_KR.ts | 40 ++++++++++++++++++------------------ etc/Translation/LameXP_PL.ts | 40 ++++++++++++++++++------------------ etc/Translation/LameXP_RU.ts | 40 ++++++++++++++++++------------------ etc/Translation/LameXP_SV.ts | 40 ++++++++++++++++++------------------ etc/Translation/LameXP_TW.ts | 40 ++++++++++++++++++------------------ etc/Translation/LameXP_UK.ts | 40 ++++++++++++++++++------------------ etc/Translation/LameXP_ZH.ts | 40 ++++++++++++++++++------------------ src/Config.h | 2 +- src/Filter_Abstract.h | 10 ++++++++- src/Filter_Downmix.cpp | 10 ++++----- src/Filter_Downmix.h | 2 +- src/Filter_Normalize.cpp | 8 ++++---- src/Filter_Normalize.h | 2 +- src/Filter_Resample.cpp | 16 ++++++++------- src/Filter_Resample.h | 2 +- src/Filter_ToneAdjust.cpp | 8 ++++---- src/Filter_ToneAdjust.h | 2 +- src/Thread_Process.cpp | 35 ++++++++++++++++--------------- 26 files changed, 317 insertions(+), 302 deletions(-) diff --git a/doc/Changelog.html b/doc/Changelog.html index dbc0316c..79c2ff52 100644 --- a/doc/Changelog.html +++ b/doc/Changelog.html @@ -88,6 +88,7 @@
  • Fixed the location of temporary intermediate files for SoX-based audio effects
  • Fixed embedding of meta tags with OggEnc2 when reading directly from OGG/FLAC input file
  • Fixed encoding of non-Stereo sources with NeroAAC, when "HE-AAC v2 (SBR+PS)" is selected
  • +
  • Fixed a bug that would cause the encoding job to fail, when an audio filter is skipped
  • Enabled the "built-in" resampler for QAAC encoder
  • The "Algorithm Quality" slider now also affects the QAAC encoder
  • Added "AVX" (Advanced Vector Extensions) to CPU feature detection code
  • diff --git a/doc/Changelog.md b/doc/Changelog.md index f79c58df..531acd04 100644 --- a/doc/Changelog.md +++ b/doc/Changelog.md @@ -8,6 +8,7 @@ * Fixed the location of temporary intermediate files for SoX-based audio effects * Fixed embedding of meta tags with OggEnc2 when reading directly from OGG/FLAC input file * Fixed encoding of *non*-Stereo sources with NeroAAC, when "HE-AAC *v2* (SBR+PS)" is selected +* Fixed a bug that would cause the encoding job to fail, when an audio filter is *skipped* * Enabled the "built-in" resampler for QAAC encoder * The "Algorithm Quality" slider now also affects the QAAC encoder * Added "AVX" (Advanced Vector Extensions) to CPU feature detection code diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index 72e5515f..11c7f03e 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -3017,102 +3017,102 @@ - + Aborted! - + Done. - + Failed! - + Encoding - + Analyzing - + Filtering - + Decoding - + The source audio file could not be found: - + The source audio file could not be opened for reading: - + The target output directory doesn't exist and could NOT be created: - + The target output directory is NOT writable: - + Unknown File Name - + Unknown Title - + Unknown Artist - + Unknown Album - + Unknown Comment - + Target output file already exists, going to skip this file: - + If you don't want existing files to be skipped, please change the overwrite mode! - + Target output file already exists, going to delete existing file: - + Failed to delete existing target file, will save to another file name! diff --git a/etc/Translation/LameXP_DE.ts b/etc/Translation/LameXP_DE.ts index ab78c4aa..f7f827d4 100644 --- a/etc/Translation/LameXP_DE.ts +++ b/etc/Translation/LameXP_DE.ts @@ -3015,82 +3015,82 @@ Nicht unterstützt! - + Done. Fertig. - + Aborted! Abgebrochen! - + Failed! Fehler! - + Encoding Kodiere - + Filtering Filtere - + Decoding Dekodiere - + The source audio file could not be found: Die Quell-Audiodatei konnte nicht gefunden werden: - + The source audio file could not be opened for reading: Die Quell-Audiodatei konnte nicht zum Lesen geöffnet werden: - + The target output directory doesn't exist and could NOT be created: Das Zielverzeichnis existiert nicht und konnte nicht erstellt werden: - + The target output directory is NOT writable: In das Zielverzeichnis kann nicht geschrieben werden: - + Unknown File Name Unbekannter Dateiname - + Unknown Title Unbekannter Titel - + Unknown Artist Unbekannter Künstler - + Unknown Album Unbekanntes Album - + Unknown Comment Unbekannter Kommentar - + Analyzing Prüfe @@ -3106,22 +3106,22 @@ Übersprungen. - + Target output file already exists, going to skip this file: Zieldatei existiert bereits, die Datei wird übersprungen: - + If you don't want existing files to be skipped, please change the overwrite mode! Wenn existierende Dateien nicht übersprungen werden sollen, ändern Sie bitte den Überschreiben-Modus! - + Target output file already exists, going to delete existing file: Zieldatei existiert bereits, die Datei wird gelöscht und überschrieben: - + Failed to delete existing target file, will save to another file name! Die existierende Datei konnte nicht gelöscht werden, ein anderer Dateiname wird gewählt! diff --git a/etc/Translation/LameXP_ES.ts b/etc/Translation/LameXP_ES.ts index 02a6ab52..9e3ca9b3 100644 --- a/etc/Translation/LameXP_ES.ts +++ b/etc/Translation/LameXP_ES.ts @@ -3015,82 +3015,82 @@ ¡No soportado! - + Done. Finalizado. - + Aborted! ¡Abortado! - + Failed! ¡Error! - + Encoding Codificando - + Filtering Filtrando - + Decoding Decodificando - + The source audio file could not be found: No se encuentra el archivo de entrada: - + The source audio file could not be opened for reading: No se puede abrir el archivo de entrada para su lectura: - + The target output directory doesn't exist and could NOT be created: La carpeta de salida no existe y NO puede ser creada: - + The target output directory is NOT writable: NO se puede escribir en la carpeta de salida: - + Unknown File Name Nombre de archivo desconocido - + Unknown Title Título desconocido - + Unknown Artist Artista desconocido - + Unknown Album Álbum desconocido - + Unknown Comment Comentario desconocido - + Analyzing Analizando @@ -3106,22 +3106,22 @@ Omitidos. - + Target output file already exists, going to skip this file: El archivo de destino ya existe, se omitirá este archivo: - + If you don't want existing files to be skipped, please change the overwrite mode! ¡Si no quiere sobreescribir los archivos existentes, cambie el modo sobreescritura por favor! - + Target output file already exists, going to delete existing file: El archivo de destino ya existe, se eliminará este archivo: - + Failed to delete existing target file, will save to another file name! ¡Error al eliminar el archivo de destino existente, se guardará con otro nombre! diff --git a/etc/Translation/LameXP_FR.ts b/etc/Translation/LameXP_FR.ts index 098bfa3f..257df680 100644 --- a/etc/Translation/LameXP_FR.ts +++ b/etc/Translation/LameXP_FR.ts @@ -3022,82 +3022,82 @@ Sélection automatique (par défaut) Non supporté! - + Done. Terminé. - + Aborted! Arrêté! - + Failed! Échec! - + Encoding Encodage - + Filtering Filtrage - + Decoding Décodage - + The source audio file could not be found: Le fichier audio source n'a pas pu être trouvé: - + The source audio file could not be opened for reading: Le fichier audio source n'a pas pu être ouvert pour la lecture: - + The target output directory doesn't exist and could NOT be created: Le répertoire de sortie cible n'existe pas et ne peut PAS être créé: - + The target output directory is NOT writable: Le répertoire de sortie cible n'est pas accessible en écriture: - + Unknown File Name Nom de fichier inconnu - + Unknown Title Titre inconnu - + Unknown Artist Artiste inconnu - + Unknown Album Album inconnu - + Unknown Comment Commentaire inconnu - + Analyzing Analyse @@ -3114,22 +3114,22 @@ Sélection automatique (par défaut) Ignoré. - + Target output file already exists, going to skip this file: Le fichier de sortie existe déjà, il sera ignoré : - + If you don't want existing files to be skipped, please change the overwrite mode! Si vous ne voulez pas ignorer les fichiers existants, veuillez changer le mode de remplacement ! - + Target output file already exists, going to delete existing file: Le fichier de sortie existe déjà, il sera supprimé : - + Failed to delete existing target file, will save to another file name! Impossible de supprimer le fichier cible existant, il sera enregistré sous un autre nom ! diff --git a/etc/Translation/LameXP_HU.ts b/etc/Translation/LameXP_HU.ts index 2f355476..3cc6a22f 100644 --- a/etc/Translation/LameXP_HU.ts +++ b/etc/Translation/LameXP_HU.ts @@ -3017,102 +3017,102 @@ Nem támogatott! - + Aborted! Megszakítva! - + Done. Kész. - + Failed! Sikertelen! - + Encoding Kódolás - + Analyzing Elemzés - + Filtering Szűrés - + Decoding Dekódolás - + The source audio file could not be found: A forrás hangfájl nem található: - + The source audio file could not be opened for reading: A forrás hangfájl nem nyitható meg olvasásra: - + The target output directory doesn't exist and could NOT be created: A cél kimeneti könyvtár nem létezik, és NEM hozható létre: - + The target output directory is NOT writable: A cél kimeneti könyvtár NEM írható: - + Unknown File Name Ismeretlen fájlnév - + Unknown Title Ismeretlen cím - + Unknown Artist Ismeretlen előadó - + Unknown Album Ismeretlen album - + Unknown Comment Ismeretlen hozzászólás - + Target output file already exists, going to skip this file: A cél kimeneti fájl már létezik, ez a fájl ki lesz hagyva: - + If you don't want existing files to be skipped, please change the overwrite mode! Ha nem szeretné a meglévő fájlokat kihagyni, kérjük, változtassa meg a felülírási módot! - + Target output file already exists, going to delete existing file: A cél kimeneti fájl már létezik, a meglévő fájl törlésre kerül: - + Failed to delete existing target file, will save to another file name! Nem sikerült törölni a meglévő cél fájlt. Az állomány másik fájlnéven lesz elmentve! diff --git a/etc/Translation/LameXP_IT.ts b/etc/Translation/LameXP_IT.ts index c04a868f..198527a3 100644 --- a/etc/Translation/LameXP_IT.ts +++ b/etc/Translation/LameXP_IT.ts @@ -3082,83 +3082,83 @@ Non Supportato! - + Done. Fatto. - + Aborted! Processo Annullato! - + Failed! Fallito! - + Encoding Codifica in corso - + Filtering Filtraggio in corso - + Decoding Decodifica in corso - + The source audio file could not be found: Il file audio sorgente non può essere trovato: - + The source audio file could not be opened for reading: Il file audio sorgente non può essere aperto per la lettura: - + The target output directory doesn't exist and could NOT be created: La cartella di destinazione assegnata non esiste e NON può essere creata: - + The target output directory is NOT writable: La directory di destinazione assegnata è di SOLA LETTURA: La directory di destinazione assegnata NON è scrivibile: - + Unknown File Name Nome File Sconosciuto - + Unknown Title Titolo Sconosciuto - + Unknown Artist Artista Sconosciuto - + Unknown Album Album Sconosciuto - + Unknown Comment Commento Sconosciuto - + Analyzing Analisi in corso @@ -3174,22 +3174,22 @@ Saltato. - + Target output file already exists, going to skip this file: Il file di destinazione esiste già, questo file verrà saltato: - + If you don't want existing files to be skipped, please change the overwrite mode! Se non vuoi saltare i file esistenti, cambia la modalità di sovrascrittura! - + Target output file already exists, going to delete existing file: Il file di destinazione esiste già, il file esistente verrà eliminato: - + Failed to delete existing target file, will save to another file name! Impossibile eliminare il file di destinazione esistente, il file verrà salvato con un altro nome! diff --git a/etc/Translation/LameXP_KR.ts b/etc/Translation/LameXP_KR.ts index 4d85cbbb..4e2a34b7 100644 --- a/etc/Translation/LameXP_KR.ts +++ b/etc/Translation/LameXP_KR.ts @@ -3006,82 +3006,82 @@ 지원하지 않습니다! - + Done. 완료. - + Aborted! 취소됨! - + Failed! 실패됨! - + Encoding 인코딩 - + Filtering 필터링 - + Decoding 디코딩 - + The source audio file could not be found: 원본 오디오 파일을 찾을 수 없음: - + The source audio file could not be opened for reading: 원본 오디오 파일을 열 수 없음: - + The target output directory doesn't exist and could NOT be created: 대상 출력 디렉터리가 존재하지 않으며, 만들 수 없습니다: - + The target output directory is NOT writable: 대상 출력 디렉터리에 쓰기 불가: - + Unknown File Name 알수 없는 파일명 - + Unknown Title 알수 없는 제목 - + Unknown Artist 알수 없는 가수 - + Unknown Album 알수 없는 앨범 - + Unknown Comment 알수 없는 설명 - + Analyzing 검토 중 @@ -3097,22 +3097,22 @@ 건너뜀. - + Target output file already exists, going to skip this file: 대상 출력 파일이 이미 존재합니다. 건너뛰기할 파일: - + If you don't want existing files to be skipped, please change the overwrite mode! 기존 파일을 건너뛰기하지 않으려면, 덮어쓰기 방식을 변경하시기 바랍니다! - + Target output file already exists, going to delete existing file: 대상 출력 파일이 이미 존재합니다. 건너뛰기할 파일: - + Failed to delete existing target file, will save to another file name! 기존 대상 파일 삭제 실패. 다른 파일명으로 저장됩니다! diff --git a/etc/Translation/LameXP_PL.ts b/etc/Translation/LameXP_PL.ts index db6a5cb3..7f791b58 100644 --- a/etc/Translation/LameXP_PL.ts +++ b/etc/Translation/LameXP_PL.ts @@ -3034,102 +3034,102 @@ Nieobsługiwany! - + Done. Zrobione. - + Aborted! Przerwano! - + Failed! Niepowodzenie! - + Encoding Kompresowanie - + Analyzing Analizowanie - + Filtering Filtrowanie - + Decoding Dekodowanie - + The source audio file could not be found: Źródłowy plik dźwiękowy nie został odnaleziony: - + The source audio file could not be opened for reading: Źródłowy plik dźwiękowy nie mógł zostać otworzony: - + The target output directory doesn't exist and could NOT be created: Lokalizacja docelowa nie istnieje lu NIE mogła zostać utworzona: - + The target output directory is NOT writable: Nie można zapisać do lokalizacji docelowej: - + Unknown File Name Nieznana nazwa pliku - + Unknown Title Nieznany Tytuł - + Unknown Artist Nieznany Artysta - + Unknown Album Nieznany Album - + Unknown Comment Nieznany Komentarz - + Target output file already exists, going to skip this file: Plik wynikowy już istnieje, zostanie pominięty plik: - + If you don't want existing files to be skipped, please change the overwrite mode! Jeśli nie chcesz aby istniejące pliki były pomijane, zmień tryb nadpisywania! - + Target output file already exists, going to delete existing file: Plik wynikowy już istnieje, zostanie usunięty plik: - + Failed to delete existing target file, will save to another file name! Usuwanie istniejącego pliku zakończone niepowodzeniem, nowy plik zostanie zapisany pod inną nazwą! diff --git a/etc/Translation/LameXP_RU.ts b/etc/Translation/LameXP_RU.ts index 8cce8461..6c944b04 100644 --- a/etc/Translation/LameXP_RU.ts +++ b/etc/Translation/LameXP_RU.ts @@ -3030,82 +3030,82 @@ Неподдерживается! - + Done. Готово. - + Aborted! Прервано! - + Failed! Ошибка! - + Encoding Кодирование - + Filtering Фильтрация - + Decoding Декодирование - + The source audio file could not be found: Исходный аудио файл не найден: - + The source audio file could not be opened for reading: Исходный аудио файл не может быть открыт: - + The target output directory doesn't exist and could NOT be created: Папка для выходных файлов не существует и не может быть создана: - + The target output directory is NOT writable: Папка для выходных файлов недоступна для записи: - + Unknown File Name Неизвестное имя файла - + Unknown Title Неизвестное Название - + Unknown Artist Неизвестный Артист - + Unknown Album Неизвестный Альбом - + Unknown Comment Неизвестный Комментарий - + Analyzing Анализ @@ -3121,22 +3121,22 @@ Пропущен. - + Target output file already exists, going to skip this file: Файл уже существует, будет пропущен: - + If you don't want existing files to be skipped, please change the overwrite mode! Если Вы не хотите пропускать уже существующие файлы, пожалуйста, измените режим перезаписи! - + Target output file already exists, going to delete existing file: Файл уже существует, будет удалён: - + Failed to delete existing target file, will save to another file name! Ошибка удаления существующего файла, будет сохранение с другим именем! diff --git a/etc/Translation/LameXP_SV.ts b/etc/Translation/LameXP_SV.ts index fffd09ea..e93de450 100644 --- a/etc/Translation/LameXP_SV.ts +++ b/etc/Translation/LameXP_SV.ts @@ -3027,102 +3027,102 @@ Stöd saknas! - + Aborted! Avbruten! - + Done. Klar. - + Failed! Misslyckades! - + Encoding Kodar - + Analyzing Analyserar - + Filtering Filtrerar - + Decoding Avkodar - + The source audio file could not be found: Källfilen kan inte hittas: - + The source audio file could not be opened for reading: Källfilen kan inte öppnas för läsning: - + The target output directory doesn't exist and could NOT be created: Målmappen finns inte och kan inte skapas: - + The target output directory is NOT writable: Målmappen är INTE skrivbar: - + Unknown File Name Okänt filnamn - + Unknown Title Okänd titel - + Unknown Artist Okänd artist - + Unknown Album Okänt album - + Unknown Comment Okänd kommentar - + Target output file already exists, going to skip this file: Målfilen finns redan! Den här filen hoppas över: - + If you don't want existing files to be skipped, please change the overwrite mode! Om du inte vill att befintliga filer hoppas över, måste du ändra överskrivningsläge! - + Target output file already exists, going to delete existing file: Målfilen finns redan! Befintlig fil kommer att tas bort: - + Failed to delete existing target file, will save to another file name! Kunde inte ta bort befintlig målfil. Sparar med annat filnamn! diff --git a/etc/Translation/LameXP_TW.ts b/etc/Translation/LameXP_TW.ts index 873e5ca4..2978b50c 100644 --- a/etc/Translation/LameXP_TW.ts +++ b/etc/Translation/LameXP_TW.ts @@ -3006,82 +3006,82 @@ 不受支持! - + Done. 完成. - + Aborted! 中止! - + Failed! 失敗! - + Encoding 編碼 - + Filtering 過濾 - + Decoding 解碼 - + The source audio file could not be found: 找不到源音頻文件: - + The source audio file could not be opened for reading: 無法打開源音頻文件進行讀取: - + The target output directory doesn't exist and could NOT be created: 目標輸出目錄不存在,無法創建: - + The target output directory is NOT writable: 目標輸出目錄不是可寫: - + Unknown File Name 未知文件名稱 - + Unknown Title 未知標題 - + Unknown Artist 未知藝術家 - + Unknown Album 未知專輯 - + Unknown Comment 未知評論 - + Analyzing 分析 @@ -3097,22 +3097,22 @@ 跳過. - + Target output file already exists, going to skip this file: 目標輸出文件已經存在, 將跳過此文件: - + If you don't want existing files to be skipped, please change the overwrite mode! 如果你不希望被跳過已存在的文件, 請更改覆蓋模式! - + Target output file already exists, going to delete existing file: 目標輸出文件已經存在, 要刪除現有的文件: - + Failed to delete existing target file, will save to another file name! 無法刪除現有目標文件, 將保存到另一個文件名! diff --git a/etc/Translation/LameXP_UK.ts b/etc/Translation/LameXP_UK.ts index 988857c3..462aa3ae 100644 --- a/etc/Translation/LameXP_UK.ts +++ b/etc/Translation/LameXP_UK.ts @@ -3023,82 +3023,82 @@ Не підтримується! - + Done. Виконано. - + Aborted! Перервано! - + Failed! Збій! - + Encoding Кодування - + Filtering Фільтрування - + Decoding Декодування - + The source audio file could not be found: Неможливо знайти вхідний файл аудіо: - + The source audio file could not be opened for reading: Неможливо відкрити для читання вхідний файл аудіо: - + The target output directory doesn't exist and could NOT be created: Вихідної теки не існує і її неможливо створити: - + The target output directory is NOT writable: До вихідної теки неможливо проводити запис: - + Unknown File Name Невідома назва файла - + Unknown Title Невідомий заголовок - + Unknown Artist Невідомий виконавець - + Unknown Album Невідомий альбом - + Unknown Comment Невідомий коментар - + Analyzing Аналізування @@ -3114,22 +3114,22 @@ Пропущено. - + Target output file already exists, going to skip this file: Вихідний цільовий файл вже існує, спроба пропустити цей файл: - + If you don't want existing files to be skipped, please change the overwrite mode! Якщо ви не хочете, щоб існуючі файли були пропущені, будь ласка, змініть режим перезапису! - + Target output file already exists, going to delete existing file: Вихідний цільовий файл вже існує, спроба видалити існуючий файл: - + Failed to delete existing target file, will save to another file name! Неможливо видалити існуючий файл, збереження буде проведено до файла з іншою назвою! diff --git a/etc/Translation/LameXP_ZH.ts b/etc/Translation/LameXP_ZH.ts index 944bf17a..d295bff5 100644 --- a/etc/Translation/LameXP_ZH.ts +++ b/etc/Translation/LameXP_ZH.ts @@ -3006,82 +3006,82 @@ 不支持! - + Done. 完成。 - + Aborted! 中止! - + Failed! 失败! - + Encoding 编码 - + Filtering 过滤 - + Decoding 解码 - + The source audio file could not be found: 找不到源音频文件: - + The source audio file could not be opened for reading: 无法打开源音频文件进行读取: - + The target output directory doesn't exist and could NOT be created: 目标输出目录不存在且无法创建: - + The target output directory is NOT writable: 目标输出目录不可写: - + Unknown File Name 未知文件名称 - + Unknown Title 未知标题 - + Unknown Artist 未知艺术家 - + Unknown Album 未知专辑 - + Unknown Comment 未知注释 - + Analyzing 分析 @@ -3097,22 +3097,22 @@ 跳过。 - + Target output file already exists, going to skip this file: 目标输出文件已经存在, 将跳过此文件: - + If you don't want existing files to be skipped, please change the overwrite mode! 如果你不希望跳过已存在的文件, 请更改覆盖模式! - + Target output file already exists, going to delete existing file: 目标输出文件已经存在, 将删除现有的文件: - + Failed to delete existing target file, will save to another file name! 无法删除现有目标文件, 将保存为另一个文件名! diff --git a/src/Config.h b/src/Config.h index 9c94b4f1..7536fffd 100644 --- a/src/Config.h +++ b/src/Config.h @@ -35,7 +35,7 @@ #define VER_LAMEXP_MINOR_LO 4 #define VER_LAMEXP_TYPE RC #define VER_LAMEXP_PATCH 6 -#define VER_LAMEXP_BUILD 1928 +#define VER_LAMEXP_BUILD 1930 #define VER_LAMEXP_CONFG 1818 /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Filter_Abstract.h b/src/Filter_Abstract.h index 8872bef9..72c8fd57 100644 --- a/src/Filter_Abstract.h +++ b/src/Filter_Abstract.h @@ -34,7 +34,15 @@ public: AbstractFilter(void); ~AbstractFilter(void); + //Result + enum FilterResult + { + FILTER_SUCCESS = 0, + FILTER_SKIPPED = 1, + FILTER_FAILURE = 2 + }; + //Internal decoder API - virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag) = 0; + virtual FilterResult apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag) = 0; }; diff --git a/src/Filter_Downmix.cpp b/src/Filter_Downmix.cpp index 6488e0d3..e0b04dd6 100644 --- a/src/Filter_Downmix.cpp +++ b/src/Filter_Downmix.cpp @@ -49,7 +49,7 @@ DownmixFilter::~DownmixFilter(void) { } -bool DownmixFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag) +AbstractFilter::FilterResult DownmixFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag) { unsigned int channels = formatInfo->audioChannels(); //detectChannels(sourceFile, abortFlag); emit messageLogged(QString().sprintf("--> Number of channels is: %d\n", channels)); @@ -58,7 +58,7 @@ bool DownmixFilter::apply(const QString &sourceFile, const QString &outputFile, { messageLogged("Skipping downmix!"); qDebug("Dowmmix not required/possible for Mono or Stereo input, skipping!"); - return true; + return AbstractFilter::FILTER_SKIPPED; } QProcess process; @@ -100,7 +100,7 @@ bool DownmixFilter::apply(const QString &sourceFile, const QString &outputFile, if(!startProcess(process, m_binary, args, QFileInfo(outputFile).canonicalPath())) { - return false; + return AbstractFilter::FILTER_FAILURE; } bool bTimeout = false; @@ -155,9 +155,9 @@ bool DownmixFilter::apply(const QString &sourceFile, const QString &outputFile, if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0) { - return false; + return AbstractFilter::FILTER_FAILURE; } formatInfo->setAudioChannels(2); - return true; + return AbstractFilter::FILTER_SUCCESS; } diff --git a/src/Filter_Downmix.h b/src/Filter_Downmix.h index 6f269d79..6ba7d764 100644 --- a/src/Filter_Downmix.h +++ b/src/Filter_Downmix.h @@ -32,7 +32,7 @@ public: DownmixFilter(void); ~DownmixFilter(void); - virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag); + virtual FilterResult apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag); private: const QString m_binary; diff --git a/src/Filter_Normalize.cpp b/src/Filter_Normalize.cpp index 3c5e5635..2d5c3dc1 100644 --- a/src/Filter_Normalize.cpp +++ b/src/Filter_Normalize.cpp @@ -57,7 +57,7 @@ NormalizeFilter::~NormalizeFilter(void) { } -bool NormalizeFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag) +AbstractFilter::FilterResult NormalizeFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag) { QProcess process; QStringList args; @@ -86,7 +86,7 @@ bool NormalizeFilter::apply(const QString &sourceFile, const QString &outputFile if(!startProcess(process, m_binary, args, QFileInfo(outputFile).canonicalPath())) { - return false; + return AbstractFilter::FILTER_FAILURE; } bool bTimeout = false; @@ -141,8 +141,8 @@ bool NormalizeFilter::apply(const QString &sourceFile, const QString &outputFile if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0) { - return false; + return AbstractFilter::FILTER_FAILURE; } - return true; + return AbstractFilter::FILTER_SUCCESS; } diff --git a/src/Filter_Normalize.h b/src/Filter_Normalize.h index fc7eac42..92067067 100644 --- a/src/Filter_Normalize.h +++ b/src/Filter_Normalize.h @@ -30,7 +30,7 @@ public: NormalizeFilter(const int &peakVolume = -50, const bool &dnyAudNorm = false, const bool &channelsCoupled = true, const int &filterSize = 31); ~NormalizeFilter(void); - virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag); + virtual FilterResult apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag); private: const QString m_binary; diff --git a/src/Filter_Resample.cpp b/src/Filter_Resample.cpp index aae080cb..f317968d 100644 --- a/src/Filter_Resample.cpp +++ b/src/Filter_Resample.cpp @@ -61,7 +61,7 @@ ResampleFilter::~ResampleFilter(void) { } -bool ResampleFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag) +AbstractFilter::FilterResult ResampleFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag) { QProcess process; QStringList args; @@ -70,7 +70,7 @@ bool ResampleFilter::apply(const QString &sourceFile, const QString &outputFile, { messageLogged("Skipping resample filter!"); qDebug("Resampling filter target samplerate/bitdepth is equals to the format of the input file, skipping!"); - return true; + return AbstractFilter::FILTER_SKIPPED; } args << "-V3" << "-S"; @@ -99,7 +99,7 @@ bool ResampleFilter::apply(const QString &sourceFile, const QString &outputFile, if(!startProcess(process, m_binary, args, QFileInfo(outputFile).canonicalPath())) { - return false; + return AbstractFilter::FILTER_FAILURE; } bool bTimeout = false; @@ -154,11 +154,13 @@ bool ResampleFilter::apply(const QString &sourceFile, const QString &outputFile, if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0) { - return false; + return AbstractFilter::FILTER_FAILURE; } - if(m_samplingRate) formatInfo->setAudioSamplerate(m_samplingRate); - if(m_bitDepth) formatInfo->setAudioBitdepth(m_bitDepth); + if(m_samplingRate) + formatInfo->setAudioSamplerate(m_samplingRate); + if(m_bitDepth) + formatInfo->setAudioBitdepth(m_bitDepth); - return true; + return AbstractFilter::FILTER_SUCCESS; } diff --git a/src/Filter_Resample.h b/src/Filter_Resample.h index 7c68ab37..842c9ba1 100644 --- a/src/Filter_Resample.h +++ b/src/Filter_Resample.h @@ -30,7 +30,7 @@ public: ResampleFilter(int samplingRate = 0, int bitDepth = 0); ~ResampleFilter(void); - virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag); + virtual FilterResult apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag); private: const QString m_binary; diff --git a/src/Filter_ToneAdjust.cpp b/src/Filter_ToneAdjust.cpp index 16161f73..3dcdb1a8 100644 --- a/src/Filter_ToneAdjust.cpp +++ b/src/Filter_ToneAdjust.cpp @@ -51,7 +51,7 @@ ToneAdjustFilter::~ToneAdjustFilter(void) { } -bool ToneAdjustFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag) +AbstractFilter::FilterResult ToneAdjustFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag) { QProcess process; QStringList args; @@ -72,7 +72,7 @@ bool ToneAdjustFilter::apply(const QString &sourceFile, const QString &outputFil if(!startProcess(process, m_binary, args, QFileInfo(outputFile).canonicalPath())) { - return false; + return AbstractFilter::FILTER_FAILURE; } bool bTimeout = false; @@ -127,8 +127,8 @@ bool ToneAdjustFilter::apply(const QString &sourceFile, const QString &outputFil if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0) { - return false; + return AbstractFilter::FILTER_FAILURE; } - return true; + return AbstractFilter::FILTER_SUCCESS; } diff --git a/src/Filter_ToneAdjust.h b/src/Filter_ToneAdjust.h index 03d2a300..54ea1d1a 100644 --- a/src/Filter_ToneAdjust.h +++ b/src/Filter_ToneAdjust.h @@ -30,7 +30,7 @@ public: ToneAdjustFilter(int bass = 0, int treble = 0); ~ToneAdjustFilter(void); - virtual bool apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag); + virtual FilterResult apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, volatile bool *abortFlag); private: const QString m_binary; diff --git a/src/Thread_Process.cpp b/src/Thread_Process.cpp index 53664637..f0322e3d 100644 --- a/src/Thread_Process.cpp +++ b/src/Thread_Process.cpp @@ -292,25 +292,28 @@ void ProcessThread::processFile() // Apply all audio filters //----------------------------------------------------- - if(bSuccess) + while(bSuccess && (!m_filters.isEmpty()) && (!m_aborted)) { - while(!m_filters.isEmpty() && !m_aborted) + QString tempFile = generateTempFileName(); + AbstractFilter *poFilter = m_filters.takeFirst(); + m_currentStep = FilteringStep; + + connect(poFilter, SIGNAL(statusUpdated(int)), this, SLOT(handleUpdate(int)), Qt::DirectConnection); + connect(poFilter, SIGNAL(messageLogged(QString)), this, SLOT(handleMessage(QString)), Qt::DirectConnection); + + const AbstractFilter::FilterResult filterResult = poFilter->apply(sourceFile, tempFile, &m_audioFile.techInfo(), &m_aborted); + switch (filterResult) { - QString tempFile = generateTempFileName(); - AbstractFilter *poFilter = m_filters.takeFirst(); - m_currentStep = FilteringStep; - - connect(poFilter, SIGNAL(statusUpdated(int)), this, SLOT(handleUpdate(int)), Qt::DirectConnection); - connect(poFilter, SIGNAL(messageLogged(QString)), this, SLOT(handleMessage(QString)), Qt::DirectConnection); - - if(poFilter->apply(sourceFile, tempFile, &m_audioFile.techInfo(), &m_aborted)) - { - sourceFile = tempFile; - } - - handleMessage("\n-------------------------------\n"); - delete poFilter; + case AbstractFilter::FILTER_SUCCESS: + sourceFile = tempFile; + break; + case AbstractFilter::FILTER_FAILURE: + bSuccess = false; + break; } + + handleMessage("\n-------------------------------\n"); + delete poFilter; } //-----------------------------------------------------