fixed crashes when exporting only video or only audio

This commit is contained in:
itsmattkc
2018-11-06 23:04:03 +11:00
parent 11d10ef329
commit 800ce6baad
5 changed files with 14 additions and 11 deletions
+3
View File
@@ -435,6 +435,9 @@ void ExportDialog::on_pushButton_clicked() {
case FORMAT_MOV:
ext = "mov";
break;
case FORMAT_WAV:
ext = "wav";
break;
case FORMAT_WEBM:
ext = "webm";
break;
+4
View File
@@ -253,6 +253,10 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
// set up UI from effect file
container->setText(em->name);
if (em->type == EFFECT_TYPE_TRANSITION) {
add_row("Length:")->add_field(EFFECT_FIELD_DOUBLE);
}
if (!em->filename.isEmpty()) {
QFile effect_file(get_effects_dir() + "/" + em->filename);
if (effect_file.open(QFile::ReadOnly)) {
+4 -4
View File
@@ -322,9 +322,9 @@ void ExportThread::run() {
continueEncode = setupContainer();
if (continueEncode) continueEncode = setupVideo();
if (video_enabled && continueEncode) continueEncode = setupVideo();
if (continueEncode) continueEncode = setupAudio();
if (audio_enabled && continueEncode) continueEncode = setupAudio();
if (continueEncode) {
ret = avformat_write_header(fmt_ctx, NULL);
@@ -412,8 +412,8 @@ void ExportThread::run() {
if (continueEncode) {
// flush remaining packets
while (continueVideo && continueAudio) {
if (continueVideo) continueVideo = encode(fmt_ctx, vcodec_ctx, NULL, &video_pkt, video_stream);
if (continueAudio) continueAudio = encode(fmt_ctx, acodec_ctx, NULL, &audio_pkt, audio_stream);
if (continueVideo && video_enabled) continueVideo = encode(fmt_ctx, vcodec_ctx, NULL, &video_pkt, video_stream);
if (continueAudio && audio_enabled) continueAudio = encode(fmt_ctx, acodec_ctx, NULL, &audio_pkt, audio_stream);
}
ret = av_write_trailer(fmt_ctx);
+2 -5
View File
@@ -10,7 +10,7 @@ extern "C" {
#include "project/clip.h"
Media::Media() : ready(false), preview_gen(NULL), throbber(NULL) {
Media::Media() : ready(false), preview_gen(NULL) {
ready_lock.lock();
}
@@ -22,10 +22,7 @@ void Media::reset() {
if (preview_gen != NULL) {
preview_gen->cancel();
preview_gen->wait();
}
if (throbber != NULL) {
delete throbber;
}
}
for (int i=0;i<video_tracks.size();i++) {
delete video_tracks.at(i);
}
+1 -2
View File
@@ -53,8 +53,7 @@ struct Media {
int save_id;
bool ready;
PreviewGenerator* preview_gen;
MediaThrobber* throbber;
PreviewGenerator* preview_gen;
QMutex ready_lock;
bool using_inout;