Actually make encoding with x265 work, from y4m sources as well as from STDIN sources. Also various smaller fixes.

This commit is contained in:
LoRd_MuldeR 2014-02-26 17:39:36 +01:00
parent 675ef7cef5
commit 024355831d
12 changed files with 46 additions and 29 deletions

View File

@ -214,7 +214,12 @@ bool AbstractEncoder::runEncodingPass(AbstractSource* pipedSource, const QString
{
if(!(bTimeout || bAborted))
{
log(tr("\nPROCESS EXITED WITH ERROR CODE: %1").arg(QString::number(processEncode.exitCode())));
const int exitCode = processEncode.exitCode();
if((exitCode < 0) || (exitCode >= 32))
{
log(tr("\nFATAL ERROR: The encoder process has crashed, your encode probably is *incomplete* !!!"));
}
log(tr("\nPROCESS EXITED WITH ERROR CODE: %1").arg(QString::number(exitCode)));
}
processEncode.close();
processInput.close();

View File

@ -147,9 +147,9 @@ void X264Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &p
}
}
void X264Encoder::printVersion(const unsigned int &revision, const bool &modified)
QString X264Encoder::printVersion(const unsigned int &revision, const bool &modified)
{
log(tr("\nx264 revision: %1 (core #%2)\n").arg(QString::number(revision % REV_MULT), QString::number(revision / REV_MULT)).append(modified ? tr(" - with custom patches!") : QString()));
return tr("x264 revision: %1 (core #%2)").arg(QString::number(revision % REV_MULT), QString::number(revision / REV_MULT)).append(modified ? tr(" - with custom patches!") : QString());
}
bool X264Encoder::isVersionSupported(const unsigned int &revision, const bool &modified)

View File

@ -31,7 +31,7 @@ public:
virtual const QString &getName(void);
virtual void printVersion(const unsigned int &revision, const bool &modified);
virtual QString printVersion(const unsigned int &revision, const bool &modified);
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
protected:

View File

@ -32,7 +32,7 @@
//x265 version info
static const unsigned int X265_VERSION_X264_MINIMUM_VER = 7;
static const unsigned int X265_VERSION_X264_MINIMUM_REV = 167;
static const unsigned int X265_VERSION_X264_MINIMUM_REV = 232;
// ------------------------------------------------------------
// Helper Macros
@ -116,6 +116,7 @@ void X265Encoder::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdL
void X265Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified)
{
int offset = -1;
if((offset = patterns[0]->lastIndexIn(line)) >= 0)
{
bool ok1 = false, ok2 = false;
@ -124,11 +125,16 @@ void X265Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &p
if(ok1) coreVers = temp1;
if(ok2) revision = temp2;
}
if(!line.isEmpty())
{
log(line);
}
}
void X265Encoder::printVersion(const unsigned int &revision, const bool &modified)
QString X265Encoder::printVersion(const unsigned int &revision, const bool &modified)
{
log(tr("\nx265 version: 0.%1+%2\n").arg(QString::number(revision / REV_MULT), QString::number(revision % REV_MULT)));
return tr("x265 version: 0.%1+%2").arg(QString::number(revision / REV_MULT), QString::number(revision % REV_MULT));
}
bool X265Encoder::isVersionSupported(const unsigned int &revision, const bool &modified)
@ -215,12 +221,10 @@ void X265Encoder::buildCommandLine(QStringList &cmdLine, const bool &usePipe, co
{
if(frames < 1) throw "Frames not set!";
cmdLine << "--frames" << QString::number(frames);
cmdLine << "--demuxer" << "y4m";
cmdLine << "--stdin" << "y4m" << "-";
cmdLine << "--y4m" << "-";
}
else
{
cmdLine << "--index" << QDir::toNativeSeparators(indexFile);
cmdLine << QDir::toNativeSeparators(m_sourceFile);
}
}

View File

@ -31,7 +31,7 @@ public:
virtual const QString &getName(void);
virtual void printVersion(const unsigned int &revision, const bool &modified);
virtual QString printVersion(const unsigned int &revision, const bool &modified);
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
protected:

View File

