scroll to item and export improvements
This commit is contained in:
@@ -88,9 +88,9 @@ void ActionSearch::perform_action() {
|
|||||||
void ActionSearch::move_selection_up() {
|
void ActionSearch::move_selection_up() {
|
||||||
int lim = list_widget->count();
|
int lim = list_widget->count();
|
||||||
for (int i=1;i<lim;i++) {
|
for (int i=1;i<lim;i++) {
|
||||||
if (list_widget->item(i)->isSelected()) {
|
if (list_widget->item(i)->isSelected()) {
|
||||||
// list_widget->item(i)->setSelected(false);
|
|
||||||
list_widget->item(i-1)->setSelected(true);
|
list_widget->item(i-1)->setSelected(true);
|
||||||
|
list_widget->scrollToItem(list_widget->item(i-1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,9 +99,9 @@ void ActionSearch::move_selection_up() {
|
|||||||
void ActionSearch::move_selection_down() {
|
void ActionSearch::move_selection_down() {
|
||||||
int lim = list_widget->count()-1;
|
int lim = list_widget->count()-1;
|
||||||
for (int i=0;i<lim;i++) {
|
for (int i=0;i<lim;i++) {
|
||||||
if (list_widget->item(i)->isSelected()) {
|
if (list_widget->item(i)->isSelected()) {
|
||||||
// list_widget->item(i)->setSelected(false);
|
|
||||||
list_widget->item(i+1)->setSelected(true);
|
list_widget->item(i+1)->setSelected(true);
|
||||||
|
list_widget->scrollToItem(list_widget->item(i+1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+35
-13
@@ -26,6 +26,23 @@ extern "C" {
|
|||||||
|
|
||||||
ExportThread::ExportThread() : continueEncode(true) {
|
ExportThread::ExportThread() : continueEncode(true) {
|
||||||
surface.create();
|
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) {
|
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++;
|
frame_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (continueEncode) {
|
||||||
|
if (video_enabled) vpkt_alloc = true;
|
||||||
|
if (audio_enabled) apkt_alloc = true;
|
||||||
|
}
|
||||||
|
|
||||||
panel_sequence_viewer->viewer_widget->default_fbo = NULL;
|
panel_sequence_viewer->viewer_widget->default_fbo = NULL;
|
||||||
rendering = false;
|
rendering = false;
|
||||||
|
|
||||||
fbo.release();
|
fbo.release();
|
||||||
|
|
||||||
if (audio_enabled) {
|
if (audio_enabled && continueEncode) {
|
||||||
// flush swresample
|
// flush swresample
|
||||||
do {
|
do {
|
||||||
swr_convert_frame(swr_ctx, swr_frame, NULL);
|
swr_convert_frame(swr_ctx, swr_frame, NULL);
|
||||||
@@ -427,19 +449,19 @@ void ExportThread::run() {
|
|||||||
|
|
||||||
avio_closep(&fmt_ctx->pb);
|
avio_closep(&fmt_ctx->pb);
|
||||||
|
|
||||||
if (video_enabled) {
|
if (vpkt_alloc) av_packet_unref(&video_pkt);
|
||||||
avcodec_close(vcodec_ctx);
|
if (video_frame != NULL) av_frame_free(&video_frame);
|
||||||
av_packet_unref(&video_pkt);
|
if (vcodec_ctx != NULL) {
|
||||||
av_frame_free(&video_frame);
|
avcodec_close(vcodec_ctx);
|
||||||
avcodec_free_context(&vcodec_ctx);
|
avcodec_free_context(&vcodec_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (audio_enabled) {
|
if (apkt_alloc) av_packet_unref(&audio_pkt);
|
||||||
avcodec_close(acodec_ctx);
|
if (audio_frame != NULL) av_frame_free(&audio_frame);
|
||||||
av_packet_unref(&audio_pkt);
|
if (acodec_ctx != NULL) {
|
||||||
av_frame_free(&audio_frame);
|
avcodec_close(acodec_ctx);
|
||||||
avcodec_free_context(&acodec_ctx);
|
avcodec_free_context(&acodec_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
avformat_free_context(fmt_ctx);
|
avformat_free_context(fmt_ctx);
|
||||||
|
|
||||||
|
|||||||
+7
-3
@@ -58,13 +58,13 @@ private:
|
|||||||
bool setupAudio();
|
bool setupAudio();
|
||||||
bool setupContainer();
|
bool setupContainer();
|
||||||
|
|
||||||
AVFormatContext* fmt_ctx = NULL;
|
AVFormatContext* fmt_ctx;
|
||||||
AVStream* video_stream;
|
AVStream* video_stream;
|
||||||
AVCodec* vcodec;
|
AVCodec* vcodec;
|
||||||
AVCodecContext* vcodec_ctx;
|
AVCodecContext* vcodec_ctx;
|
||||||
AVFrame* video_frame;
|
AVFrame* video_frame;
|
||||||
AVFrame* sws_frame;
|
AVFrame* sws_frame;
|
||||||
SwsContext* sws_ctx = NULL;
|
SwsContext* sws_ctx;
|
||||||
AVStream* audio_stream;
|
AVStream* audio_stream;
|
||||||
AVCodec* acodec;
|
AVCodec* acodec;
|
||||||
AVFrame* audio_frame;
|
AVFrame* audio_frame;
|
||||||
@@ -72,7 +72,11 @@ private:
|
|||||||
AVCodecContext* acodec_ctx;
|
AVCodecContext* acodec_ctx;
|
||||||
AVPacket video_pkt;
|
AVPacket video_pkt;
|
||||||
AVPacket audio_pkt;
|
AVPacket audio_pkt;
|
||||||
SwrContext* swr_ctx = NULL;
|
SwrContext* swr_ctx;
|
||||||
|
|
||||||
|
bool vpkt_alloc;
|
||||||
|
bool apkt_alloc;
|
||||||
|
|
||||||
int aframe_bytes;
|
int aframe_bytes;
|
||||||
int ret;
|
int ret;
|
||||||
char* c_filename;
|
char* c_filename;
|
||||||
|
|||||||
+1
-1
@@ -527,7 +527,7 @@ void Project::delete_selected_media() {
|
|||||||
// remove
|
// remove
|
||||||
if (remove) {
|
if (remove) {
|
||||||
panel_effect_controls->clear_effects(true);
|
panel_effect_controls->clear_effects(true);
|
||||||
sequence->selections.clear();
|
if (sequence != NULL) sequence->selections.clear();
|
||||||
|
|
||||||
// remove media and parents
|
// remove media and parents
|
||||||
for (int m=0;m<parents.size();m++) {
|
for (int m=0;m<parents.size();m++) {
|
||||||
|
|||||||
+1
-1
@@ -189,7 +189,7 @@ void ViewerWidget::initializeGL() {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
void ViewerWidget::paintEvent(QPaintEvent *e) {
|
void ViewerWidget::paintEvent(QPaintEvent *e) {
|
||||||
if (!rendering) {
|
if (!rendering && context()->thread() == this->thread()) {
|
||||||
makeCurrent();
|
makeCurrent();
|
||||||
QOpenGLWidget::paintEvent(e);
|
QOpenGLWidget::paintEvent(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user