OSDN Git Service

Updated copyright year.
[x264-launcher/x264-launcher.git] / src / thread_encode.cpp
index afec867..e3f539e 100644 (file)
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Simple x264 Launcher
-// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2018 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
 #include "model_options.h"
 #include "model_preferences.h"
 #include "model_sysinfo.h"
+#include "model_clipInfo.h"
 #include "job_object.h"
-#include "binaries.h"
 #include "mediainfo.h"
 
 //Encoders
 #include "encoder_factory.h"
 
 //Source
-#include "source_avisynth.h"
-#include "source_vapoursynth.h"
+#include "source_factory.h"
 
 //MUtils
 #include <MUtils/OSSupport.h>
@@ -139,13 +138,13 @@ EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputF
        case MediaInfo::FILETYPE_AVISYNTH:
                if(m_sysinfo->hasAvisynth())
                {
-                       m_pipedSource = new AvisynthSource   (m_jobObject, m_options, m_sysinfo, m_preferences, m_status, &m_abort, &m_pause, &m_semaphorePaused, m_sourceFileName);
+                       m_pipedSource = SourceFactory::createSource(SourceFactory::SourceType_AVS, m_jobObject, m_options, m_sysinfo, m_preferences, m_status, &m_abort, &m_pause, &m_semaphorePaused, m_sourceFileName);
                }
                break;
        case MediaInfo::FILETYPE_VAPOURSYNTH:
                if(m_sysinfo->hasVapourSynth())
                {
-                       m_pipedSource = new VapoursynthSource(m_jobObject, m_options, m_sysinfo, m_preferences, m_status, &m_abort, &m_pause, &m_semaphorePaused, m_sourceFileName);
+                       m_pipedSource = SourceFactory::createSource(SourceFactory::SourceType_VPS, m_jobObject, m_options, m_sysinfo, m_preferences, m_status, &m_abort, &m_pause, &m_semaphorePaused, m_sourceFileName);
                }
                break;
        }
@@ -262,14 +261,14 @@ void EncodeThread::encode(void)
        log(tr("\n--- SETTINGS ---\n"));
        log(tr("Encoder : %1").arg(m_encoder->getName()));
        log(tr("Source  : %1").arg(m_pipedSource ? m_pipedSource->getName() : tr("Native")));
-       log(tr("RC Mode : %1").arg(OptionsModel::rcMode2String(m_options->rcMode())));
+       log(tr("RC Mode : %1").arg(m_encoder->getEncoderInfo().rcModeToString(m_options->rcMode())));
        log(tr("Preset  : %1").arg(m_options->preset()));
        log(tr("Tuning  : %1").arg(m_options->tune()));
        log(tr("Profile : %1").arg(m_options->profile()));
        log(tr("Custom  : %1").arg(m_options->customEncParams().isEmpty() ? tr("<None>") : m_options->customEncParams()));
        
        bool ok = false;
-       unsigned int frames = 0;
+       ClipInfo clipInfo;
        
        // -----------------------------------------------------------------------------------
        // Check Versions
@@ -319,7 +318,7 @@ void EncodeThread::encode(void)
        if(m_pipedSource)
        {
                log(tr("\n--- GET SOURCE INFO ---\n"));
-               ok = m_pipedSource->checkSourceProperties(frames);
+               ok = m_pipedSource->checkSourceProperties(clipInfo);
                CHECK_STATUS(m_abort, ok);
        }
 
@@ -328,22 +327,22 @@ void EncodeThread::encode(void)
        // -----------------------------------------------------------------------------------
 
        //Run encoding passes
-       if(m_options->rcMode() == OptionsModel::RCMode_2Pass)
+       if(m_encoder->getEncoderInfo().rcModeToType(m_options->rcMode()) == AbstractEncoderInfo::RC_TYPE_MULTIPASS)
        {
                const QString passLogFile = getPasslogFile(m_outputFileName);
                
                log(tr("\n--- ENCODING PASS #1 ---\n"));
-               ok = m_encoder->runEncodingPass(m_pipedSource, m_outputFileName, frames, 1, passLogFile);
+               ok = m_encoder->runEncodingPass(m_pipedSource, m_outputFileName, clipInfo, 1, passLogFile);
                CHECK_STATUS(m_abort, ok);
 
                log(tr("\n--- ENCODING PASS #2 ---\n"));
-               ok = m_encoder->runEncodingPass(m_pipedSource, m_outputFileName, frames, 2, passLogFile);
+               ok = m_encoder->runEncodingPass(m_pipedSource, m_outputFileName, clipInfo, 2, passLogFile);
                CHECK_STATUS(m_abort, ok);
        }
        else
        {
                log(tr("\n--- ENCODING VIDEO ---\n"));
-               ok = m_encoder->runEncodingPass(m_pipedSource, m_outputFileName, frames);
+               ok = m_encoder->runEncodingPass(m_pipedSource, m_outputFileName, clipInfo);
                CHECK_STATUS(m_abort, ok);
        }
 
@@ -364,7 +363,7 @@ void EncodeThread::encode(void)
 
 void EncodeThread::log(const QString &text)
 {
-       emit messageLogged(m_jobId, text);
+       emit messageLogged(m_jobId, QDateTime::currentMSecsSinceEpoch(), text);
 }
 
 void EncodeThread::setStatus(const JobStatus &newStatus)