Refactored code to insert the Downmix filter in processing thread.

This commit is contained in:
LoRd_MuldeR 2011-08-06 18:56:09 +02:00
parent ce872af94c
commit 1fdfab1160
6 changed files with 27 additions and 5 deletions

View File

@ -1620,7 +1620,7 @@
</message>
<message>
<source>Enforce Stereo Downmix of Surround (Multi-Channel) Sources</source>
<translation>Surround (Mehrkanal-Ton) Quellen auf Stereo heruntermischen</translation>
<translation>Surround (Mehrkanal-Ton) Quellen immer auf Stereo heruntermischen</translation>
</message>
</context>
<context>

Binary file not shown.

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 3
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 8
#define VER_LAMEXP_BUILD 623
#define VER_LAMEXP_BUILD 624
///////////////////////////////////////////////////////////////////////////////
// Tools versions

View File

@ -649,7 +649,7 @@ void ProcessingDialog::startNextJob(void)
);
//Add audio filters
if(m_settings->forceStereoDownmix() && (!encoder->requiresDownmix()) && ((currentFile.formatAudioChannels() > 2) || (currentFile.formatAudioChannels() == 0)))
if(m_settings->forceStereoDownmix() && ((currentFile.formatAudioChannels() > 2) || (currentFile.formatAudioChannels() == 0)))
{
thread->addFilter(new DownmixFilter());
}

View File

@ -135,9 +135,9 @@ void ProcessThread::processFile()
}
//Do we need Stereo downmix?
if(((m_audioFile.formatAudioChannels() > 2) || (m_audioFile.formatAudioChannels() == 0)) && m_encoder->requiresDownmix())
if(m_encoder->requiresDownmix() && ((m_audioFile.formatAudioChannels() > 2) || (m_audioFile.formatAudioChannels() == 0)))
{
m_filters.prepend(new DownmixFilter());
insertDownmixFilter();
}
QString sourceFile = m_audioFile.filePath();
@ -391,6 +391,27 @@ void ProcessThread::insertDownsampleFilter(void)
}
}
void ProcessThread::insertDownmixFilter(void)
{
bool applyDownmixing = true;
//Check if downmixing filter is already in the chain
for(int i = 0; i < m_filters.count(); i++)
{
if(dynamic_cast<DownmixFilter*>(m_filters.at(i)))
{
qWarning("Encoder requires Stereo downmix, but user has already forced downmix!");
applyDownmixing = false;
}
}
//Now add the downmixing filter, if needed
if(applyDownmixing)
{
m_filters.prepend(new DownmixFilter());
}
}
////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS
////////////////////////////////////////////////////////////

View File

@ -69,6 +69,7 @@ private:
QString generateOutFileName(void);
QString generateTempFileName(void);
void insertDownsampleFilter(void);
void insertDownmixFilter(void);
const QUuid m_jobId;
AudioFileModel m_audioFile;