@ -90,6 +90,7 @@ void AvisynthSource::checkVersion_parseLine(const QString &line, QList<QRegExp*>
coreVers = temp1;
revision = temp2;
}
log(line);
}
else if((offset = patterns[1]->lastIndexIn(line)) >= 0)
{
@ -103,6 +104,7 @@ void AvisynthSource::checkVersion_parseLine(const QString &line, QList<QRegExp*>
revision = (temp2 * 10) + (temp3 % 10);
}
modified = true;
log(line);
}
}
@ -111,9 +113,9 @@ bool AvisynthSource::checkVersion_succeeded(const int &exitCode)
return (exitCode == EXIT_SUCCESS) || (exitCode == 2);
}
void AvisynthSource::printVersion(const unsigned int &revision, const bool &modified)
QString AvisynthSource::printVersion(const unsigned int &revision, const bool &modified)
{
log(tr("Avs2YUV version: %1.%2.%3").arg(QString::number(revision / REV_MULT), QString::number((revision % REV_MULT) / 10),QString::number((revision % REV_MULT) % 10)));
return tr("Avs2YUV version: %1.%2.%3").arg(QString::number(revision / REV_MULT), QString::number((revision % REV_MULT) / 10),QString::number((revision % REV_MULT) % 10));
}
bool AvisynthSource::isVersionSupported(const unsigned int &revision, const bool &modified)

View File

@ -32,7 +32,7 @@ public:
virtual const QString &getName(void);
virtual bool isSourceAvailable(void);
virtual void printVersion(const unsigned int &revision, const bool &modified);
virtual QString printVersion(const unsigned int &revision, const bool &modified);
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
virtual void flushProcess(QProcess &processInput);

View File

@ -97,9 +97,9 @@ void VapoursynthSource::checkVersion_parseLine(const QString &line, QList<QRegEx
}
}
void VapoursynthSource::printVersion(const unsigned int &revision, const bool &modified)
QString VapoursynthSource::printVersion(const unsigned int &revision, const bool &modified)
{
log(tr("\nVapourSynth version: r%1 (API r%2)").arg(QString::number(revision % REV_MULT), QString::number(revision / REV_MULT)));
return tr("\nVapourSynth version: r%1 (API r%2)").arg(QString::number(revision % REV_MULT), QString::number(revision / REV_MULT));
}
bool VapoursynthSource::isVersionSupported(const unsigned int &revision, const bool &modified)

View File

@ -32,7 +32,7 @@ public:
virtual const QString &getName(void);
virtual bool isSourceAvailable(void);
virtual void printVersion(const unsigned int &revision, const bool &modified);
virtual QString printVersion(const unsigned int &revision, const bool &modified);
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
virtual void flushProcess(QProcess &processInput);

View File

@ -286,34 +286,40 @@ void EncodeThread::encode(void)
log(tr("\n--- CHECK VERSION ---\n"));
unsigned int encoderRevision = UINT_MAX, sourceRevision = UINT_MAX;
bool encoderModified = false, sourceModified = false;
log("Detect video encoder version:\n");
//Check encoder version
bool encoderModified = false;
const unsigned int encoderRevision = m_encoder->checkVersion(encoderModified);
encoderRevision = m_encoder->checkVersion(encoderModified);
CHECK_STATUS(m_abort, (ok = (encoderRevision != UINT_MAX)));
//Print source versions
m_encoder->printVersion(encoderRevision, encoderModified);
//Is encoder version suppoprted?
CHECK_STATUS(m_abort, (ok = m_encoder->isVersionSupported(encoderRevision, encoderModified)));
if(m_pipedSource)
{
log("\nDetect video source version:\n");
//Is source type available?
CHECK_STATUS(m_abort, (ok = m_pipedSource->isSourceAvailable()));
//Checking source version
bool sourceModified = false;
const unsigned int sourceRevision = m_pipedSource->checkVersion(sourceModified);
sourceRevision = m_pipedSource->checkVersion(sourceModified);
CHECK_STATUS(m_abort, (ok = (sourceRevision != UINT_MAX)));
//Print source versions
m_pipedSource->printVersion(sourceRevision, sourceModified);
//Is source version supported?
CHECK_STATUS(m_abort, (ok = m_pipedSource->isVersionSupported(sourceRevision, sourceModified)));
}
//Print tool versions
log(QString("\n> %1").arg(m_encoder->printVersion(encoderRevision, encoderModified)));
if(m_pipedSource)
{
log(QString("> %1").arg(m_pipedSource->printVersion(sourceRevision, sourceModified)));
}
// -----------------------------------------------------------------------------------
// Detect Source Info
// -----------------------------------------------------------------------------------

View File

@ -49,7 +49,7 @@ public:
virtual unsigned int checkVersion(bool &modified);
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified) = 0;
virtual void printVersion(const unsigned int &revision, const bool &modified) = 0;
virtual QString printVersion(const unsigned int &revision, const bool &modified) = 0;
static const unsigned int REV_MULT = 10000;

View File

@ -26,7 +26,7 @@
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 3
#define VER_X264_PATCH 3
#define VER_X264_BUILD 805
#define VER_X264_BUILD 807
#define VER_X264_PORTABLE_EDITION (0)