diff --git a/dialogs/exportdialog.cpp b/dialogs/exportdialog.cpp index bd54cd5b0..b8fec27b4 100644 --- a/dialogs/exportdialog.cpp +++ b/dialogs/exportdialog.cpp @@ -15,6 +15,7 @@ #include "project/sequence.h" #include "io/exportthread.h" #include "playback/playback.h" +#include "mainwindow.h" extern "C" { #include @@ -477,6 +478,8 @@ void ExportDialog::on_pushButton_clicked() { closeActiveClips(sequence, true); + mainWindow->autorecover_interval(); + rendering = true; panel_sequence_viewer->viewer_widget->context()->doneCurrent(); panel_sequence_viewer->viewer_widget->context()->moveToThread(et); diff --git a/io/exportthread.cpp b/io/exportthread.cpp index 6c5c6ef61..4024214db 100644 --- a/io/exportthread.cpp +++ b/io/exportthread.cpp @@ -124,7 +124,7 @@ bool ExportThread::setupVideo() { /*char buffer[50]; itoa(vcodec_ctx, buffer, 10);*/ - av_opt_set(vcodec_ctx->priv_data, "preset", "slow", AV_OPT_SEARCH_CHILDREN); +// av_opt_set(vcodec_ctx->priv_data, "preset", "slow", AV_OPT_SEARCH_CHILDREN); switch (video_compression_type) { case COMPRESSION_TYPE_CFR: @@ -358,7 +358,9 @@ void ExportThread::run() { sws_frame->pts = round(timecode_secs/av_q2d(video_stream->time_base)); // send to encoder +// dout << "starting encode of video frame" << sequence->playhead; if (!encode(fmt_ctx, vcodec_ctx, sws_frame, &video_pkt, video_stream)) continueEncode = false; +// dout << "completed encode of video frame" << sequence->playhead; } if (audio_enabled) { // do we need to encode more audio samples? @@ -381,8 +383,8 @@ void ExportThread::run() { swr_convert_frame(swr_ctx, swr_frame, audio_frame); swr_frame->pts = file_audio_samples; - // send to encoder - if (!encode(fmt_ctx, acodec_ctx, swr_frame, &audio_pkt, audio_stream)) continueEncode = false; + // send to encoder + if (!encode(fmt_ctx, acodec_ctx, swr_frame, &audio_pkt, audio_stream)) continueEncode = false; file_audio_samples += swr_frame->nb_samples; } diff --git a/mainwindow.cpp b/mainwindow.cpp index c04e467be..b2a3005df 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -418,7 +418,7 @@ void MainWindow::on_actionSplit_at_Playhead_triggered() } void MainWindow::autorecover_interval() { - if (isWindowModified()) { + if (!rendering && isWindowModified()) { panel_project->save_project(true); dout << "[INFO] Auto-recovery project saved"; } diff --git a/mainwindow.h b/mainwindow.h index 6d9cec2c4..18e2fd455 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -28,6 +28,7 @@ public slots: void cut(); void copy(); void paste(); + void autorecover_interval(); void on_actionNest_triggered(); protected: @@ -105,8 +106,6 @@ private slots: void on_actionGo_to_Next_Cut_triggered(); - void autorecover_interval(); - void on_actionPreferences_triggered(); void on_actionIncrease_Track_Height_triggered(); diff --git a/panels/project.cpp b/panels/project.cpp index cb95e69a1..1b124b08d 100644 --- a/panels/project.cpp +++ b/panels/project.cpp @@ -337,6 +337,10 @@ void Project::delete_selected_media() { bool remove = true; bool redraw = false; + // correctly sort (fixes qt bug - see AddMediaCommand::redo() for info) + source_table->setSortingEnabled(false); + source_table->setSortingEnabled(true); + // check if media is in use QVector parents; QList sequence_items; @@ -993,6 +997,7 @@ bool Project::load_worker(QFile& f, QXmlStreamReader& stream, int type) { if (!QFileInfo::exists(m->url)) { // if path is not absolute QString proj_dir_test = proj_dir.absoluteFilePath(m->url); QString internal_proj_dir_test = internal_proj_dir.absoluteFilePath(m->url); + if (QFileInfo::exists(proj_dir_test)) { // if path is relative to the project's current dir m->url = proj_dir_test; dout << "[INFO] Matched" << attr.value().toString() << "relative to project's current directory"; diff --git a/panels/viewer.cpp b/panels/viewer.cpp index d6d14380d..9a589b894 100644 --- a/panels/viewer.cpp +++ b/panels/viewer.cpp @@ -319,7 +319,7 @@ void Viewer::play_wake() { if (just_played) { start_msecs = QDateTime::currentMSecsSinceEpoch(); playback_updater.start(); - audio_thread->notifyReceiver(); + if (audio_thread != NULL) audio_thread->notifyReceiver(); just_played = false; } } diff --git a/playback/audio.cpp b/playback/audio.cpp index bc91d8694..bdfb4cb90 100644 --- a/playback/audio.cpp +++ b/playback/audio.cpp @@ -54,7 +54,7 @@ void init_audio(Sequence* s) { audio_format = info.nearestFormat(audio_format); } - audio_output = new QAudioOutput(audio_format); + audio_output = new QAudioOutput(info, audio_format); audio_output->setNotifyInterval(5); // connect @@ -62,9 +62,9 @@ void init_audio(Sequence* s) { audio_device_set = true; // start sender thread - audio_thread = new AudioSenderThread(); - QObject::connect(audio_output, SIGNAL(notify()), audio_thread, SLOT(notifyReceiver())); - audio_thread->start(QThread::TimeCriticalPriority); + audio_thread = new AudioSenderThread(); + QObject::connect(audio_output, SIGNAL(notify()), audio_thread, SLOT(notifyReceiver())); + audio_thread->start(QThread::TimeCriticalPriority); clear_audio_ibuffer(); } diff --git a/playback/cacher.cpp b/playback/cacher.cpp index eda419f39..814624595 100644 --- a/playback/cacher.cpp +++ b/playback/cacher.cpp @@ -390,7 +390,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector& nests) { audio_write_lock.unlock(); if (scrubbing) { - audio_thread->notifyReceiver(); + if (audio_thread != NULL) audio_thread->notifyReceiver(); } if (c->frame_sample_index == nb_bytes) { diff --git a/project/undo.cpp b/project/undo.cpp index ce6b856cf..9010404fd 100644 --- a/project/undo.cpp +++ b/project/undo.cpp @@ -415,6 +415,10 @@ void AddMediaCommand::redo() { * * The following 2 lines seem to force the source_table to re-sort * correctly and therefore works around this problem. But holy shit. + * + * I guess I'm "supposed" to use a Model–view–viewmodel instead, + * which I'll probably have to switch to soon anyway. So perhaps + * this will be a non-issue soon. */ panel_project->source_table->setSortingEnabled(false); panel_project->source_table->setSortingEnabled(true);