finalized media frame rate change

This commit is contained in:
itsmattkc
2019-01-06 20:26:10 +11:00
parent 320d08cc97
commit a70feb5b0b
6 changed files with 64 additions and 6 deletions
+20
View File
@@ -8,6 +8,7 @@
#include <QTreeWidgetItem>
#include <QGroupBox>
#include <QListWidget>
#include <QSpinBox>
#include "project/footage.h"
#include "project/media.h"
@@ -52,6 +53,16 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
row++;
if (f->video_tracks.size() > 0) {
// frame conforming
grid->addWidget(new QLabel("Conform to Frame Rate:"), row, 0);
conform_fr = new QDoubleSpinBox();
conform_fr->setMinimum(0.01);
conform_fr->setValue(f->video_tracks.at(0).video_frame_rate * f->speed);
grid->addWidget(conform_fr, row, 1);
row++;
// deinterlacing mode
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));
@@ -109,6 +120,8 @@ void MediaPropertiesDialog::accept() {
}
}
bool refresh_clips = false;
// set interlacing
if (f->video_tracks.size() > 0) {
if (interlacing_box->currentIndex() > 0) {
@@ -116,6 +129,12 @@ void MediaPropertiesDialog::accept() {
} else {
ca->append(new SetInt(&f->video_tracks[0].video_interlacing, f->video_tracks.at(0).video_auto_interlacing));
}
// set frame rate conform
if (!qFuzzyCompare(conform_fr->value(), f->video_tracks.at(0).video_frame_rate)) {
ca->append(new SetDouble(&f->speed, f->speed, conform_fr->value()/f->video_tracks.at(0).video_frame_rate));
refresh_clips = true;
}
}
// set name
@@ -124,6 +143,7 @@ void MediaPropertiesDialog::accept() {
ca->append(mr);
ca->appendPost(new CloseAllClipsCommand());
ca->appendPost(new UpdateFootageTooltip(item));
if (refresh_clips) ca->appendPost(new RefreshClips(item));
undo_stack.push(ca);
+7 -5
View File
@@ -8,18 +8,20 @@ class QComboBox;
class QLineEdit;
class Media;
class QListWidget;
class QDoubleSpinBox;
class MediaPropertiesDialog : public QDialog {
Q_OBJECT
public:
MediaPropertiesDialog(QWidget *parent, Media* i);
MediaPropertiesDialog(QWidget *parent, Media* i);
private:
QComboBox* interlacing_box;
QLineEdit* name_box;
Media* item;
QListWidget* track_list;
QLineEdit* name_box;
Media* item;
QListWidget* track_list;
QDoubleSpinBox* conform_fr;
private slots:
void accept();
void accept();
};
#endif // MEDIAPROPERTIESDIALOG_H
+1 -1
View File
@@ -331,7 +331,7 @@ void ExportThread::run() {
qint64 start_time, frame_time, avg_time, eta, total_time = 0;
long remaining_frames, frame_count = 1;
while (sequence->playhead < end_frame && continueEncode) {
while (sequence->playhead <= end_frame && continueEncode) {
start_time = QDateTime::currentMSecsSinceEpoch();
panel_sequence_viewer->viewer_widget->paintGL();
+23
View File
@@ -1244,3 +1244,26 @@ void SetKeyframing::undo() {
void SetKeyframing::redo() {
row->setKeyframing(b);
}
RefreshClips::RefreshClips(Media *m) :
media(m)
{}
void RefreshClips::undo() {
redo();
}
void RefreshClips::redo() {
// close any clips currently using this media
QVector<Media*> all_sequences = panel_project->list_all_project_sequences();
for (int i=0;i<all_sequences.size();i++) {
Sequence* s = all_sequences.at(i)->to_sequence();
for (int j=0;j<s->clips.size();j++) {
Clip* c = s->clips.at(j);
if (c != NULL && c->media == media) {
c->replaced = true;
c->refresh();
}
}
}
}
+9
View File
@@ -633,4 +633,13 @@ private:
bool b;
};
class RefreshClips : public QUndoCommand {
public:
RefreshClips(Media* m);
void undo();
void redo();
private:
Media* media;
};
#endif // UNDO_H
+4
View File
@@ -2347,6 +2347,10 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
p.drawImage(QRect(thumb_x, clip_rect.y()+thumb_y, thumb_clip_width, thumb_height), ms->video_preview, QRect(0, 0, thumb_clip_width*((double)ms->video_preview.width()/(double)thumb_width), ms->video_preview.height()));
}
}
if (clip->timeline_out - clip->timeline_in + clip->clip_in > clip->getMaximumLength()) {
draw_checkerboard = true;
checkerboard_rect.setLeft(panel_timeline->getTimelineScreenPointFromFrame(clip->getMaximumLength() + clip->timeline_in - clip->clip_in));
}
} else if (clip_rect.height() > TRACK_MIN_HEIGHT) {
// draw waveform
p.setPen(QColor(80, 80, 80));