This commit is contained in:
itsmattkc
2019-01-24 22:42:05 +11:00
parent 58b1a4af18
commit cb3098e89d
12 changed files with 73 additions and 40 deletions
+8 -13
View File
@@ -45,10 +45,9 @@ Config::Config()
upcoming_queue_size(0.5),
upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS),
loop(true),
pause_at_out_point(true),
seek_also_selects(false),
effect_textbox_lines(3),
use_software_fallback(false)
effect_textbox_lines(3),
use_software_fallback(false)
{}
void Config::load(QString path) {
@@ -158,9 +157,6 @@ void Config::load(QString path) {
} else if (stream.name() == "Loop") {
stream.readNext();
loop = (stream.text() == "1");
} else if (stream.name() == "PauseAtOutPoint") {
stream.readNext();
pause_at_out_point = (stream.text() == "1");
} else if (stream.name() == "SeekAlsoSelects") {
stream.readNext();
seek_also_selects = (stream.text() == "1");
@@ -170,10 +166,10 @@ void Config::load(QString path) {
} else if (stream.name() == "EffectTextboxLines") {
stream.readNext();
effect_textbox_lines = stream.text().toInt();
} else if (stream.name() == "UseSoftwareFallback") {
stream.readNext();
use_software_fallback = (stream.text() == "1");
}
} else if (stream.name() == "UseSoftwareFallback") {
stream.readNext();
use_software_fallback = (stream.text() == "1");
}
}
}
if (stream.hasError()) {
@@ -230,11 +226,10 @@ void Config::save(QString path) {
stream.writeTextElement("UpcomingFrameQueueSize", QString::number(upcoming_queue_size));
stream.writeTextElement("UpcomingFrameQueueType", QString::number(upcoming_queue_type));
stream.writeTextElement("Loop", QString::number(loop));
stream.writeTextElement("PauseAtOutPoint", QString::number(pause_at_out_point));
stream.writeTextElement("SeekAlsoSelects", QString::number(seek_also_selects));
stream.writeTextElement("CSSPath", css_path);
stream.writeTextElement("EffectTextboxLines", QString::number(effect_textbox_lines));
stream.writeTextElement("UseSoftwareFallback", QString::number(use_software_fallback));
stream.writeTextElement("EffectTextboxLines", QString::number(effect_textbox_lines));
stream.writeTextElement("UseSoftwareFallback", QString::number(use_software_fallback));
stream.writeEndElement(); // configuration
stream.writeEndDocument(); // doc
-1
View File
@@ -59,7 +59,6 @@ struct Config {
double upcoming_queue_size;
int upcoming_queue_type;
bool loop;
bool pause_at_out_point;
bool seek_also_selects;
QString css_path;
int effect_textbox_lines;
+11 -5
View File
@@ -735,6 +735,7 @@ void MainWindow::setup_menus() {
playback_menu->addAction(tr("Go to Start"), this, SLOT(go_to_start()), QKeySequence("Home"))->setProperty("id", "gotostart");
playback_menu->addAction(tr("Previous Frame"), this, SLOT(prev_frame()), QKeySequence("Left"))->setProperty("id", "prevframe");
playback_menu->addAction(tr("Play/Pause"), this, SLOT(playpause()), QKeySequence("Space"))->setProperty("id", "playpause");
playback_menu->addAction(tr("Play In to Out"), this, SLOT(play_in_to_out()), QKeySequence("Shift+Space"))->setProperty("id", "playintoout");
playback_menu->addAction(tr("Next Frame"), this, SLOT(next_frame()), QKeySequence("Right"))->setProperty("id", "nextframe");
playback_menu->addAction(tr("Go to End"), this, SLOT(go_to_end()), QKeySequence("End"))->setProperty("id", "gotoend");
playback_menu->addSeparator();
@@ -747,6 +748,7 @@ void MainWindow::setup_menus() {
playback_menu->addAction(tr("Decrease Speed"), this, SLOT(decrease_speed()), QKeySequence("J"))->setProperty("id", "decspeed");
playback_menu->addAction(tr("Pause"), this, SLOT(pause()), QKeySequence("K"))->setProperty("id", "pause");
playback_menu->addAction(tr("Increase Speed"), this, SLOT(increase_speed()), QKeySequence("L"))->setProperty("id", "incspeed");
playback_menu->addSeparator();
loop_action = playback_menu->addAction(tr("Loop"), this, SLOT(toggle_bool_action()));
loop_action->setProperty("id", "loop");
@@ -911,11 +913,6 @@ void MainWindow::setup_menus() {
set_name_and_marker->setCheckable(true);
set_name_and_marker->setData(reinterpret_cast<quintptr>(&config.set_name_with_marker));
pause_at_out_point_action = tools_menu->addAction(tr("Pause At Out Point"), this, SLOT(toggle_bool_action()));
pause_at_out_point_action->setProperty("id", "pauseoutpoint");
pause_at_out_point_action->setCheckable(true);
pause_at_out_point_action->setData(reinterpret_cast<quintptr>(&config.pause_at_out_point));
tools_menu->addSeparator();
no_autoscroll = tools_menu->addAction(tr("No Auto-Scroll"), this, SLOT(set_autoscroll()));
@@ -1109,6 +1106,15 @@ void MainWindow::prev_frame() {
}
}
void MainWindow::play_in_to_out() {
QDockWidget* focused_panel = get_focused_panel();
if (focused_panel == panel_footage_viewer) {
panel_footage_viewer->play(true);
} else {
panel_sequence_viewer->play(true);
}
}
void MainWindow::next_frame() {
QDockWidget* focused_panel = get_focused_panel();
if (focused_panel == panel_footage_viewer) {
+1
View File
@@ -66,6 +66,7 @@ private slots:
void go_to_out();
void go_to_start();
void prev_frame();
void play_in_to_out();
void playpause();
void pause();
void increase_speed();
+40 -19
View File
@@ -248,7 +248,11 @@ bool frame_rate_is_droppable(float rate) {
void Viewer::seek(long p) {
pause();
seq->playhead = p;
if (main_sequence) {
seq->playhead = p;
} else {
seq->playhead = qMin(seq->getEndFrame(), qMax(0L, p));
}
bool update_fx = false;
if (main_sequence) {
panel_timeline->scroll_to_frame(p);
@@ -346,15 +350,24 @@ void Viewer::decrease_speed() {
set_playback_speed(new_speed);
}
void Viewer::play() {
void Viewer::play(bool in_to_out) {
if (panel_sequence_viewer->playing) panel_sequence_viewer->pause();
if (panel_footage_viewer->playing) panel_footage_viewer->pause();
playing_in_to_out = in_to_out;
if (seq != nullptr) {
if (playing_in_to_out) {
uncue_recording();
}
bool seek_to_in = (seq->using_workarea && config.loop);
if (!is_recording_cued()
&& seq->playhead >= get_seq_out()
&& (config.loop || !main_sequence)) {
seek(get_seq_in());
&& (playing_in_to_out
|| seq->playhead >= seq->getEndFrame()
|| (seek_to_in && seq->playhead >= seq->workarea_out))) {
seek(seek_to_in ? seq->workarea_in : 0);
}
if (playback_speed == 0) {
@@ -371,6 +384,9 @@ void Viewer::play() {
just_played = true;
set_playpause_icon(false);
start_msecs = QDateTime::currentMSecsSinceEpoch();
qDebug() << "play called";
timer_update();
}
}
@@ -559,13 +575,13 @@ void Viewer::set_playback_speed(int s) {
}
long Viewer::get_seq_in() {
return (seq->using_workarea && seq->enable_workarea)
return ((config.loop || playing_in_to_out) && seq->using_workarea && seq->enable_workarea)
? seq->workarea_in
: 0;
}
long Viewer::get_seq_out() {
return (seq->using_workarea && seq->enable_workarea && previous_playhead < seq->workarea_out)
return ((config.loop || playing_in_to_out) && seq->using_workarea && seq->enable_workarea && previous_playhead < seq->workarea_out)
? seq->workarea_out
: seq->getEndFrame();
}
@@ -756,19 +772,24 @@ void Viewer::timer_update() {
if (config.seek_also_selects) panel_timeline->select_from_playhead();
update_parents(config.seek_also_selects);
long end_frame = get_seq_out();
if (!recording
&& playing
&& seq->playhead >= end_frame
&& previous_playhead < end_frame) {
if (!config.pause_at_out_point && config.loop) {
seek(get_seq_in());
play();
} else if (config.pause_at_out_point || !main_sequence) {
pause();
if (playing) {
if (recording) {
if (recording_start != recording_end && seq->playhead >= recording_end) {
pause();
}
} else {
if (seq->playhead >= seq->getEndFrame()) {
pause();
}
if (seq->using_workarea && seq->playhead >= seq->workarea_out) {
if (config.loop) {
// loop
play();
} else if (playing_in_to_out) {
pause();
}
}
}
} else if (recording && recording_start != recording_end && seq->playhead >= recording_end) {
pause();
}
}
+2 -1
View File
@@ -49,7 +49,7 @@ public:
// playback functions
void seek(long p);
void play();
void play(bool in_to_out = false);
void pause();
bool playing;
long playhead_start;
@@ -104,6 +104,7 @@ private:
long cached_end_frame;
QString panel_name;
double minimum_zoom;
bool playing_in_to_out;
void set_zoom_value(double d);
void set_sb_max();
void set_playback_speed(int s);
+4 -1
View File
@@ -436,6 +436,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests, int play
}
}
qDebug() << "hello?";
QMetaObject::invokeMethod(panel_footage_viewer, "play_wake", Qt::QueuedConnection);
QMetaObject::invokeMethod(panel_sequence_viewer, "play_wake", Qt::QueuedConnection);
}
@@ -961,11 +962,13 @@ void Cacher::run() {
clip->open = true;
caching = true;
interrupt = false;
queued = false;
open_clip_worker(clip);
while (caching) {
clip->can_cache.wait(&clip->lock);
if (!queued) clip->can_cache.wait(&clip->lock);
queued = false;
if (!caching) {
break;
} else {
+1
View File
@@ -20,6 +20,7 @@ public:
bool reset;
bool scrubbing;
bool interrupt;
bool queued;
int playback_speed;
QVector<Clip*> nests;
+1
View File
@@ -113,6 +113,7 @@ void cache_clip(Clip* clip, long playhead, bool reset, bool scrubbing, QVector<C
clip->cacher->nests = nests;
clip->cacher->scrubbing = scrubbing;
clip->cacher->playback_speed = playback_speed;
clip->cacher->queued = true;
if (reset && clip->queue.size() > 0) clip->cacher->interrupt = true;
clip->can_cache.wakeAll();
+3
View File
@@ -438,6 +438,8 @@ GLuint compose_sequence(Viewer* viewer,
motion_blur_prog++;*/
}
} else {
qDebug() << "ra loc";
if (render_audio || (config.enable_audio_scrubbing && audio_scrub && seq->playhead > c->timeline_in)) {
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_SEQUENCE) {
nests.append(c);
@@ -486,6 +488,7 @@ GLuint compose_sequence(Viewer* viewer,
}
void compose_audio(Viewer* viewer, Sequence* seq, bool render_audio, int playback_speed) {
qDebug() << "ca called";
QVector<Clip*> nests;
bool texture_failed;
compose_sequence(viewer, nullptr, seq, nests, false, render_audio, nullptr, texture_failed, audio_rendering, playback_speed);
+1
View File
@@ -160,6 +160,7 @@ void RenderThread::start_render(QOpenGLContext *share, Sequence *s, const QStrin
pixel_buffer = pixels;
queued = true;
waitCond.wakeAll();
}
+1
View File
@@ -218,6 +218,7 @@ void ViewerWidget::initializeGL() {
}
void ViewerWidget::frame_update() {
qDebug() << "frame update called";
if (viewer->seq != nullptr) {
bool render_audio = (viewer->playing || audio_rendering);