From 52eb860a9cc351601d1a886930f18475284a2c3e Mon Sep 17 00:00:00 2001 From: lordmulder Date: Fri, 21 Feb 2014 23:57:03 +0100 Subject: [PATCH] Added ".hevc" file extension to the save file dialog. --- src/model_recently.h | 3 ++- src/version.h | 2 +- src/win_addJob.cpp | 29 ++++++++++++++++++++++++----- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/model_recently.h b/src/model_recently.h index cbcc924..eef7bcc 100644 --- a/src/model_recently.h +++ b/src/model_recently.h @@ -32,7 +32,8 @@ X264_FILE_TYPE_FILTERS[] = { { "mkv", "Matroska Files" }, { "mp4", "MPEG-4 Part 14 Container" }, - { "264", "H.264 Elementary Stream"}, + { "264", "AVC/H.264 Elementary Stream"}, + { "hevc", "HEVC/H.264 Elementary Stream"}, }; class RecentlyUsed diff --git a/src/version.h b/src/version.h index 4349475..67dc713 100644 --- a/src/version.h +++ b/src/version.h @@ -26,7 +26,7 @@ #define VER_X264_MAJOR 2 #define VER_X264_MINOR 3 #define VER_X264_PATCH 1 -#define VER_X264_BUILD 778 +#define VER_X264_BUILD 779 #define VER_X264_MINIMUM_REV 2380 #define VER_X264_CURRENT_API 142 diff --git a/src/win_addJob.cpp b/src/win_addJob.cpp index 2de011d..1fe5611 100644 --- a/src/win_addJob.cpp +++ b/src/win_addJob.cpp @@ -504,16 +504,30 @@ void AddJobDialog::accept(void) return; } } - if(((sourceFile.suffix().compare("VPY", Qt::CaseInsensitive) == 0) || (sourceFile.suffix().compare("PY", Qt::CaseInsensitive) == 0)) && (!m_sysinfo->hasVPSSupport())) + else if(((sourceFile.suffix().compare("VPY", Qt::CaseInsensitive) == 0) || (sourceFile.suffix().compare("PY", Qt::CaseInsensitive) == 0)) && (!m_sysinfo->hasVPSSupport())) { if(QMessageBox::warning(this, tr("VapurSynth unsupported!"), tr("A VapourSynth script was selected as input, although VapourSynth is not/ available!"), tr("Abort"), tr("Ingnore (at your own risk!)")) != 1) { return; } } - - //Does output file already exist? + + //Is output file extension supported by encoder QFileInfo outputFile = QFileInfo(this->outputFile()); + if((outputFile.suffix().compare("264", Qt::CaseInsensitive) == 0) && (ui->cbxEncoderType->currentIndex() == OptionsModel::EncType_X265)) + { + QMessageBox::warning(this, tr("H.264 unsupported!"), tr("Sorry, x265 cannot output H.264/AVC files!")); + ui->editOutput->setText(QString("%1/%2.hevc").arg(outputFile.absolutePath(), outputFile.completeBaseName())); + return; + } + else if((outputFile.suffix().compare("HEVC", Qt::CaseInsensitive) == 0) && (ui->cbxEncoderType->currentIndex() == OptionsModel::EncType_X264)) + { + QMessageBox::warning(this, tr("H.264 unsupported!"), tr("Sorry, x264 cannot output H.265/HEVC files!")); + ui->editOutput->setText(QString("%1/%2.264").arg(outputFile.absolutePath(), outputFile.completeBaseName())); + return; + } + + //Does output file already exist? if(outputFile.exists() && outputFile.isFile()) { int ret = QMessageBox::question(this, tr("Already Exists!"), tr("Output file already exists! Overwrite?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); @@ -965,9 +979,14 @@ QString AddJobDialog::currentOutputPath(const bool bWithName) int AddJobDialog::currentOutputIndx(void) { - int index = m_recentlyUsed->filterIndex(); - QString currentOutputFile = this->outputFile(); + if(ui->cbxEncoderType->currentIndex() == OptionsModel::EncType_X265) + { + return ARRAY_SIZE(X264_FILE_TYPE_FILTERS) - 1; + } + int index = m_recentlyUsed->filterIndex(); + const QString currentOutputFile = this->outputFile(); + if(!currentOutputFile.isEmpty()) { const QString currentOutputExtn = QFileInfo(currentOutputFile).suffix();