merged master

This commit is contained in:
itsmattkc
2019-01-03 23:04:20 +11:00
27 changed files with 867 additions and 825 deletions
+47 -68
View File
@@ -57,6 +57,7 @@ enum ExportFormats {
ExportDialog::ExportDialog(QWidget *parent) :
QDialog(parent)
{
setWindowTitle("Export \"" + sequence->name + "\"");
setup_ui();
rangeCombobox->setCurrentIndex(0);
@@ -601,54 +602,41 @@ void ExportDialog::setup_ui() {
videoGroupbox->setTitle("Video");
videoGroupbox->setFlat(false);
videoGroupbox->setCheckable(true);
QGridLayout* gridLayout = new QGridLayout(videoGroupbox);
gridLayout->addWidget(new QLabel("Compression Type:"), 4, 0, 1, 1);
QGridLayout* videoGridLayout = new QGridLayout(videoGroupbox);
videoGridLayout->addWidget(new QLabel("Codec:"), 0, 0, 1, 1);
vcodecCombobox = new QComboBox(videoGroupbox);
videoGridLayout->addWidget(vcodecCombobox, 0, 1, 1, 1);
videoGridLayout->addWidget(new QLabel("Width:"), 1, 0, 1, 1);
widthSpinbox = new QSpinBox(videoGroupbox);
widthSpinbox->setMaximum(16777216);
videoGridLayout->addWidget(widthSpinbox, 1, 1, 1, 1);
videoGridLayout->addWidget(new QLabel("Height:"), 2, 0, 1, 1);
heightSpinbox = new QSpinBox(videoGroupbox);
heightSpinbox->setMaximum(16777216);
videoGridLayout->addWidget(heightSpinbox, 2, 1, 1, 1);
videoGridLayout->addWidget(new QLabel("Frame Rate:"), 3, 0, 1, 1);
framerateSpinbox = new QDoubleSpinBox(videoGroupbox);
framerateSpinbox->setMaximum(60);
framerateSpinbox->setValue(0);
videoGridLayout->addWidget(framerateSpinbox, 3, 1, 1, 1);
videoGridLayout->addWidget(new QLabel("Compression Type:"), 4, 0, 1, 1);
compressionTypeCombobox = new QComboBox(videoGroupbox);
compressionTypeCombobox->addItem("Quality-based (Constant Rate Factor)");
compressionTypeCombobox->addItem("File size-based (Two-Pass)");
videoGridLayout->addWidget(compressionTypeCombobox, 4, 1, 1, 1);
gridLayout->addWidget(compressionTypeCombobox, 4, 1, 1, 1);
gridLayout->addWidget(new QLabel("Codec:"), 0, 0, 1, 1);
vcodecCombobox = new QComboBox(videoGroupbox);
gridLayout->addWidget(vcodecCombobox, 0, 1, 1, 1);
gridLayout->addWidget(new QLabel("Height:"), 2, 0, 1, 1);
gridLayout->addWidget(new QLabel("Width:"), 1, 0, 1, 1);
heightSpinbox = new QSpinBox(videoGroupbox);
heightSpinbox->setMaximum(16777216);
gridLayout->addWidget(heightSpinbox, 2, 1, 1, 1);
widthSpinbox = new QSpinBox(videoGroupbox);
widthSpinbox->setMaximum(16777216);
gridLayout->addWidget(widthSpinbox, 1, 1, 1, 1);
videobitrateSpinbox = new QDoubleSpinBox(videoGroupbox);
videobitrateSpinbox->setMaximum(100);
videobitrateSpinbox->setValue(2);
gridLayout->addWidget(videobitrateSpinbox, 5, 1, 1, 1);
videoBitrateLabel = new QLabel(videoGroupbox);
gridLayout->addWidget(videoBitrateLabel, 5, 0, 1, 1);
gridLayout->addWidget(new QLabel("Frame Rate:"), 3, 0, 1, 1);
framerateSpinbox = new QDoubleSpinBox(videoGroupbox);
framerateSpinbox->setMaximum(60);
framerateSpinbox->setValue(0);
gridLayout->addWidget(framerateSpinbox, 3, 1, 1, 1);
videoBitrateLabel = new QLabel(videoGroupbox);
videoGridLayout->addWidget(videoBitrateLabel, 5, 0, 1, 1);
videobitrateSpinbox = new QDoubleSpinBox(videoGroupbox);
videobitrateSpinbox->setMaximum(100);
videobitrateSpinbox->setValue(2);
videoGridLayout->addWidget(videobitrateSpinbox, 5, 1, 1, 1);
verticalLayout->addWidget(videoGroupbox);
@@ -656,69 +644,60 @@ void ExportDialog::setup_ui() {
audioGroupbox->setTitle("Audio");
audioGroupbox->setCheckable(true);
QGridLayout* gridLayout_2 = new QGridLayout(audioGroupbox);
gridLayout_2->addWidget(new QLabel("Codec:"), 0, 0, 1, 1);
QGridLayout* audioGridLayout = new QGridLayout(audioGroupbox);
audioGridLayout->addWidget(new QLabel("Codec:"), 0, 0, 1, 1);
acodecCombobox = new QComboBox(audioGroupbox);
audioGridLayout->addWidget(acodecCombobox, 0, 1, 1, 1);
gridLayout_2->addWidget(acodecCombobox, 0, 1, 1, 1);
audioGridLayout->addWidget(new QLabel("Sampling Rate:"), 1, 0, 1, 1);
samplingRateSpinbox = new QSpinBox(audioGroupbox);
samplingRateSpinbox->setMaximum(96000);
samplingRateSpinbox->setValue(0);
audioGridLayout->addWidget(samplingRateSpinbox, 1, 1, 1, 1);
gridLayout_2->addWidget(samplingRateSpinbox, 1, 1, 1, 1);
gridLayout_2->addWidget(new QLabel("Sampling Rate:"), 1, 0, 1, 1);
gridLayout_2->addWidget(new QLabel("Bitrate (Kbps/CBR):"), 3, 0, 1, 1);
audioGridLayout->addWidget(new QLabel("Bitrate (Kbps/CBR):"), 3, 0, 1, 1);
audiobitrateSpinbox = new QSpinBox(audioGroupbox);
audiobitrateSpinbox->setMaximum(320);
audiobitrateSpinbox->setValue(256);
gridLayout_2->addWidget(audiobitrateSpinbox, 3, 1, 1, 1);
audioGridLayout->addWidget(audiobitrateSpinbox, 3, 1, 1, 1);
verticalLayout->addWidget(audioGroupbox);
QHBoxLayout* horizontalLayout_3 = new QHBoxLayout();
QHBoxLayout* progressLayout = new QHBoxLayout();
progressBar = new QProgressBar(this);
progressBar->setFormat("%p% (ETA: 0:00:00)");
progressBar->setEnabled(false);
progressBar->setValue(0);
horizontalLayout_3->addWidget(progressBar);
progressLayout->addWidget(progressBar);
renderCancel = new QPushButton(this);
renderCancel->setText("x");
renderCancel->setEnabled(false);
renderCancel->setMaximumSize(QSize(20, 16777215));
connect(renderCancel, SIGNAL(clicked(bool)), this, SLOT(cancel_render()));
progressLayout->addWidget(renderCancel);
horizontalLayout_3->addWidget(renderCancel);
verticalLayout->addLayout(progressLayout);
verticalLayout->addLayout(horizontalLayout_3);
QHBoxLayout* horizontalLayout_2 = new QHBoxLayout();
horizontalLayout_2->addStretch();
QHBoxLayout* buttonLayout = new QHBoxLayout();
buttonLayout->addStretch();
export_button = new QPushButton(this);
export_button->setText("Export");
connect(export_button, SIGNAL(clicked(bool)), this, SLOT(export_action()));
horizontalLayout_2->addWidget(export_button);
buttonLayout->addWidget(export_button);
cancel_button = new QPushButton(this);
cancel_button->setText("Cancel");
connect(cancel_button, SIGNAL(clicked(bool)), this, SLOT(reject()));
horizontalLayout_2->addWidget(cancel_button);
buttonLayout->addWidget(cancel_button);
horizontalLayout_2->addStretch();
buttonLayout->addStretch();
verticalLayout->addLayout(horizontalLayout_2);
verticalLayout->addLayout(buttonLayout);
connect(formatCombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(format_changed(int)));
connect(compressionTypeCombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(comp_type_changed(int)));
+88 -28
View File
@@ -6,6 +6,8 @@
#include <QLineEdit>
#include <QDialogButtonBox>
#include <QTreeWidgetItem>
#include <QGroupBox>
#include <QListWidget>
#include "project/footage.h"
#include "project/media.h"
@@ -13,59 +15,117 @@
#include "project/undo.h"
MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
QDialog(parent),
item(i)
QDialog(parent),
item(i)
{
setWindowTitle("\"" + i->get_name() + "\" Properties");
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QGridLayout* grid = new QGridLayout();
setLayout(grid);
Footage* f = item->to_footage();
if (f->video_tracks.size() > 0) {
interlacing_box = new QComboBox();
interlacing_box->addItem("Auto (" + get_interlacing_name(f->video_tracks.at(0)->video_auto_interlacing) + ")");
interlacing_box->addItem(get_interlacing_name(VIDEO_PROGRESSIVE));
interlacing_box->addItem(get_interlacing_name(VIDEO_TOP_FIELD_FIRST));
interlacing_box->addItem(get_interlacing_name(VIDEO_BOTTOM_FIELD_FIRST));
int row = 0;
interlacing_box->setCurrentIndex((f->video_tracks.at(0)->video_auto_interlacing == f->video_tracks.at(0)->video_interlacing) ? 0 : f->video_tracks.at(0)->video_interlacing + 1);
Footage* f = item->to_footage();
grid->addWidget(new QLabel("Interlacing:"), 0, 0);
grid->addWidget(interlacing_box, 0, 1);
}
grid->addWidget(new QLabel("Tracks:"), row, 0, 1, 2);
row++;
name_box = new QLineEdit(item->get_name());
grid->addWidget(new QLabel("Name:"), 1, 0);
grid->addWidget(name_box, 1, 1);
track_list = new QListWidget();
for (int i=0;i<f->video_tracks.size();i++) {
const FootageStream& fs = f->video_tracks.at(i);
QListWidgetItem* item = new QListWidgetItem("Video " + QString::number(fs.file_index) + ": " + QString::number(fs.video_width) + "x" + QString::number(fs.video_height) + " " + QString::number(fs.video_frame_rate) + "FPS");
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(fs.enabled ? Qt::Checked : Qt::Unchecked);
item->setData(Qt::UserRole+1, fs.file_index);
track_list->addItem(item);
}
for (int i=0;i<f->audio_tracks.size();i++) {
const FootageStream& fs = f->audio_tracks.at(i);
QListWidgetItem* item = new QListWidgetItem("Audio " + QString::number(fs.file_index) + ": " + QString::number(fs.audio_frequency) + "Hz " + QString::number(fs.audio_channels) + " channels");
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(fs.enabled ? Qt::Checked : Qt::Unchecked);
item->setData(Qt::UserRole+1, fs.file_index);
track_list->addItem(item);
}
grid->addWidget(track_list, row, 0, 1, 2);
row++;
if (f->video_tracks.size() > 0) {
interlacing_box = new QComboBox();
interlacing_box->addItem("Auto (" + get_interlacing_name(f->video_tracks.at(0).video_auto_interlacing) + ")");
interlacing_box->addItem(get_interlacing_name(VIDEO_PROGRESSIVE));
interlacing_box->addItem(get_interlacing_name(VIDEO_TOP_FIELD_FIRST));
interlacing_box->addItem(get_interlacing_name(VIDEO_BOTTOM_FIELD_FIRST));
interlacing_box->setCurrentIndex((f->video_tracks.at(0).video_auto_interlacing == f->video_tracks.at(0).video_interlacing) ? 0 : f->video_tracks.at(0).video_interlacing + 1);
grid->addWidget(new QLabel("Interlacing:"), row, 0);
grid->addWidget(interlacing_box, row, 1);
row++;
}
name_box = new QLineEdit(item->get_name());
grid->addWidget(new QLabel("Name:"), row, 0);
grid->addWidget(name_box, row, 1);
row++;
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
buttons->setCenterButtons(true);
grid->addWidget(buttons, 2, 0, 1, 2);
grid->addWidget(buttons, row, 0, 1, 2);
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
}
void MediaPropertiesDialog::accept() {
Footage* f = item->to_footage();
ComboAction* ca = new ComboAction();
//set interlacing
Footage* f = item->to_footage();
if (interlacing_box->currentIndex() > 0) {
ca->append(new SetInt(&f->video_tracks.at(0)->video_interlacing, interlacing_box->currentIndex() - 1));
} else {
ca->append(new SetInt(&f->video_tracks.at(0)->video_interlacing, f->video_tracks.at(0)->video_auto_interlacing));
// set track enable
for (int i=0;i<track_list->count();i++) {
QListWidgetItem* item = track_list->item(i);
const QVariant& data = item->data(Qt::UserRole+1);
if (!data.isNull()) {
int index = data.toInt();
bool found = false;
for (int j=0;j<f->video_tracks.size();j++) {
if (f->video_tracks.at(j).file_index == index) {
f->video_tracks[j].enabled = (item->checkState() == Qt::Checked);
found = true;
break;
}
}
if (!found) {
for (int j=0;j<f->audio_tracks.size();j++) {
if (f->audio_tracks.at(j).file_index == index) {
f->audio_tracks[j].enabled = (item->checkState() == Qt::Checked);
break;
}
}
}
}
}
//set name
MediaRename* mr = new MediaRename(item, name_box->text());
// set interlacing
if (f->video_tracks.size() > 0) {
if (interlacing_box->currentIndex() > 0) {
ca->append(new SetInt(&f->video_tracks[0].video_interlacing, interlacing_box->currentIndex() - 1));
} else {
ca->append(new SetInt(&f->video_tracks[0].video_interlacing, f->video_tracks.at(0).video_auto_interlacing));
}
}
// set name
MediaRename* mr = new MediaRename(item, name_box->text());
ca->append(mr);
ca->appendPost(new CloseAllClipsCommand());
ca->appendPost(new UpdateFootageTooltip(item));
ca->appendPost(new UpdateFootageTooltip(item));
undo_stack.push(ca);
QDialog::accept();
QDialog::accept();
}
+2
View File
@@ -7,6 +7,7 @@ struct Footage;
class QComboBox;
class QLineEdit;
class Media;
class QListWidget;
class MediaPropertiesDialog : public QDialog {
Q_OBJECT
@@ -16,6 +17,7 @@ private:
QComboBox* interlacing_box;
QLineEdit* name_box;
Media* item;
QListWidget* track_list;
private slots:
void accept();
};
+59 -69
View File
@@ -42,7 +42,7 @@ NewSequenceDialog::NewSequenceDialog(QWidget *parent, Media *existing) :
break;
}
}
lineEdit->setText(existing_sequence->name);
sequence_name_edit->setText(existing_sequence->name);
for (int i=0;i<audio_frequency_combobox->count();i++) {
if (audio_frequency_combobox->itemData(i) == existing_sequence->audio_frequency) {
audio_frequency_combobox->setCurrentIndex(i);
@@ -59,14 +59,14 @@ NewSequenceDialog::~NewSequenceDialog()
{}
void NewSequenceDialog::set_sequence_name(const QString& s) {
lineEdit->setText(s);
sequence_name_edit->setText(s);
}
void NewSequenceDialog::create() {
if (existing_sequence == NULL) {
Sequence* s = new Sequence();
s->name = lineEdit->text();
s->name = sequence_name_edit->text();
s->width = width_numeric->value();
s->height = height_numeric->value();
s->frame_rate = frame_rate_combobox->currentData().toDouble();
@@ -82,7 +82,7 @@ void NewSequenceDialog::create() {
double multiplier = frame_rate_combobox->currentData().toDouble() / existing_sequence->frame_rate;
EditSequenceCommand* esc = new EditSequenceCommand(existing_item, existing_sequence);
esc->name = lineEdit->text();
esc->name = sequence_name_edit->text();
esc->width = width_numeric->value();
esc->height = height_numeric->value();
esc->frame_rate = frame_rate_combobox->currentData().toDouble();
@@ -154,10 +154,10 @@ void NewSequenceDialog::setup_ui() {
QWidget* widget = new QWidget(this);
QHBoxLayout* horizontalLayout_2 = new QHBoxLayout(widget);
horizontalLayout_2->setContentsMargins(0, 0, 0, 0);
QHBoxLayout* preset_layout = new QHBoxLayout(widget);
preset_layout->setContentsMargins(0, 0, 0, 0);
horizontalLayout_2->addWidget(new QLabel("Preset:"));
preset_layout->addWidget(new QLabel("Preset:"));
preset_combobox = new QComboBox(widget);
@@ -174,75 +174,65 @@ void NewSequenceDialog::setup_ui() {
preset_combobox->addItem("Custom");
preset_combobox->setCurrentIndex(2);
horizontalLayout_2->addWidget(preset_combobox);
preset_layout->addWidget(preset_combobox);
verticalLayout->addWidget(widget);
QGroupBox* groupBox = new QGroupBox(this);
groupBox->setTitle("Video");
QGroupBox* videoGroupBox = new QGroupBox(this);
videoGroupBox->setTitle("Video");
QGridLayout* gridLayout = new QGridLayout(groupBox);
QGridLayout* videoLayout = new QGridLayout(videoGroupBox);
height_numeric = new QSpinBox(groupBox);
videoLayout->addWidget(new QLabel("Width:"), 0, 0, 1, 1);
width_numeric = new QSpinBox(videoGroupBox);
width_numeric->setMaximum(9999);
width_numeric->setValue(1920);
videoLayout->addWidget(width_numeric, 0, 2, 1, 2);
videoLayout->addWidget(new QLabel("Height:"), 1, 0, 1, 2);
height_numeric = new QSpinBox(videoGroupBox);
height_numeric->setMaximum(9999);
height_numeric->setValue(1080);
videoLayout->addWidget(height_numeric, 1, 2, 1, 2);
gridLayout->addWidget(height_numeric, 1, 2, 1, 2);
videoLayout->addWidget(new QLabel("Frame Rate:"), 2, 0, 1, 1);
frame_rate_combobox = new QComboBox(videoGroupBox);
frame_rate_combobox->addItem("10 FPS", 10.0);
frame_rate_combobox->addItem("12.5 FPS", 12.5);
frame_rate_combobox->addItem("15 FPS", 15.0);
frame_rate_combobox->addItem("23.976 FPS", 23.976);
frame_rate_combobox->addItem("24 FPS", 24.0);
frame_rate_combobox->addItem("25 FPS", 25.0);
frame_rate_combobox->addItem("29.97 FPS", 29.97);
frame_rate_combobox->addItem("30 FPS", 30.0);
frame_rate_combobox->addItem("50 FPS", 50.0);
frame_rate_combobox->addItem("59.94 FPS", 59.94);
frame_rate_combobox->addItem("60 FPS", 60.0);
frame_rate_combobox->setCurrentIndex(6);
videoLayout->addWidget(frame_rate_combobox, 2, 2, 1, 2);
width_numeric = new QSpinBox(groupBox);
width_numeric->setMaximum(9999);
width_numeric->setValue(1920);
videoLayout->addWidget(new QLabel("Pixel Aspect Ratio:"), 4, 0, 1, 1);
par_combobox = new QComboBox(videoGroupBox);
par_combobox->addItem("Square Pixels (1.0)");
videoLayout->addWidget(par_combobox, 4, 2, 1, 2);
gridLayout->addWidget(width_numeric, 0, 2, 1, 2);
gridLayout->addWidget(new QLabel("Width:"), 0, 0, 1, 1);
gridLayout->addWidget(new QLabel("Pixel Aspect Ratio:"), 4, 0, 1, 1);
gridLayout->addWidget(new QLabel("Interlacing:"), 6, 0, 1, 1);
gridLayout->addWidget(new QLabel("Height:"), 1, 0, 1, 2);
par_combobox = new QComboBox(groupBox);
par_combobox->addItem("Square Pixels (1.0)");
gridLayout->addWidget(par_combobox, 4, 2, 1, 2);
interlacing_combobox = new QComboBox(groupBox);
videoLayout->addWidget(new QLabel("Interlacing:"), 6, 0, 1, 1);
interlacing_combobox = new QComboBox(videoGroupBox);
interlacing_combobox->addItem("None (Progressive)");
interlacing_combobox->addItem("Upper Field First");
interlacing_combobox->addItem("Lower Field First");
// interlacing_combobox->addItem("Upper Field First");
// interlacing_combobox->addItem("Lower Field First");
videoLayout->addWidget(interlacing_combobox, 6, 2, 1, 2);
gridLayout->addWidget(interlacing_combobox, 6, 2, 1, 2);
verticalLayout->addWidget(videoGroupBox);
frame_rate_combobox = new QComboBox(groupBox);
frame_rate_combobox->addItem("10 FPS", 10.0);
frame_rate_combobox->addItem("12.5 FPS", 12.5);
frame_rate_combobox->addItem("15 FPS", 15.0);
frame_rate_combobox->addItem("23.976 FPS", 23.976);
frame_rate_combobox->addItem("24 FPS", 24.0);
frame_rate_combobox->addItem("25 FPS", 25.0);
frame_rate_combobox->addItem("29.97 FPS", 29.97);
frame_rate_combobox->addItem("30 FPS", 30.0);
frame_rate_combobox->addItem("50 FPS", 50.0);
frame_rate_combobox->addItem("59.94 FPS", 59.94);
frame_rate_combobox->addItem("60 FPS", 60.0);
frame_rate_combobox->setCurrentIndex(6);
QGroupBox* audioGroupBox = new QGroupBox(this);
audioGroupBox->setTitle("Audio");
gridLayout->addWidget(frame_rate_combobox, 2, 2, 1, 2);
QGridLayout* audioLayout = new QGridLayout(audioGroupBox);
gridLayout->addWidget(new QLabel("Frame Rate:"), 2, 0, 1, 1);
audioLayout->addWidget(new QLabel("Sample Rate: "), 0, 0, 1, 1);
verticalLayout->addWidget(groupBox);
QGroupBox* groupBox_2 = new QGroupBox(this);
groupBox_2->setTitle("Audio");
QGridLayout* gridLayout_2 = new QGridLayout(groupBox_2);
gridLayout_2->addWidget(new QLabel("Sample Rate: "), 0, 0, 1, 1);
audio_frequency_combobox = new QComboBox(groupBox_2);
audio_frequency_combobox = new QComboBox(audioGroupBox);
audio_frequency_combobox->addItem("22050 Hz", 22050);
audio_frequency_combobox->addItem("24000 Hz", 24000);
audio_frequency_combobox->addItem("32000 Hz", 32000);
@@ -252,21 +242,21 @@ void NewSequenceDialog::setup_ui() {
audio_frequency_combobox->addItem("96000 Hz", 96000);
audio_frequency_combobox->setCurrentIndex(4);
gridLayout_2->addWidget(audio_frequency_combobox, 0, 1, 1, 1);
audioLayout->addWidget(audio_frequency_combobox, 0, 1, 1, 1);
verticalLayout->addWidget(groupBox_2);
verticalLayout->addWidget(audioGroupBox);
QWidget* widget_2 = new QWidget(this);
QHBoxLayout* horizontalLayout = new QHBoxLayout(widget_2);
horizontalLayout->setContentsMargins(0, 0, 0, 0);
QWidget* nameWidget = new QWidget(this);
QHBoxLayout* nameLayout = new QHBoxLayout(nameWidget);
nameLayout->setContentsMargins(0, 0, 0, 0);
horizontalLayout->addWidget(new QLabel("Name:"));
nameLayout->addWidget(new QLabel("Name:"));
lineEdit = new QLineEdit(widget_2);
sequence_name_edit = new QLineEdit(nameWidget);
horizontalLayout->addWidget(lineEdit);
nameLayout->addWidget(sequence_name_edit);
verticalLayout->addWidget(widget_2);
verticalLayout->addWidget(nameWidget);
QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
buttonBox->setOrientation(Qt::Horizontal);
+1 -1
View File
@@ -37,7 +37,7 @@ private:
QComboBox* interlacing_combobox;
QComboBox* frame_rate_combobox;
QComboBox* audio_frequency_combobox;
QLineEdit* lineEdit;
QLineEdit* sequence_name_edit;
};
#endif // NEWSEQUENCEDIALOG_H
+3 -3
View File
@@ -23,6 +23,8 @@ ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media *old_media
QDialog(parent),
media(old_media)
{
setWindowTitle("Replace clips using \"" + old_media->get_name() + "\"");
resize(300, 400);
QVBoxLayout* layout = new QVBoxLayout();
@@ -56,12 +58,10 @@ ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media *old_media
setLayout(layout);
tree->setModel(&project_model);
//copy_tree(NULL, NULL);
}
void ReplaceClipMediaDialog::replace() {
QModelIndexList selected_items = panel_project->get_current_selected();
QModelIndexList selected_items = tree->selectionModel()->selectedRows();
if (selected_items.size() != 1) {
QMessageBox::critical(this, "No media selected", "Please select a media to replace with or click 'Cancel'.", QMessageBox::Ok);
} else {
+57 -48
View File
@@ -55,14 +55,13 @@ void PreviewGenerator::parse_media() {
if (avcodec_find_decoder(fmt_ctx->streams[i]->codecpar->codec_id) == NULL) {
dout << "[ERROR] Unsupported codec in stream" << i << "of file" << footage->name;
} else {
FootageStream* ms = footage->get_stream_from_file_index(fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO, i);
FootageStream ms;
ms.preview_done = false;
ms.file_index = i;
ms.enabled = true;
bool append = false;
if (ms == NULL) {
ms = new FootageStream();
ms->preview_done = false;
ms->file_index = i;
append = true;
}
if (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO
&& fmt_ctx->streams[i]->codecpar->width > 0
&& fmt_ctx->streams[i]->codecpar->height > 0) {
@@ -76,33 +75,43 @@ void PreviewGenerator::parse_media() {
// heuristic to determine if video is a still image
if (fmt_ctx->streams[i]->avg_frame_rate.den == 0
&& fmt_ctx->streams[i]->codecpar->codec_id != AV_CODEC_ID_DNXHD) { // silly hack but this is the only scenario i've seen this
ms->infinite_length = true;
ms.infinite_length = true;
contains_still_image = true;
ms->video_frame_rate = 0;
ms.video_frame_rate = 0;
} else {
ms->infinite_length = false;
ms.infinite_length = false;
if (fmt_ctx->streams[i]->r_frame_rate.den == 0) {
ms->video_frame_rate = av_q2d(fmt_ctx->streams[i]->avg_frame_rate);
ms.video_frame_rate = av_q2d(fmt_ctx->streams[i]->avg_frame_rate);
} else {
ms->video_frame_rate = av_q2d(fmt_ctx->streams[i]->r_frame_rate);
ms.video_frame_rate = av_q2d(fmt_ctx->streams[i]->r_frame_rate);
}
}
ms->video_width = fmt_ctx->streams[i]->codecpar->width;
ms->video_height = fmt_ctx->streams[i]->codecpar->height;
ms.video_width = fmt_ctx->streams[i]->codecpar->width;
ms.video_height = fmt_ctx->streams[i]->codecpar->height;
// default value, we get the true value later in generate_waveform()
ms->video_auto_interlacing = VIDEO_PROGRESSIVE;
ms->video_interlacing = VIDEO_PROGRESSIVE;
ms.video_auto_interlacing = VIDEO_PROGRESSIVE;
ms.video_interlacing = VIDEO_PROGRESSIVE;
if (append) footage->video_tracks.append(ms);
append = true;
} else if (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
ms->audio_channels = fmt_ctx->streams[i]->codecpar->channels;
ms->audio_layout = fmt_ctx->streams[i]->codecpar->channel_layout;
ms->audio_frequency = fmt_ctx->streams[i]->codecpar->sample_rate;
if (append) footage->audio_tracks.append(ms);
} else if (append) {
delete ms;
}
ms.audio_channels = fmt_ctx->streams[i]->codecpar->channels;
ms.audio_layout = fmt_ctx->streams[i]->codecpar->channel_layout;
ms.audio_frequency = fmt_ctx->streams[i]->codecpar->sample_rate;
append = true;
}
if (append) {
QVector<FootageStream>& stream_list = (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) ? footage->audio_tracks : footage->video_tracks;
for (int j=0;j<stream_list.size();j++) {
if (stream_list.at(j).file_index == i) {
stream_list[j] = ms;
append = false;
}
}
if (append) stream_list.append(ms);
}
}
}
footage->length = fmt_ctx->duration;
@@ -123,32 +132,32 @@ bool PreviewGenerator::retrieve_preview(const QString& hash) {
bool found = true;
for (int i=0;i<footage->video_tracks.size();i++) {
FootageStream* ms = footage->video_tracks.at(i);
FootageStream& ms = footage->video_tracks[i];
QString thumb_path = get_thumbnail_path(hash, ms);
QFile f(thumb_path);
if (f.exists() && ms->video_preview.load(thumb_path)) {
if (f.exists() && ms.video_preview.load(thumb_path)) {
//dout << "loaded thumb" << ms->file_index << "from" << thumb_path;
ms->make_square_thumb();
ms->preview_done = true;
ms.make_square_thumb();
ms.preview_done = true;
} else {
found = false;
break;
}
}
for (int i=0;i<footage->audio_tracks.size();i++) {
FootageStream* ms = footage->audio_tracks.at(i);
FootageStream& ms = footage->audio_tracks[i];
QString waveform_path = get_waveform_path(hash, ms);
QFile f(waveform_path);
if (f.exists()) {
//dout << "loaded wave" << ms->file_index << "from" << waveform_path;
f.open(QFile::ReadOnly);
QByteArray data = f.readAll();
ms->audio_preview.resize(data.size());
ms.audio_preview.resize(data.size());
for (int j=0;j<data.size();j++) {
// faster way?
ms->audio_preview[j] = data.at(j);
ms.audio_preview[j] = data.at(j);
}
ms->preview_done = true;
ms.preview_done = true;
f.close();
} else {
found = false;
@@ -157,13 +166,13 @@ bool PreviewGenerator::retrieve_preview(const QString& hash) {
}
if (!found) {
for (int i=0;i<footage->video_tracks.size();i++) {
FootageStream* ms = footage->video_tracks.at(i);
ms->preview_done = false;
FootageStream& ms = footage->video_tracks[i];
ms.preview_done = false;
}
for (int i=0;i<footage->audio_tracks.size();i++) {
FootageStream* ms = footage->audio_tracks.at(i);
ms->audio_preview.clear();
ms->preview_done = false;
FootageStream& ms = footage->audio_tracks[i];
ms.audio_preview.clear();
ms.preview_done = false;
}
}
return !found;
@@ -336,7 +345,7 @@ void PreviewGenerator::generate_waveform() {
break;
}
}
s->audio_preview.append(min >> 8);
s->audio_preview.append(min >> 8);
s->audio_preview.append(max >> 8);
if (cancelled) break;
}
@@ -359,7 +368,7 @@ void PreviewGenerator::generate_waveform() {
} else if (footage->audio_tracks.size() == 0) {
done = true;
for (int i=0;i<footage->video_tracks.size();i++) {
if (!footage->video_tracks.at(i)->preview_done) {
if (!footage->video_tracks.at(i).preview_done) {
done = false;
break;
}
@@ -373,7 +382,7 @@ void PreviewGenerator::generate_waveform() {
}
}
for (int i=0;i<footage->audio_tracks.size();i++) {
footage->audio_tracks.at(i)->preview_done = true;
footage->audio_tracks[i].preview_done = true;
}
av_frame_free(&temp_frame);
av_packet_free(&packet);
@@ -397,12 +406,12 @@ void PreviewGenerator::generate_waveform() {
delete [] codec_ctx;
}
QString PreviewGenerator::get_thumbnail_path(const QString& hash, FootageStream* ms) {
return data_path + "/" + hash + "t" + QString::number(ms->file_index);
QString PreviewGenerator::get_thumbnail_path(const QString& hash, const FootageStream& ms) {
return data_path + "/" + hash + "t" + QString::number(ms.file_index);
}
QString PreviewGenerator::get_waveform_path(const QString& hash, FootageStream* ms) {
return data_path + "/" + hash + "w" + QString::number(ms->file_index);
QString PreviewGenerator::get_waveform_path(const QString& hash, const FootageStream& ms) {
return data_path + "/" + hash + "w" + QString::number(ms.file_index);
}
void PreviewGenerator::run() {
@@ -445,15 +454,15 @@ void PreviewGenerator::run() {
// save preview to file
for (int i=0;i<footage->video_tracks.size();i++) {
FootageStream* ms = footage->video_tracks.at(i);
ms->video_preview.save(get_thumbnail_path(hash, ms), "PNG");
FootageStream& ms = footage->video_tracks[i];
ms.video_preview.save(get_thumbnail_path(hash, ms), "PNG");
//dout << "saved" << ms->file_index << "thumbnail to" << get_thumbnail_path(hash, ms);
}
for (int i=0;i<footage->audio_tracks.size();i++) {
FootageStream* ms = footage->audio_tracks.at(i);
FootageStream& ms = footage->audio_tracks[i];
QFile f(get_waveform_path(hash, ms));
f.open(QFile::WriteOnly);
f.write(ms->audio_preview.constData(), ms->audio_preview.size());
f.write(ms.audio_preview.constData(), ms.audio_preview.size());
f.close();
//dout << "saved" << ms->file_index << "waveform to" << get_waveform_path(hash, ms);
}
+2 -2
View File
@@ -36,8 +36,8 @@ private:
bool replace;
bool cancelled;
QString data_path;
QString get_thumbnail_path(const QString &hash, FootageStream* ms);
QString get_waveform_path(const QString& hash, FootageStream* ms);
QString get_thumbnail_path(const QString &hash, const FootageStream &ms);
QString get_waveform_path(const QString& hash, const FootageStream &ms);
};
#endif // PREVIEWGENERATOR_H
-1
View File
@@ -1 +0,0 @@
olive.pro
@@ -3,7 +3,7 @@
<id>org.olivevideoeditor.Olive</id>
<name>Olive</name>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPLv3</project_license>
<project_license>GPL-3.0</project_license>
<developer_name>Olive Team</developer_name>
<summary>Non-linear video editor</summary>
<summary xml:lang="pt_BR">Editor de vídeo não-linear</summary>
@@ -15,9 +15,9 @@
<description xml:lang="ru"><p>Olive — свободный нелинейный видеоредактор, задуманный как полноценная замена закрытым коммерческим продуктам.</p></description>
<url type="homepage">https://www.olivevideoeditor.org</url>
<url type="donation">https://www.patreon.com/olivevideoeditor</url>
<url type="help">https://github.com/olive-editor/olive/issues</url>
<url type="bugtracker">https://github.com/olive-editor/olive/issues</url>
<screenshots>
<screenshot type="default"><image>http://images.libregraphicsworld.org/video/2018/12/introducing-olive/olive-alpha-main-window.jpg</image></screenshot>
<screenshot type="default"><image>https://olivevideoeditor.org/img/screenshot.jpg</image></screenshot>
</screenshots>
<content_rating type="oars-1.1" />
<releases>
@@ -3,5 +3,6 @@
<mime-type type="application/vnd.olive-project">
<comment>Olive project</comment>
<glob pattern="*.ove"/>
<icon name="org.olivevideoeditor.Olive"/>
</mime-type>
</mime-info>
+19 -19
View File
@@ -181,13 +181,13 @@ Sequence* create_sequence_from_media(QVector<Media*>& media_list) {
if (m->ready) {
if (!got_video_values) {
for (int j=0;j<m->video_tracks.size();j++) {
FootageStream* ms = m->video_tracks.at(j);
s->width = ms->video_width;
s->height = ms->video_height;
if (ms->video_frame_rate != 0) {
s->frame_rate = ms->video_frame_rate;
const FootageStream& ms = m->video_tracks.at(j);
s->width = ms.video_width;
s->height = ms.video_height;
if (ms.video_frame_rate != 0) {
s->frame_rate = ms.video_frame_rate;
if (ms->video_interlacing != VIDEO_PROGRESSIVE) s->frame_rate *= 2;
if (ms.video_interlacing != VIDEO_PROGRESSIVE) s->frame_rate *= 2;
// only break with a decent frame rate, otherwise there may be a better candidate
got_video_values = true;
@@ -197,8 +197,8 @@ Sequence* create_sequence_from_media(QVector<Media*>& media_list) {
}
if (!got_audio_values) {
for (int j=0;j<m->audio_tracks.size();j++) {
FootageStream* ms = m->audio_tracks.at(j);
s->audio_frequency = ms->audio_frequency;
const FootageStream& ms = m->audio_tracks.at(j);
s->audio_frequency = ms.audio_frequency;
got_audio_values = true;
break;
}
@@ -853,22 +853,22 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
stream.writeAttribute("in", QString::number(f->in));
stream.writeAttribute("out", QString::number(f->out));
for (int j=0;j<f->video_tracks.size();j++) {
FootageStream* ms = f->video_tracks.at(j);
const FootageStream& ms = f->video_tracks.at(j);
stream.writeStartElement("video");
stream.writeAttribute("id", QString::number(ms->file_index));
stream.writeAttribute("width", QString::number(ms->video_width));
stream.writeAttribute("height", QString::number(ms->video_height));
stream.writeAttribute("framerate", QString::number(ms->video_frame_rate, 'f', 10));
stream.writeAttribute("infinite", QString::number(ms->infinite_length));
stream.writeAttribute("id", QString::number(ms.file_index));
stream.writeAttribute("width", QString::number(ms.video_width));
stream.writeAttribute("height", QString::number(ms.video_height));
stream.writeAttribute("framerate", QString::number(ms.video_frame_rate, 'f', 10));
stream.writeAttribute("infinite", QString::number(ms.infinite_length));
stream.writeEndElement();
}
for (int j=0;j<f->audio_tracks.size();j++) {
FootageStream* ms = f->audio_tracks.at(j);
const FootageStream& ms = f->audio_tracks.at(j);
stream.writeStartElement("audio");
stream.writeAttribute("id", QString::number(ms->file_index));
stream.writeAttribute("channels", QString::number(ms->audio_channels));
stream.writeAttribute("layout", QString::number(ms->audio_layout));
stream.writeAttribute("frequency", QString::number(ms->audio_frequency));
stream.writeAttribute("id", QString::number(ms.file_index));
stream.writeAttribute("channels", QString::number(ms.audio_channels));
stream.writeAttribute("layout", QString::number(ms.audio_layout));
stream.writeAttribute("frequency", QString::number(ms.audio_frequency));
stream.writeEndElement();
}
stream.writeEndElement();
+14 -10
View File
@@ -184,7 +184,7 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
can_import = m->ready;
if (m->using_inout) {
double source_fr = 30;
if (m->video_tracks.size() > 0 && !qIsNull(m->video_tracks.at(0)->video_frame_rate)) source_fr = m->video_tracks.at(0)->video_frame_rate;
if (m->video_tracks.size() > 0 && !qIsNull(m->video_tracks.at(0).video_frame_rate)) source_fr = m->video_tracks.at(0).video_frame_rate;
default_clip_in = refactor_frame_number(m->in, source_fr, seq->frame_rate);
default_clip_out = refactor_frame_number(m->out, source_fr, seq->frame_rate);
}
@@ -216,7 +216,7 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
switch (medium->get_type()) {
case MEDIA_TYPE_FOOTAGE:
// is video source a still image?
if (m->video_tracks.size() > 0 && m->video_tracks[0]->infinite_length && m->audio_tracks.size() == 0) {
if (m->video_tracks.size() > 0 && m->video_tracks.at(0).infinite_length && m->audio_tracks.size() == 0) {
g.out = g.in + 100;
} else {
long length = m->get_length_in_frames(seq->frame_rate);
@@ -227,16 +227,20 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
}
for (int j=0;j<m->audio_tracks.size();j++) {
g.track = j;
g.media_stream = m->audio_tracks.at(j)->file_index;
ghosts.append(g);
audio_ghosts = true;
if (m->audio_tracks.at(j).enabled) {
g.track = j;
g.media_stream = m->audio_tracks.at(j).file_index;
ghosts.append(g);
audio_ghosts = true;
}
}
for (int j=0;j<m->video_tracks.size();j++) {
g.track = -1-j;
g.media_stream = m->video_tracks.at(j)->file_index;
ghosts.append(g);
video_ghosts = true;
if (m->video_tracks.at(j).enabled) {
g.track = -1-j;
g.media_stream = m->video_tracks.at(j).file_index;
ghosts.append(g);
video_ghosts = true;
}
}
break;
case MEDIA_TYPE_SEQUENCE:
+9 -9
View File
@@ -573,14 +573,14 @@ void Viewer::set_media(Media* m) {
seq->frame_rate = 30;
if (footage->video_tracks.size() > 0) {
FootageStream* video_stream = footage->video_tracks.at(0);
seq->width = video_stream->video_width;
seq->height = video_stream->video_height;
if (video_stream->video_frame_rate > 0 && !video_stream->infinite_length) seq->frame_rate = video_stream->video_frame_rate;
const FootageStream& video_stream = footage->video_tracks.at(0);
seq->width = video_stream.video_width;
seq->height = video_stream.video_height;
if (video_stream.video_frame_rate > 0 && !video_stream.infinite_length) seq->frame_rate = video_stream.video_frame_rate;
Clip* c = new Clip(seq);
c->media = media;
c->media_stream = video_stream->file_index;
c->media_stream = video_stream.file_index;
c->timeline_in = 0;
c->timeline_out = footage->get_length_in_frames(seq->frame_rate);
if (c->timeline_out <= 0) c->timeline_out = 150;
@@ -594,12 +594,12 @@ void Viewer::set_media(Media* m) {
}
if (footage->audio_tracks.size() > 0) {
FootageStream* audio_stream = footage->audio_tracks.at(0);
seq->audio_frequency = audio_stream->audio_frequency;
const FootageStream& audio_stream = footage->audio_tracks.at(0);
seq->audio_frequency = audio_stream.audio_frequency;
Clip* c = new Clip(seq);
c->media = media;
c->media_stream = audio_stream->file_index;
c->media_stream = audio_stream.file_index;
c->timeline_in = 0;
c->timeline_out = footage->get_length_in_frames(seq->frame_rate);
c->track = 0;
@@ -610,7 +610,7 @@ void Viewer::set_media(Media* m) {
if (footage->video_tracks.size() == 0) {
viewer_widget->waveform = true;
viewer_widget->waveform_clip = c;
viewer_widget->waveform_ms = audio_stream;
viewer_widget->waveform_ms = &audio_stream;
viewer_widget->update();
}
} else {
+6 -1
View File
@@ -8,6 +8,7 @@
#include "panels/timeline.h"
#include "panels/viewer.h"
#include "ui/audiomonitor.h"
#include "playback/playback.h"
#include "debug.h"
#include <QApplication>
@@ -106,9 +107,13 @@ void clear_audio_ibuffer() {
if (audio_thread != NULL) audio_thread->lock.unlock();
}
int current_audio_freq() {
return rendering ? sequence->audio_frequency : audio_output->format().sampleRate();
}
int get_buffer_offset_from_frame(double framerate, long frame) {
if (frame >= audio_ibuffer_frame) {
return qFloor(((double) (frame - audio_ibuffer_frame)/framerate)*audio_output->format().sampleRate())*av_get_bytes_per_sample(AV_SAMPLE_FMT_S16)*av_get_channel_layout_nb_channels(AV_CH_LAYOUT_STEREO);
return qFloor(((double) (frame - audio_ibuffer_frame)/framerate)*current_audio_freq())*av_get_bytes_per_sample(AV_SAMPLE_FMT_S16)*av_get_channel_layout_nb_channels(AV_CH_LAYOUT_STEREO);
} else {
dout << "[WARNING] Invalid values passed to get_buffer_offset_from_frame";
return 0;
+2
View File
@@ -43,6 +43,8 @@ extern double audio_ibuffer_timecode;
extern bool audio_scrub;
void clear_audio_ibuffer();
int current_audio_freq();
bool is_audio_device_set();
void init_audio();
+513 -513
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -116,11 +116,11 @@ double get_timecode(Clip* c, long playhead) {
void get_clip_frame(Clip* c, long playhead) {
if (c->finished_opening) {
FootageStream* ms = c->media->to_footage()->get_stream_from_file_index(c->track < 0, c->media_stream);
const FootageStream* ms = c->media->to_footage()->get_stream_from_file_index(c->track < 0, c->media_stream);
int64_t target_pts = qMax(static_cast<int64_t>(0), playhead_to_timestamp(c, playhead));
int64_t second_pts = qRound64(av_q2d(av_inv_q(c->stream->time_base)));
if (ms->video_interlacing != VIDEO_PROGRESSIVE) {
if (ms->video_interlacing != VIDEO_PROGRESSIVE) {
target_pts *= 2;
second_pts *= 2;
}
@@ -132,7 +132,7 @@ void get_clip_frame(Clip* c, long playhead) {
c->queue_lock.lock();
if (c->queue.size() > 0) {
if (ms->infinite_length) {
if (ms->infinite_length) {
target_frame = c->queue.at(0);
#ifdef GCF_DEBUG
dout << "GCF ==> USE PRECISE (INFINITE)";
+6 -6
View File
@@ -113,9 +113,9 @@ void Clip::refresh() {
Footage* m = media->to_footage();
if (track < 0 && m->video_tracks.size() > 0) {
media_stream = m->video_tracks.at(0)->file_index;
media_stream = m->video_tracks.at(0).file_index;
} else if (track >= 0 && m->audio_tracks.size() > 0) {
media_stream = m->audio_tracks.at(0)->file_index;
media_stream = m->audio_tracks.at(0).file_index;
}
}
replaced = false;
@@ -241,8 +241,8 @@ void Clip::recalculateMaxLength() {
case MEDIA_TYPE_FOOTAGE:
{
Footage* m = media->to_footage();
FootageStream* ms = m->get_stream_from_file_index(track < 0, media_stream);
if (ms != NULL && ms->infinite_length) {
const FootageStream* ms = m->get_stream_from_file_index(track < 0, media_stream);
if (ms != NULL && ms->infinite_length) {
calculated_length = LONG_MAX;
} else {
calculated_length = m->get_length_in_frames(fr);
@@ -269,7 +269,7 @@ int Clip::getWidth() {
switch (media->get_type()) {
case MEDIA_TYPE_FOOTAGE:
{
FootageStream* ms = media->to_footage()->get_stream_from_file_index(track < 0, media_stream);
const FootageStream* ms = media->to_footage()->get_stream_from_file_index(track < 0, media_stream);
if (ms != NULL) return ms->video_width;
if (sequence != NULL) return sequence->width;
}
@@ -287,7 +287,7 @@ int Clip::getHeight() {
switch (media->get_type()) {
case MEDIA_TYPE_FOOTAGE:
{
FootageStream* ms = media->to_footage()->get_stream_from_file_index(track < 0, media_stream);
const FootageStream* ms = media->to_footage()->get_stream_from_file_index(track < 0, media_stream);
if (ms != NULL) return ms->video_height;
if (sequence != NULL) return sequence->height;
}
+4 -10
View File
@@ -24,12 +24,6 @@ void Footage::reset() {
preview_gen->cancel();
preview_gen->wait();
}
for (int i=0;i<video_tracks.size();i++) {
delete video_tracks.at(i);
}
for (int i=0;i<audio_tracks.size();i++) {
delete audio_tracks.at(i);
}
video_tracks.clear();
audio_tracks.clear();
ready = false;
@@ -43,14 +37,14 @@ long Footage::get_length_in_frames(double frame_rate) {
FootageStream* Footage::get_stream_from_file_index(bool video, int index) {
if (video) {
for (int i=0;i<video_tracks.size();i++) {
if (video_tracks.at(i)->file_index == index) {
return video_tracks.at(i);
if (video_tracks.at(i).file_index == index) {
return &video_tracks[i];
}
}
} else {
for (int i=0;i<audio_tracks.size();i++) {
if (audio_tracks.at(i)->file_index == index) {
return audio_tracks.at(i);
if (audio_tracks.at(i).file_index == index) {
return &audio_tracks[i];
}
}
}
+4 -3
View File
@@ -29,6 +29,7 @@ struct FootageStream {
int audio_channels;
int audio_layout;
int audio_frequency;
bool enabled;
// preview thumbnail/waveform
bool preview_done;
@@ -45,8 +46,8 @@ struct Footage {
QString url;
QString name;
int64_t length;
QVector<FootageStream*> video_tracks;
QVector<FootageStream*> audio_tracks;
QVector<FootageStream> video_tracks;
QVector<FootageStream> audio_tracks;
int save_id;
bool ready;
bool invalid;
@@ -59,7 +60,7 @@ struct Footage {
long out;
long get_length_in_frames(double frame_rate);
FootageStream* get_stream_from_file_index(bool video, int index);
FootageStream *get_stream_from_file_index(bool video, int index);
void reset();
};
+17 -16
View File
@@ -104,21 +104,21 @@ void Media::update_tooltip(const QString& error) {
if (i > 0) {
tooltip += ", ";
}
tooltip += QString::number(f->video_tracks.at(i)->video_width) + "x" + QString::number(f->video_tracks.at(i)->video_height);
tooltip += QString::number(f->video_tracks.at(i).video_width) + "x" + QString::number(f->video_tracks.at(i).video_height);
}
tooltip += "\n";
if (!f->video_tracks.at(0)->infinite_length) {
if (!f->video_tracks.at(0).infinite_length) {
tooltip += "Frame Rate: ";
for (int i=0;i<f->video_tracks.size();i++) {
if (i > 0) {
tooltip += ", ";
}
if (f->video_tracks.at(i)->video_interlacing == VIDEO_PROGRESSIVE) {
tooltip += QString::number(f->video_tracks.at(i)->video_frame_rate);
if (f->video_tracks.at(i).video_interlacing == VIDEO_PROGRESSIVE) {
tooltip += QString::number(f->video_tracks.at(i).video_frame_rate);
} else {
tooltip += QString::number(f->video_tracks.at(i)->video_frame_rate * 2);
tooltip += " fields (" + QString::number(f->video_tracks.at(i)->video_frame_rate) + " frames)";
tooltip += QString::number(f->video_tracks.at(i).video_frame_rate * 2);
tooltip += " fields (" + QString::number(f->video_tracks.at(i).video_frame_rate) + " frames)";
}
}
tooltip += "\n";
@@ -129,7 +129,7 @@ void Media::update_tooltip(const QString& error) {
if (i > 0) {
tooltip += ", ";
}
tooltip += get_interlacing_name(f->video_tracks.at(i)->video_interlacing);
tooltip += get_interlacing_name(f->video_tracks.at(i).video_interlacing);
}
}
@@ -141,7 +141,7 @@ void Media::update_tooltip(const QString& error) {
if (i > 0) {
tooltip += ", ";
}
tooltip += QString::number(f->audio_tracks.at(i)->audio_frequency);
tooltip += QString::number(f->audio_tracks.at(i).audio_frequency);
}
tooltip += "\n";
@@ -150,7 +150,7 @@ void Media::update_tooltip(const QString& error) {
if (i > 0) {
tooltip += ", ";
}
tooltip += get_channel_layout_name(f->audio_tracks.at(i)->audio_channels, f->audio_tracks.at(i)->audio_layout);
tooltip += get_channel_layout_name(f->audio_tracks.at(i).audio_channels, f->audio_tracks.at(i).audio_layout);
}
// tooltip += "\n";
}
@@ -202,8 +202,8 @@ double Media::get_frame_rate(int stream) {
case MEDIA_TYPE_FOOTAGE:
{
Footage* f = to_footage();
if (stream < 0) return f->video_tracks.at(0)->video_frame_rate;
return f->get_stream_from_file_index(true, stream)->video_frame_rate;
if (stream < 0) return f->video_tracks.at(0).video_frame_rate;
return f->get_stream_from_file_index(true, stream)->video_frame_rate;
}
case MEDIA_TYPE_SEQUENCE: return to_sequence()->frame_rate;
}
@@ -215,8 +215,8 @@ int Media::get_sampling_rate(int stream) {
case MEDIA_TYPE_FOOTAGE:
{
Footage* f = to_footage();
if (stream < 0) return f->audio_tracks.at(0)->audio_frequency;
return to_footage()->get_stream_from_file_index(false, stream)->audio_frequency;
if (stream < 0) return f->audio_tracks.at(0).audio_frequency;
return to_footage()->get_stream_from_file_index(false, stream)->audio_frequency;
}
case MEDIA_TYPE_SEQUENCE: return to_sequence()->audio_frequency;
}
@@ -258,8 +258,8 @@ QVariant Media::data(int column, int role) {
if (get_type() == MEDIA_TYPE_FOOTAGE) {
Footage* f = to_footage();
if (f->video_tracks.size() > 0
&& f->video_tracks.at(0)->preview_done) {
return f->video_tracks.at(0)->video_preview_square;
&& f->video_tracks.at(0).preview_done) {
return f->video_tracks.at(0).video_preview_square;
}
}
@@ -279,7 +279,8 @@ QVariant Media::data(int column, int role) {
Footage* f = to_footage();
double r = 30;
if (f->video_tracks.size() > 0 && !qIsNull(f->video_tracks.at(0)->video_frame_rate)) r = f->video_tracks.at(0)->video_frame_rate;
if (f->video_tracks.size() > 0 && !qIsNull(f->video_tracks.at(0).video_frame_rate))
r = f->video_tracks.at(0).video_frame_rate;
long len = f->get_length_in_frames(r);
if (len > 0) return frame_to_timecode(len, config.timecode_view, r);
+1 -6
View File
@@ -1055,12 +1055,7 @@ void EditSequenceCommand::update() {
item->set_sequence(seq);
for (int i=0;i<seq->clips.size();i++) {
// TODO shift in/out/clipin points to match new frame rate
// BUT ALSO copy/paste must need a similar routine, no?
// See if one exists or if you have to make one, make it
// re-usable
seq->clips.at(i)->refresh();
if (seq->clips.at(i) != NULL) seq->clips.at(i)->refresh();
}
if (sequence == seq) {
+3 -3
View File
@@ -1272,9 +1272,9 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
Clip* c = NULL;
if (g.clip != -1) c = sequence->clips.at(g.clip);
FootageStream* ms = NULL;
const FootageStream* ms = NULL;
if (g.clip != -1 && c->media != NULL && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
ms = c->media->to_footage()->get_stream_from_file_index(c->track < 0, c->media_stream);
ms = c->media->to_footage()->get_stream_from_file_index(c->track < 0, c->media_stream);
}
// validate ghosts for trimming
@@ -2145,7 +2145,7 @@ int color_brightness(int r, int g, int b) {
return (0.2126*r + 0.7152*g + 0.0722*b);
}
void draw_waveform(Clip* clip, FootageStream* ms, long media_length, QPainter *p, const QRect& clip_rect, int waveform_start, int waveform_limit, double zoom) {
void draw_waveform(Clip* clip, const FootageStream* ms, long media_length, QPainter *p, const QRect& clip_rect, int waveform_start, int waveform_limit, double zoom) {
int divider = ms->audio_channels*2;
int channel_height = clip_rect.height()/ms->audio_channels;
+1 -1
View File
@@ -22,7 +22,7 @@ class QPainter;
class Media;
bool same_sign(int a, int b);
void draw_waveform(Clip* clip, FootageStream* ms, long media_length, QPainter* p, const QRect& clip_rect, int waveform_start, int waveform_limit, double zoom);
void draw_waveform(Clip* clip, const FootageStream *ms, long media_length, QPainter* p, const QRect& clip_rect, int waveform_start, int waveform_limit, double zoom);
class TimelineWidget : public QWidget {
Q_OBJECT
+1 -1
View File
@@ -485,7 +485,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
Footage* m = c->media->to_footage();
if (!m->invalid && !(c->track >= 0 && !is_audio_device_set())) {
if (m->ready) {
FootageStream* ms = m->get_stream_from_file_index(c->track < 0, c->media_stream);
const FootageStream* ms = m->get_stream_from_file_index(c->track < 0, c->media_stream);
if (ms != NULL && is_clip_active(c, playhead)) {
// if thread is already working, we don't want to touch this,
// but we also don't want to hang the UI thread
+1 -1
View File
@@ -34,7 +34,7 @@ public:
bool waveform;
Clip* waveform_clip;
FootageStream* waveform_ms;
const FootageStream* waveform_ms;
double waveform_zoom;
int waveform_scroll;