scroll to item and export improvements

This commit is contained in:
itsmattkc
2019-01-08 09:10:09 +11:00
parent 6270b9911a
commit d51ce537ae
5 changed files with 48 additions and 22 deletions
+4 -4
View File
@@ -88,9 +88,9 @@ void ActionSearch::perform_action() {
void ActionSearch::move_selection_up() {
int lim = list_widget->count();
for (int i=1;i<lim;i++) {
if (list_widget->item(i)->isSelected()) {
// list_widget->item(i)->setSelected(false);
if (list_widget->item(i)->isSelected()) {
list_widget->item(i-1)->setSelected(true);
list_widget->scrollToItem(list_widget->item(i-1));
break;
}
}
@@ -99,9 +99,9 @@ void ActionSearch::move_selection_up() {
void ActionSearch::move_selection_down() {
int lim = list_widget->count()-1;
for (int i=0;i<lim;i++) {
if (list_widget->item(i)->isSelected()) {
// list_widget->item(i)->setSelected(false);
if (list_widget->item(i)->isSelected()) {
list_widget->item(i+1)->setSelected(true);
list_widget->scrollToItem(list_widget->item(i+1));
break;
}
}
+35 -13
View File
@@ -26,6 +26,23 @@ extern "C" {
ExportThread::ExportThread() : continueEncode(true) {
surface.create();
fmt_ctx = NULL;
video_stream = NULL;
vcodec = NULL;
vcodec_ctx = NULL;
video_frame = NULL;
sws_frame = NULL;
sws_ctx = NULL;
audio_stream = NULL;
acodec = NULL;
audio_frame = NULL;
swr_frame = NULL;
acodec_ctx = NULL;
swr_ctx = NULL;
vpkt_alloc = false;
apkt_alloc = false;
}
bool ExportThread::encode(AVFormatContext* ofmt_ctx, AVCodecContext* codec_ctx, AVFrame* frame, AVPacket* packet, AVStream* stream, bool rescale) {
@@ -390,12 +407,17 @@ void ExportThread::run() {
frame_count++;
}
if (continueEncode) {
if (video_enabled) vpkt_alloc = true;
if (audio_enabled) apkt_alloc = true;
}
panel_sequence_viewer->viewer_widget->default_fbo = NULL;
rendering = false;
fbo.release();
if (audio_enabled) {
if (audio_enabled && continueEncode) {
// flush swresample
do {
swr_convert_frame(swr_ctx, swr_frame, NULL);
@@ -427,19 +449,19 @@ void ExportThread::run() {
avio_closep(&fmt_ctx->pb);
if (video_enabled) {
avcodec_close(vcodec_ctx);
av_packet_unref(&video_pkt);
av_frame_free(&video_frame);
avcodec_free_context(&vcodec_ctx);
}
if (vpkt_alloc) av_packet_unref(&video_pkt);
if (video_frame != NULL) av_frame_free(&video_frame);
if (vcodec_ctx != NULL) {
avcodec_close(vcodec_ctx);
avcodec_free_context(&vcodec_ctx);
}
if (audio_enabled) {
avcodec_close(acodec_ctx);
av_packet_unref(&audio_pkt);
av_frame_free(&audio_frame);
avcodec_free_context(&acodec_ctx);
}
if (apkt_alloc) av_packet_unref(&audio_pkt);
if (audio_frame != NULL) av_frame_free(&audio_frame);
if (acodec_ctx != NULL) {
avcodec_close(acodec_ctx);
avcodec_free_context(&acodec_ctx);
}
avformat_free_context(fmt_ctx);
+7 -3
View File
@@ -58,13 +58,13 @@ private:
bool setupAudio();
bool setupContainer();
AVFormatContext* fmt_ctx = NULL;
AVFormatContext* fmt_ctx;
AVStream* video_stream;
AVCodec* vcodec;
AVCodecContext* vcodec_ctx;
AVFrame* video_frame;
AVFrame* sws_frame;
SwsContext* sws_ctx = NULL;
SwsContext* sws_ctx;
AVStream* audio_stream;
AVCodec* acodec;
AVFrame* audio_frame;
@@ -72,7 +72,11 @@ private:
AVCodecContext* acodec_ctx;
AVPacket video_pkt;
AVPacket audio_pkt;
SwrContext* swr_ctx = NULL;
SwrContext* swr_ctx;
bool vpkt_alloc;
bool apkt_alloc;
int aframe_bytes;
int ret;
char* c_filename;
+1 -1
View File
@@ -527,7 +527,7 @@ void Project::delete_selected_media() {
// remove
if (remove) {
panel_effect_controls->clear_effects(true);
sequence->selections.clear();
if (sequence != NULL) sequence->selections.clear();
// remove media and parents
for (int m=0;m<parents.size();m++) {
+1 -1
View File
@@ -189,7 +189,7 @@ void ViewerWidget::initializeGL() {
//}
void ViewerWidget::paintEvent(QPaintEvent *e) {
if (!rendering) {
if (!rendering && context()->thread() == this->thread()) {
makeCurrent();
QOpenGLWidget::paintEvent(e);
}