several small bug fixes
This commit is contained in:
@@ -1 +0,0 @@
|
||||
olicon ICON "olive.ico"
|
||||
@@ -145,10 +145,8 @@ FORMS += \
|
||||
dialogs/preferencesdialog.ui
|
||||
|
||||
win32 {
|
||||
LIBS += -L../ffmpeg/lib -lopengl32
|
||||
INCLUDEPATH = ../ffmpeg/include
|
||||
RC_FILE = icons/win.rc
|
||||
LIBS += -lavutil -lavformat -lavcodec -lswscale -lswresample
|
||||
RC_ICONS = icons/olive.ico
|
||||
LIBS += -lavutil -lavformat -lavcodec -lswscale -lswresample -lopengl32
|
||||
}
|
||||
|
||||
mac {
|
||||
|
||||
@@ -143,8 +143,7 @@ void EffectControls::show_effect_menu(bool video, bool transitions) {
|
||||
}
|
||||
|
||||
void EffectControls::clear_effects(bool clear_cache) {
|
||||
// clear existing clips
|
||||
ui->keyframeView->effects.clear();
|
||||
// clear existing clips
|
||||
QVBoxLayout* video_layout = static_cast<QVBoxLayout*>(ui->video_effect_area->layout());
|
||||
QVBoxLayout* audio_layout = static_cast<QVBoxLayout*>(ui->audio_effect_area->layout());
|
||||
QLayoutItem* item;
|
||||
@@ -176,15 +175,10 @@ void EffectControls::deselect_all_effects(QWidget* sender) {
|
||||
|
||||
void EffectControls::load_effects() {
|
||||
// load in new clips
|
||||
long effects_in = LONG_MAX;
|
||||
long effects_out = 0;
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = sequence->get_clip(selected_clips.at(i));
|
||||
effects_in = qMin(effects_in, c->timeline_in);
|
||||
effects_out = qMax(effects_out, c->timeline_out);
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
Effect* e = c->effects.at(j);
|
||||
ui->keyframeView->effects.append(e);
|
||||
CollapsibleWidget* container = e->container;
|
||||
if (c->track < 0) {
|
||||
static_cast<QVBoxLayout*>(ui->video_effect_area->layout())->addWidget(container);
|
||||
@@ -199,12 +193,8 @@ void EffectControls::load_effects() {
|
||||
if (selected_clips.size() > 0) {
|
||||
ui->keyframeView->setMinimumHeight(ui->effects_area->height());
|
||||
ui->keyframeView->setEnabled(true);
|
||||
ui->keyframeView->visible_in = effects_in;
|
||||
ui->keyframeView->visible_out = effects_out;
|
||||
ui->keyframeView->update();
|
||||
|
||||
ui->headers->set_visible_in(effects_in);
|
||||
ui->headers->setVisible(true);
|
||||
ui->keyframeView->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ public:
|
||||
bool keyframe_focus();
|
||||
void delete_selected_keyframes();
|
||||
|
||||
QVector<int> selected_clips;
|
||||
|
||||
double zoom;
|
||||
public slots:
|
||||
void update_keyframes();
|
||||
@@ -55,7 +57,6 @@ private slots:
|
||||
|
||||
private:
|
||||
Ui::EffectControls *ui;
|
||||
QVector<int> selected_clips;
|
||||
void show_effect_menu(bool video, bool transitions);
|
||||
void load_effects();
|
||||
void load_keyframes();
|
||||
|
||||
@@ -94,9 +94,9 @@ void cache_clip(Clip* clip, long playhead, bool write_A, bool write_B, bool rese
|
||||
}
|
||||
|
||||
bool get_clip_frame(Clip* c, long playhead) {
|
||||
if (c->open) {
|
||||
if (c->finished_opening) {
|
||||
long sequence_clip_time = playhead - c->timeline_in + c->clip_in;
|
||||
long clip_time = refactor_frame_number(sequence_clip_time, c->sequence->frame_rate, av_q2d(av_guess_frame_rate(c->formatCtx, c->stream, c->frame)));
|
||||
long clip_time = refactor_frame_number(sequence_clip_time, c->sequence->frame_rate, av_q2d(c->stream->avg_frame_rate));
|
||||
|
||||
// do we need to update the texture?
|
||||
MediaStream* ms = static_cast<Media*>(c->media)->get_stream_from_file_index(c->track < 0, c->media_stream);
|
||||
@@ -133,6 +133,7 @@ bool get_clip_frame(Clip* c, long playhead) {
|
||||
c->cache_A.mutex.unlock();
|
||||
}
|
||||
} else {
|
||||
// frame is coming but isn't here yet, no need to reset cache
|
||||
no_frame = true;
|
||||
}
|
||||
} else if (c->cache_B.written && clip_time >= c->cache_B.offset && clip_time < c->cache_B.offset + c->cache_size) {
|
||||
@@ -145,6 +146,7 @@ bool get_clip_frame(Clip* c, long playhead) {
|
||||
c->cache_B.mutex.unlock();
|
||||
}
|
||||
} else {
|
||||
// frame is coming but isn't here yet, no need to reset cache
|
||||
no_frame = true;
|
||||
}
|
||||
} else {
|
||||
@@ -158,14 +160,14 @@ bool get_clip_frame(Clip* c, long playhead) {
|
||||
current_frame = cache[clip_time - cache_offset];
|
||||
}
|
||||
|
||||
// determine whether we should start filling the other cache
|
||||
// determine whether we should s1tart filling the other cache
|
||||
if (!using_cache_A || !using_cache_B) {
|
||||
if (c->lock.tryLock()) {
|
||||
bool write_A = (!using_cache_A && !c->cache_A.unread);
|
||||
bool write_B = (!using_cache_B && !c->cache_B.unread);
|
||||
if (write_A || write_B) {
|
||||
// if we have no cache and need to seek, start us at the current playhead, otherwise start at the end of the current cache
|
||||
cache_clip(c, (cache_needs_reset) ? clip_time : cache_offset + c->cache_size, write_A, write_B, cache_needs_reset, NULL);
|
||||
cache_clip(c, (cache_needs_reset) ? qMax(clip_time, 0L) : cache_offset + c->cache_size, write_A, write_B, cache_needs_reset, NULL);
|
||||
}
|
||||
c->lock.unlock();
|
||||
}
|
||||
|
||||
+40
-26
@@ -10,6 +10,7 @@
|
||||
#include "project/undo.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "ui/viewerwidget.h"
|
||||
#include "project/sequence.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QMouseEvent>
|
||||
@@ -27,36 +28,49 @@ KeyframeView::KeyframeView(QWidget *parent) : QWidget(parent), mousedown(false),
|
||||
}
|
||||
|
||||
void KeyframeView::paintEvent(QPaintEvent*) {
|
||||
QPainter p(this);
|
||||
QPainter p(this);
|
||||
|
||||
rowY.clear();
|
||||
rows.clear();
|
||||
|
||||
long effects_in = LONG_MAX;
|
||||
long effects_out = 0;
|
||||
|
||||
for (int j=0;j<panel_effect_controls->selected_clips.size();j++) {
|
||||
Clip* c = sequence->get_clip(panel_effect_controls->selected_clips.at(j));
|
||||
effects_in = qMin(effects_in, c->timeline_in);
|
||||
effects_out = qMax(effects_out, c->timeline_out);
|
||||
for (int i=0;i<c->effects.size();i++) {
|
||||
Effect* e = c->effects.at(i);
|
||||
if (e->container->is_expanded()) {
|
||||
for (int j=0;j<e->row_count();j++) {
|
||||
EffectRow* row = e->row(j);
|
||||
|
||||
QLabel* label = row->label;
|
||||
QWidget* contents = e->container->contents;
|
||||
|
||||
int keyframe_y = label->y() + (label->height()>>1) + mapFrom(panel_effect_controls, contents->mapTo(panel_effect_controls, contents->pos())).y() - e->container->title_bar->height();
|
||||
for (int k=0;k<row->keyframe_times.size();k++) {
|
||||
bool keyframe_selected = keyframeIsSelected(row, k);
|
||||
long keyframe_frame = adjust_row_keyframe(row, row->keyframe_times.at(k));
|
||||
if (dragging && keyframe_selected) keyframe_frame += frame_diff;
|
||||
draw_keyframe(p, getScreenPointFromFrame(panel_effect_controls->zoom, keyframe_frame), keyframe_y, keyframe_selected);
|
||||
}
|
||||
|
||||
rows.append(row);
|
||||
rowY.append(keyframe_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
visible_in = effects_in;
|
||||
visible_out = effects_out;
|
||||
|
||||
int width = getScreenPointFromFrame(panel_effect_controls->zoom, visible_out - visible_in);
|
||||
setMinimumWidth(width);
|
||||
header->setMinimumWidth(width);
|
||||
|
||||
rowY.clear();
|
||||
rows.clear();
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
Effect* e = effects.at(i);
|
||||
if (e->container->is_expanded()) {
|
||||
for (int j=0;j<e->row_count();j++) {
|
||||
EffectRow* row = e->row(j);
|
||||
|
||||
QLabel* label = row->label;
|
||||
QWidget* contents = e->container->contents;
|
||||
|
||||
int keyframe_y = label->y() + (label->height()>>1) + mapFrom(panel_effect_controls, contents->mapTo(panel_effect_controls, contents->pos())).y() - e->container->title_bar->height();
|
||||
for (int k=0;k<row->keyframe_times.size();k++) {
|
||||
bool keyframe_selected = keyframeIsSelected(row, k);
|
||||
long keyframe_frame = adjust_row_keyframe(row, row->keyframe_times.at(k));
|
||||
if (dragging && keyframe_selected) keyframe_frame += frame_diff;
|
||||
draw_keyframe(p, getScreenPointFromFrame(panel_effect_controls->zoom, keyframe_frame), keyframe_y, keyframe_selected);
|
||||
}
|
||||
|
||||
rows.append(row);
|
||||
rowY.append(keyframe_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
header->set_visible_in(effects_in);
|
||||
|
||||
if (rowY.size() > 0) {
|
||||
int playhead_x = getScreenPointFromFrame(panel_effect_controls->zoom, panel_timeline->playhead-visible_in);
|
||||
|
||||
@@ -13,7 +13,6 @@ class KeyframeView : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
KeyframeView(QWidget* parent = 0);
|
||||
QVector<Effect*> effects;
|
||||
|
||||
void delete_selected_keyframes();
|
||||
|
||||
|
||||
+16
-2
@@ -163,6 +163,7 @@ GLuint ViewerWidget::compose_sequence(Clip* nest, bool render_audio) {
|
||||
int half_width = s->width/2;
|
||||
int half_height = s->height/2;
|
||||
if (rendering || nest != NULL) half_height = -half_height;
|
||||
glPushMatrix();
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
glLoadIdentity();
|
||||
@@ -189,7 +190,7 @@ GLuint ViewerWidget::compose_sequence(Clip* nest, bool render_audio) {
|
||||
Sequence* cs = static_cast<Sequence*>(c->media);
|
||||
video_width = cs->width;
|
||||
video_height = cs->height;
|
||||
textureID = compose_sequence(c, render_audio);
|
||||
textureID = -1;
|
||||
}
|
||||
|
||||
if (textureID == 0) {
|
||||
@@ -203,6 +204,17 @@ GLuint ViewerWidget::compose_sequence(Clip* nest, bool render_audio) {
|
||||
c->fbo[1] = new QOpenGLFramebufferObject(video_width, video_height);
|
||||
}
|
||||
|
||||
// clear fbos
|
||||
c->fbo[0]->bind();
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
c->fbo[0]->release();
|
||||
c->fbo[1]->bind();
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
c->fbo[1]->release();
|
||||
|
||||
// for nested sequences
|
||||
if (textureID == -1) textureID = compose_sequence(c, render_audio);
|
||||
|
||||
glViewport(0, 0, video_width, video_height);
|
||||
|
||||
GLuint composite_texture = draw_clip(c->fbo[0], textureID);
|
||||
@@ -261,7 +273,6 @@ GLuint ViewerWidget::compose_sequence(Clip* nest, bool render_audio) {
|
||||
// EFFECT CODE END
|
||||
|
||||
if (nest != NULL) {
|
||||
// if (nest->fbo == NULL) nest->fbo = new QOpenGLFramebufferObject(s->width, s->height);
|
||||
nest->fbo[0]->bind();
|
||||
glViewport(0, 0, s->width, s->height);
|
||||
} else if (rendering) {
|
||||
@@ -305,6 +316,8 @@ GLuint ViewerWidget::compose_sequence(Clip* nest, bool render_audio) {
|
||||
}
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
return (nest != NULL && nest->fbo != NULL) ? nest->fbo[0]->texture() : 0;
|
||||
}
|
||||
|
||||
@@ -325,6 +338,7 @@ void ViewerWidget::paintGL() {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// compose video preview
|
||||
glClearColor(0, 0, 0, 0);
|
||||
compose_sequence(NULL, (panel_timeline->playing || rendering));
|
||||
|
||||
if (texture_failed) {
|
||||
|
||||
Reference in New Issue
Block a user