backend transcoding done for proxies
This commit is contained in:
+59
-3
@@ -5,8 +5,17 @@
|
||||
#include <QDialogButtonBox>
|
||||
#include <QComboBox>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Footage *> &footage) : QDialog(parent) {
|
||||
#include <QDebug>
|
||||
|
||||
#include "io/proxygenerator.h"
|
||||
#include "project/footage.h"
|
||||
|
||||
ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Footage *> &footage) :
|
||||
QDialog(parent),
|
||||
selected_footage(footage)
|
||||
{
|
||||
// set dialog title
|
||||
setWindowTitle(tr("Create Proxy"));
|
||||
|
||||
@@ -19,7 +28,7 @@ ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Footage *> &footage) : Q
|
||||
// set the video dimensions of the proxy
|
||||
layout->addWidget(new QLabel(tr("Dimensions:"), this), 0, 0);
|
||||
|
||||
QComboBox* size_combobox = new QComboBox(this);
|
||||
size_combobox = new QComboBox(this);
|
||||
size_combobox->addItem(tr("Same Size as Source"), 1.0);
|
||||
size_combobox->addItem(tr("Half Resolution (1/2)"), 0.5);
|
||||
size_combobox->addItem(tr("Quarter Resolution (1/4)"), 0.25);
|
||||
@@ -30,7 +39,7 @@ ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Footage *> &footage) : Q
|
||||
// set the desired format of the proxy to create
|
||||
layout->addWidget(new QLabel(tr("Format:"), this), 1, 0);
|
||||
|
||||
QComboBox* format_combobox = new QComboBox(this);
|
||||
format_combobox = new QComboBox(this);
|
||||
format_combobox->addItem(tr("ProRes HQ"));
|
||||
format_combobox->addItem(tr("ProRes SQ"));
|
||||
format_combobox->addItem(tr("ProRes LT"));
|
||||
@@ -58,6 +67,53 @@ ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Footage *> &footage) : Q
|
||||
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
void ProxyDialog::accept() {
|
||||
QVector<ProxyInfo> info_list;
|
||||
|
||||
for (int i=0;i<selected_footage.size();i++) {
|
||||
// loop through selected footage and send info to the proxy queue
|
||||
|
||||
ProxyInfo info;
|
||||
|
||||
// fill info struct based on user input
|
||||
info.footage = selected_footage.at(i);
|
||||
info.codec_type = 0;
|
||||
info.size_multiplier = size_combobox->currentData().toDouble();
|
||||
|
||||
QString base_footage_fn = QFileInfo(selected_footage.at(i)->url).fileName();
|
||||
|
||||
// determine path from input
|
||||
if (custom_location.isEmpty()) {
|
||||
// use same as source (proxy subfolder)
|
||||
|
||||
// generate full path from footage path and proxy_folder_name's translated "Proxy"
|
||||
info.path = QDir(QFileInfo(selected_footage.at(i)->url).dir().filePath(proxy_folder_name)).filePath(base_footage_fn);
|
||||
} else {
|
||||
// use existing location
|
||||
info.path = QDir(custom_location).filePath(base_footage_fn);
|
||||
}
|
||||
|
||||
// if the proposed proxy file already exists
|
||||
if (QFileInfo::exists(info.path) && QMessageBox::warning(this,
|
||||
tr("Proxy file exists"),
|
||||
tr("The file \"%1\" already exists. Do you wish to replace it?").arg(info.path),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
|
||||
// return to dialog without closing or starting any proxy generation
|
||||
return;
|
||||
}
|
||||
|
||||
// send to proxy generator thread
|
||||
info_list.append(info);
|
||||
}
|
||||
|
||||
// all proxy info checks out, queue it with the proxy generator
|
||||
for (int i=0;i<info_list.size();i++) {
|
||||
proxy_generator.queue(info_list.at(i));
|
||||
}
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void ProxyDialog::location_changed(int i) {
|
||||
custom_location.clear();
|
||||
if (i == 1) {
|
||||
|
||||
Reference in New Issue
Block a user