exporting complete
This commit is contained in:
+21
-2
@@ -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);
|
||||
|
||||
+17
-8
@@ -206,16 +206,14 @@ GLuint compose_sequence(Viewer* viewer,
|
||||
|
||||
int half_width = s->width/2;
|
||||
int half_height = s->height/2;
|
||||
if (rendering || !nests.isEmpty()) half_height = -half_height; // invert vertical
|
||||
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(-half_width, half_width, half_height, -half_height, -1, 10);
|
||||
if (video) {
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(-half_width, half_width, -half_height, half_height, -1, 10);
|
||||
}
|
||||
|
||||
for (int i=0;i<current_clips.size();i++) {
|
||||
ctx->functions()->GL_DEFAULT_BLEND;
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
Clip* c = current_clips.at(i);
|
||||
|
||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE && !c->finished_opening) {
|
||||
@@ -223,6 +221,9 @@ GLuint compose_sequence(Viewer* viewer,
|
||||
texture_failed = true;
|
||||
} else {
|
||||
if (c->track < 0) {
|
||||
ctx->functions()->GL_DEFAULT_BLEND;
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
GLuint textureID = 0;
|
||||
int video_width = c->getWidth();
|
||||
int video_height = c->getHeight();
|
||||
@@ -488,7 +489,9 @@ GLuint compose_sequence(Viewer* viewer,
|
||||
viewer->play_wake();
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
if (video) {
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
if (!nests.isEmpty() && nests.last()->fbo != nullptr) {
|
||||
// returns nested clip's texture
|
||||
@@ -497,3 +500,9 @@ GLuint compose_sequence(Viewer* viewer,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void compose_audio(Viewer* viewer, Sequence* seq, bool render_audio) {
|
||||
QVector<Clip*> nests;
|
||||
bool texture_failed;
|
||||
compose_sequence(viewer, nullptr, seq, nests, false, render_audio, nullptr, texture_failed, audio_rendering);
|
||||
}
|
||||
|
||||
@@ -19,4 +19,6 @@ GLuint compose_sequence(Viewer* viewer,
|
||||
bool &texture_failed,
|
||||
bool rendering);
|
||||
|
||||
void compose_audio(Viewer* viewer, Sequence* seq, bool render_audio);
|
||||
|
||||
#endif // RENDERFUNCTIONS_H
|
||||
|
||||
+2
-5
@@ -223,9 +223,7 @@ void ViewerWidget::frame_update() {
|
||||
renderer->start_render(context(), viewer->seq);
|
||||
|
||||
// render the audio
|
||||
QVector<Clip*> nests;
|
||||
bool texture_failed;
|
||||
compose_sequence(viewer, context(), viewer->seq, nests, false, render_audio, &gizmos, texture_failed, audio_rendering);
|
||||
compose_audio(viewer, viewer->seq, render_audio);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,9 +443,8 @@ void ViewerWidget::paintGL() {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
// set screen coords to widget size
|
||||
|
||||
glLoadIdentity();
|
||||
glOrtho(0, 1, 1, 0, -1, 1);
|
||||
glOrtho(0, 1, 0, 1, -1, 1);
|
||||
|
||||
// draw texture from render thread
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ void ViewerWindow::paintGL() {
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
|
||||
glLoadIdentity();
|
||||
glOrtho(0, 1, 1, 0, -1, 1);
|
||||
glOrtho(0, 1, 0, 1, -1, 1);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user