exporting complete

This commit is contained in:
itsmattkc
2019-01-17 09:42:30 +11:00
parent 6a98e33959
commit 37ceca48da
5 changed files with 43 additions and 16 deletions
+21 -2
View File
@@ -7,6 +7,7 @@
#include "panels/viewer.h"
#include "ui/viewerwidget.h"
#include "ui/renderthread.h"
#include "ui/renderfunctions.h"
#include "playback/playback.h"
#include "playback/audio.h"
#include "dialogs/exportdialog.h"
@@ -349,9 +350,26 @@ void ExportThread::run() {
while (sequence->playhead <= end_frame && continueEncode) {
start_time = QDateTime::currentMSecsSinceEpoch();
renderer->start_render(nullptr, sequence, nullptr, video_frame->data[0]);
waitCond.wait(&mutex);
if (audio_enabled) {
compose_audio(nullptr, sequence, true);
}
if (video_enabled) {
do {
renderer->start_render(nullptr, sequence, nullptr, video_frame->data[0]);
waitCond.wait(&mutex);
} while (renderer->did_texture_fail());
}
/*if (sequence->playhead == start_frame) {
// render first frame
if (video_enabled) {
qDebug() << "FIRST FRAME start video thread";
renderer->start_render(nullptr, sequence, nullptr, video_frame->data[0]);
}
sequence->playhead++;
}*/
// encode last frame while rendering next frame
double timecode_secs = (double) (sequence->playhead-start_frame) / sequence->frame_rate;
if (video_enabled) {
// change pixel format
@@ -364,6 +382,7 @@ void ExportThread::run() {
if (audio_enabled) {
// do we need to encode more audio samples?
while (continueEncode && file_audio_samples <= (timecode_secs*audio_sampling_rate)) {
// copy samples from audio buffer to AVFrame
int adjusted_read = audio_ibuffer_read%audio_ibuffer_size;
int copylen = qMin(aframe_bytes, audio_ibuffer_size-adjusted_read);
memcpy(audio_frame->data[0], audio_ibuffer+adjusted_read, copylen);