added proper timecodes in the timeline

This commit is contained in:
itsmattkc
2018-09-12 21:34:43 +10:00
parent 706238590b
commit ac9233fade
10 changed files with 107 additions and 70 deletions
+10 -3
View File
@@ -17,7 +17,8 @@ Config::Config()
select_also_seeks(false),
paste_seeks(true),
rectified_waveforms(false),
default_transition_length(30)
default_transition_length(30),
timecode_view(TIMECODE_DROP)
{
}
@@ -55,10 +56,15 @@ void Config::load(QString path) {
stream.readNext();
img_seq_formats = stream.text().toString();
} else if (stream.name() == "RectifiedWaveforms") {
stream.readNext();
rectified_waveforms = (stream.text() == "1");
} else if (stream.name() == "DefaultTransitionLength") {
rectified_waveforms = stream.text().toInt();
}
stream.readNext();
default_transition_length = stream.text().toInt();
} else if (stream.name() == "TimecodeView") {
stream.readNext();
timecode_view = stream.text().toInt();
}
}
}
if (stream.hasError()) {
@@ -114,6 +120,7 @@ void Config::save(QString path) {
stream.writeTextElement("ImageSequenceFormats", img_seq_formats);
stream.writeTextElement("RectifiedWaveforms", QString::number(rectified_waveforms));
stream.writeTextElement("DefaultTransitionLength", QString::number(default_transition_length));
stream.writeTextElement("TimecodeView", QString::number(timecode_view));
stream.writeEndElement();
stream.writeEndDocument(); // doc
+5
View File
@@ -5,6 +5,10 @@
#define SAVE_VERSION "180820" // YYMMDD
#define TIMECODE_DROP 0
#define TIMECODE_NONDROP 1
#define TIMECODE_FRAMES 2
struct Config {
Config();
bool saved_layout;
@@ -17,6 +21,7 @@ struct Config {
QString img_seq_formats;
bool rectified_waveforms;
int default_transition_length;
int timecode_view;
void load(QString path);
void save(QString path);
+2 -1
View File
@@ -2,6 +2,7 @@
#include "media.h"
#include "panels/viewer.h"
#include "io/config.h"
#include <QPainter>
#include <QPixmap>
@@ -90,7 +91,7 @@ void PreviewGenerator::finalize_media() {
if (!contains_still_image || media->audio_tracks.size() > 0) {
double frame_rate = 30;
if (!contains_still_image && media->video_tracks.size() > 0) frame_rate = media->video_tracks.at(0)->video_frame_rate;
item->setText(1, frame_to_timecode(media->get_length_in_frames(frame_rate), TIMECODE_DROP, frame_rate));
item->setText(1, frame_to_timecode(media->get_length_in_frames(frame_rate), config.timecode_view, frame_rate));
}
}