got a LOT of work down on the footage viewer

This commit is contained in:
itsmattkc
2018-10-18 11:43:21 +11:00
parent 20a264554c
commit b8deb5d415
19 changed files with 117 additions and 120 deletions
+1 -1
View File
@@ -407,6 +407,6 @@ void SpeedDialog::accept() {
undo_stack.push(ca);
panel_timeline->repaint_timeline(true);
update_ui(true);
QDialog::accept();
}
+7 -7
View File
@@ -286,12 +286,12 @@ void MainWindow::editMenu_About_To_Be_Shown() {
void MainWindow::undo() {
undo_stack.undo();
panel_timeline->repaint_timeline(true);
update_ui(true);
}
void MainWindow::redo() {
undo_stack.redo();
panel_timeline->repaint_timeline(true);
update_ui(true);
}
void MainWindow::openSpeedDialog() {
@@ -431,7 +431,7 @@ void MainWindow::on_actionProject_triggered()
project_url.clear();
panel_project->new_project();
updateTitle("");
panel_timeline->repaint_timeline(false);
update_ui(false);
}
}
@@ -712,7 +712,7 @@ void MainWindow::on_actionSet_Out_Point_triggered()
void MainWindow::on_actionClear_In_Out_triggered() {
if ((panel_timeline->focused() || panel_sequence_viewer->hasFocus()) && sequence->using_workarea) {
undo_stack.push(new SetTimelineInOutCommand(sequence, false, 0, 0));
panel_timeline->repaint_timeline(false);
panel_timeline->repaint_timeline();
}
}
@@ -733,13 +733,13 @@ void MainWindow::on_actionRipple_Delete_In_Out_triggered()
void MainWindow::on_actionTimeline_Track_Lines_triggered()
{
config.show_track_lines = !config.show_track_lines;
panel_timeline->repaint_timeline(false);
panel_timeline->repaint_timeline();
}
void MainWindow::on_actionRectified_Waveforms_triggered()
{
config.rectified_waveforms = !config.rectified_waveforms;
panel_timeline->repaint_timeline(false);
panel_timeline->repaint_timeline();
}
void MainWindow::on_actionDefault_triggered() {
@@ -816,7 +816,7 @@ void MainWindow::on_actionEnable_Disable_Clip_triggered() {
}
if (push_undo) {
undo_stack.push(ca);
panel_timeline->repaint_timeline(true);
update_ui(true);
} else {
delete ca;
}
+1 -1
View File
@@ -82,7 +82,7 @@ void EffectControls::menu_select(QAction* q) {
}
undo_stack.push(ca);
if (transition_menu) {
panel_timeline->repaint_timeline(true);
update_ui(true);
} else {
reload_clips();
panel_sequence_viewer->viewer_widget->update();
+2 -1
View File
@@ -3,6 +3,7 @@
#include "timeline.h"
#include "effectcontrols.h"
#include "viewer.h"
#include "project/sequence.h"
Project* panel_project = 0;
EffectControls* panel_effect_controls = 0;
@@ -10,7 +11,7 @@ Viewer* panel_sequence_viewer = 0;
Viewer* panel_footage_viewer = 0;
Timeline* panel_timeline = 0;
void Timeline::update_effect_controls() {
void update_effect_controls() {
// SEND CLIPS TO EFFECT CONTROLS
// find out how many clips are selected
// limits to one video clip and one audio clip and only if they're linked
+2
View File
@@ -12,4 +12,6 @@ extern Viewer* panel_sequence_viewer;
extern Viewer* panel_footage_viewer;
extern Timeline* panel_timeline;
void update_ui(bool modified);
#endif // PANELS_H
+4 -4
View File
@@ -356,7 +356,7 @@ void Project::delete_selected_media() {
// redraw clips
if (redraw) {
panel_timeline->repaint_timeline(true);
update_ui(true);
}
} else {
delete ca;
@@ -622,7 +622,7 @@ void Project::delete_clips_using_selected_media() {
}
if (deleted) {
undo_stack.push(ca);
panel_timeline->repaint_timeline(true);
update_ui(true);
} else {
delete ca;
}
@@ -1040,7 +1040,7 @@ void Project::load_project() {
if (cont) {
if (open_seq != NULL) set_sequence(open_seq);
panel_timeline->repaint_timeline(false);
update_ui(false);
mainWindow->setWindowModified(false);
} else {
new_project();
@@ -1347,7 +1347,7 @@ void MediaThrobber::stop(int icon_type, bool replace) {
}
// redraw clips
panel_timeline->repaint_timeline(replace);
update_ui(replace);
panel_project->source_table->viewport()->update();
deleteLater();
+14 -14
View File
@@ -169,7 +169,7 @@ void Timeline::add_transition() {
delete ca;
}
repaint_timeline(true);
update_ui(true);
}
int Timeline::calculate_track_height(int track, int value) {
@@ -208,7 +208,7 @@ void Timeline::update_sequence() {
setWindowTitle("Timeline: <none>");
} else {
setWindowTitle("Timeline: " + sequence->name);
repaint_timeline(false);
update_ui(false);
}
}
@@ -250,7 +250,7 @@ void Timeline::select_all() {
sequence->selections.append(s);
}
}
repaint_timeline(false);
repaint_timeline();
}
}
@@ -271,7 +271,7 @@ void Timeline::delete_in_out(bool ripple) {
if (ripple) ca->append(new RippleCommand(sequence, sequence->workarea_in, sequence->workarea_in - sequence->workarea_out));
ca->append(new SetTimelineInOutCommand(sequence, false, 0, 0));
undo_stack.push(ca);
repaint_timeline(true);
update_ui(true);
}
}
@@ -331,7 +331,7 @@ void Timeline::delete_selection(bool ripple_delete) {
undo_stack.push(ca);
repaint_timeline(true);
update_ui(true);
}
}
@@ -342,7 +342,7 @@ int lerp(int a, int b, double t) {
void Timeline::set_zoom(bool in) {
zoom *= (in) ? 2 : 0.5;
ui->headers->update_zoom(zoom);
repaint_timeline(false);
repaint_timeline();
// TODO find a way to gradually move towards target_scroll instead of just setting it?
int target_scroll = getScreenPointFromFrame(zoom, sequence->playhead)-(ui->editAreas->width()>>1);
@@ -690,7 +690,7 @@ void Timeline::paste() {
undo_stack.push(ca);
repaint_timeline(true);
update_ui(true);
if (config.paste_seeks) {
panel_sequence_viewer->seek(paste_end);
@@ -749,7 +749,7 @@ void Timeline::ripple_to_in_point(bool in) {
ca->append(new RippleCommand(sequence, in_point, (in) ? (in_point - sequence->playhead) : (sequence->playhead - in_point)));
undo_stack.push(ca);
repaint_timeline(true);
update_ui(true);
if (in) panel_sequence_viewer->seek(in_point);
}
@@ -882,7 +882,7 @@ void Timeline::split_at_playhead() {
if (split_selected) {
undo_stack.push(ca);
repaint_timeline(true);
update_ui(true);
} else {
delete ca;
}
@@ -1006,7 +1006,7 @@ void Timeline::toggle_links() {
}
if (command->clips.size() > 0) {
undo_stack.push(command);
repaint_timeline(true);
repaint_timeline();
} else {
delete command;
}
@@ -1019,7 +1019,7 @@ void Timeline::increase_track_height() {
for (int i=0;i<audio_track_heights.size();i++) {
audio_track_heights[i] += TRACK_HEIGHT_INCREMENT;
}
repaint_timeline(false);
repaint_timeline();
}
void Timeline::decrease_track_height() {
@@ -1031,12 +1031,12 @@ void Timeline::decrease_track_height() {
audio_track_heights[i] -= TRACK_HEIGHT_INCREMENT;
if (audio_track_heights[i] < TRACK_MIN_HEIGHT) audio_track_heights[i] = TRACK_MIN_HEIGHT;
}
repaint_timeline(false);
repaint_timeline();
}
void Timeline::deselect() {
sequence->selections.clear();
repaint_timeline(false);
repaint_timeline();
}
long getFrameFromScreenPoint(double zoom, int x) {
@@ -1154,5 +1154,5 @@ void Timeline::addMenuItem(QAction* action) {
void Timeline::setScroll(int s) {
scroll = s;
ui->headers->set_scroll(s);
repaint_timeline(false);
repaint_timeline();
}
+22 -19
View File
@@ -16,6 +16,7 @@
QString panel_name = "Viewer: ";
extern "C" {
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
}
@@ -26,7 +27,6 @@ Viewer::Viewer(QWidget *parent) :
QDockWidget(parent),
ui(new Ui::Viewer),
seq(NULL),
queue_audio_reset(false),
playing(false),
created_sequence(false)
{
@@ -35,6 +35,7 @@ Viewer::Viewer(QWidget *parent) :
ui->headers->snapping = false;
ui->headers->show_text(false);
ui->glViewerPane->child = ui->openGLWidget;
ui->openGLWidget->viewer = this;
viewer_widget = ui->openGLWidget;
set_media(MEDIA_TYPE_SEQUENCE, NULL);
@@ -72,7 +73,6 @@ void Viewer::reset_all_audio() {
}
}
}
// panel_timeline->ui->audio_monitor->reset();
clear_audio_ibuffer();
}
@@ -146,8 +146,7 @@ bool frame_rate_is_droppable(float rate) {
void Viewer::seek(long p) {
pause();
seq->playhead = p;
queue_audio_reset = true;
panel_timeline->repaint_timeline(false);
update_parents();
}
void Viewer::go_to_start() {
@@ -171,10 +170,11 @@ void Viewer::toggle_play() {
}
void Viewer::play() {
if (queue_audio_reset) {
reset_all_audio();
queue_audio_reset = false;
if (audio_output->format().sampleRate() != seq->audio_frequency
|| audio_output->format().channelCount() != av_get_channel_layout_nb_channels(seq->audio_layout)) {
init_audio(seq);
}
reset_all_audio();
playhead_start = seq->playhead;
start_msecs = QDateTime::currentMSecsSinceEpoch();
playback_updater.start();
@@ -207,15 +207,23 @@ void Viewer::update_header_zoom() {
if (sequenceEndFrame > 0) {
ui->headers->update_zoom((double) ui->headers->width() / (double) sequenceEndFrame);
} else {
ui->headers->update_zoom(1);
}
ui->headers->update_zoom((sequenceEndFrame > 0) ? ((double) ui->headers->width() / (double) sequenceEndFrame) : 1);
}
}
void Viewer::update_parents() {
if (main_sequence) {
update_ui(false);
} else {
update_viewer();
}
}
void Viewer::update_viewer() {
viewer_widget->update();
update_header_zoom();
update_playhead_timecode(seq->playhead);
if (seq != NULL) update_playhead_timecode(seq->playhead);
}
void Viewer::set_media(int type, void* media) {
@@ -259,10 +267,10 @@ void Viewer::set_media(int type, void* media) {
Clip* c = new Clip(seq);
c->media = footage;
c->media_type = type;
c->media_stream = footage->video_tracks.at(0)->file_index;
c->media_stream = audio_stream->file_index;
c->timeline_in = 0;
c->timeline_out = footage->get_length_in_frames(seq->frame_rate);
c->track = -1;
c->track = 0;
c->clip_in = 0;
c->recalculateMaxLength();
seq->clips.append(c);
@@ -307,10 +315,7 @@ void Viewer::update_playhead() {
void Viewer::timer_update() {
seq->playhead = round(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate));
update_viewer();
if (main_sequence) {
panel_timeline->repaint_timeline(false);
}
update_parents();
}
void Viewer::clean_created_seq() {
@@ -325,13 +330,11 @@ void Viewer::set_sequence(bool main, Sequence *s) {
reset_all_audio();
main_sequence = main;
seq = (main) ? sequence : s;
viewer_widget->display_sequence = seq;
seq = (main) ? sequence : s;
bool null_sequence = (seq == NULL);
ui->headers->setEnabled(!null_sequence);
qDebug() << "headers enabled:" << ui->headers->isEnabled();
ui->headers->setEnabled(!null_sequence);
ui->currentTimecode->setEnabled(!null_sequence);
ui->openGLWidget->setEnabled(!null_sequence);
ui->openGLWidget->setVisible(!null_sequence);
+3 -2
View File
@@ -47,12 +47,14 @@ public:
QTimer playback_updater;
void reset_all_audio();
void update_parents();
ViewerWidget* viewer_widget;
Sequence* seq;
Ui::Viewer *ui;
public slots:
private slots:
@@ -66,9 +68,8 @@ private slots:
private:
void clean_created_seq();
void set_sequence(bool main, Sequence* s);
bool main_sequence;
bool main_sequence;
bool created_sequence;
bool queue_audio_reset;
};
#endif // VIEWER_H
+6 -6
View File
@@ -75,14 +75,14 @@ void clear_audio_ibuffer() {
audio_ibuffer_read = 0;
}
int get_buffer_offset_from_frame(long frame) {
int get_buffer_offset_from_frame(Sequence* s, long frame) {
// currently debugging this function. since it has a high potential of failure and isn't actually fatal, we only assert on debug mode
#ifdef QT_DEBUG
Q_ASSERT(frame >= audio_ibuffer_frame);
return qFloor(av_samples_get_buffer_size(NULL, av_get_channel_layout_nb_channels(sequence->audio_layout), qRound(((frame-audio_ibuffer_frame)/sequence->frame_rate)*sequence->audio_frequency), AV_SAMPLE_FMT_S16, 1)/4)*4;
return qFloor(av_samples_get_buffer_size(NULL, av_get_channel_layout_nb_channels(s->audio_layout), qRound(((frame-audio_ibuffer_frame)/s->frame_rate)*s->audio_frequency), AV_SAMPLE_FMT_S16, 1)/4)*4;
#else
if (frame >= audio_ibuffer_frame) {
return qFloor(av_samples_get_buffer_size(NULL, av_get_channel_layout_nb_channels(sequence->audio_layout), qRound(((frame-audio_ibuffer_frame)/sequence->frame_rate)*sequence->audio_frequency), AV_SAMPLE_FMT_S16, 1)/4)*4;
return qFloor(av_samples_get_buffer_size(NULL, av_get_channel_layout_nb_channels(s->audio_layout), qRound(((frame-audio_ibuffer_frame)/s->frame_rate)*s->audio_frequency), AV_SAMPLE_FMT_S16, 1)/4)*4;
} else {
qDebug() << "[WARNING] Invalid values passed to get_buffer_offset_from_frame";
return 0;
@@ -113,7 +113,7 @@ void AudioSenderThread::run() {
cond.wait(&lock);
if (close) {
break;
} else if (panel_sequence_viewer->playing) {
} else if (panel_sequence_viewer->playing || panel_footage_viewer->playing) {
int written_bytes = 0;
int adjusted_read_index = audio_ibuffer_read%audio_ibuffer_size;
@@ -143,14 +143,14 @@ int AudioSenderThread::send_audio_to_output(int offset, int max) {
int channel_count = av_get_channel_layout_nb_channels(sequence->audio_layout);
long sample_cache_playhead = panel_timeline->ui->audio_monitor->sample_cache_offset + (panel_timeline->ui->audio_monitor->sample_cache.size()/channel_count);
int next_buffer_offset, buffer_offset_adjusted, i;
int buffer_offset = get_buffer_offset_from_frame(sample_cache_playhead);
int buffer_offset = get_buffer_offset_from_frame(sequence, sample_cache_playhead);
if (samples.size() != channel_count) samples.resize(channel_count);
samples.fill(0);
// TODO: I don't like this, but i'm not sure if there's a smarter way to do it
while (buffer_offset < audio_ibuffer_limit) {
sample_cache_playhead++;
next_buffer_offset = qMin(get_buffer_offset_from_frame(sample_cache_playhead), audio_ibuffer_limit);
next_buffer_offset = qMin(get_buffer_offset_from_frame(sequence, sample_cache_playhead), audio_ibuffer_limit);
while (buffer_offset < next_buffer_offset) {
for (i=0;i<samples.size();i++) {
buffer_offset_adjusted = buffer_offset%audio_ibuffer_size;
+1 -1
View File
@@ -44,6 +44,6 @@ void clear_audio_ibuffer();
void init_audio(Sequence *s);
void stop_audio();
int get_buffer_offset_from_frame(long frame);
int get_buffer_offset_from_frame(Sequence *s, long frame);
#endif // AUDIO_H
+14 -12
View File
@@ -71,6 +71,8 @@ void apply_audio_effects(Clip* c, double timecode_start, AVFrame* frame, int nb_
}
void cache_audio_worker(Clip* c, Clip* nest) {
qDebug() << "caw called";
long timeline_in = c->timeline_in;
long timeline_out = c->timeline_out;
if (nest != NULL) {
@@ -191,7 +193,7 @@ void cache_audio_worker(Clip* c, Clip* nest) {
#ifdef AUDIOWARNINGS
qDebug() << "pre cutoff deets::: rev_frame.pts:" << rev_frame->pts << "rev_frame.nb_samples" << rev_frame->nb_samples << "rev_target:" << c->rev_target;
#endif
rev_frame->nb_samples = qRound(static_cast<double>(c->reverse_target - rev_frame->pts) / c->stream->codecpar->sample_rate * sequence->audio_frequency);
rev_frame->nb_samples = qRound(static_cast<double>(c->reverse_target - rev_frame->pts) / c->stream->codecpar->sample_rate * c->sequence->audio_frequency);
#ifdef AUDIOWARNINGS
qDebug() << "post cutoff deets::" << rev_frame->nb_samples;
#endif
@@ -263,7 +265,7 @@ void cache_audio_worker(Clip* c, Clip* nest) {
qDebug() << "fsi-post-post:" << c->frame_sample_index;
#endif
if (c->audio_buffer_write == 0) c->audio_buffer_write = get_buffer_offset_from_frame(qMax(timeline_in, c->audio_target_frame));
if (c->audio_buffer_write == 0) c->audio_buffer_write = get_buffer_offset_from_frame(c->sequence, qMax(timeline_in, c->audio_target_frame));
int offset = (audio_ibuffer_read + 2048) - c->audio_buffer_write;
if (offset > 0) {
@@ -287,7 +289,7 @@ void cache_audio_worker(Clip* c, Clip* nest) {
// apply any audio effects to the data
if (nb_bytes == INT_MAX) nb_bytes = frame->nb_samples * av_get_bytes_per_sample(static_cast<AVSampleFormat>(frame->format)) * frame->channels;
if (new_frame) {
apply_audio_effects(c, bytes_to_seconds(c->audio_buffer_write, 2, sequence->audio_frequency) + audio_ibuffer_timecode + ((double) (c->clip_in - c->timeline_in)/sequence->frame_rate), frame, nb_bytes);
apply_audio_effects(c, bytes_to_seconds(c->audio_buffer_write, 2, c->sequence->audio_frequency) + audio_ibuffer_timecode + ((double) (c->clip_in - c->timeline_in)/c->sequence->frame_rate), frame, nb_bytes);
}
}
break;
@@ -300,7 +302,7 @@ void cache_audio_worker(Clip* c, Clip* nest) {
apply_audio_effects(c, bytes_to_seconds(frame->pts, frame->channels, frame->sample_rate), frame, nb_bytes);
c->frame->pts += nb_bytes;
c->frame_sample_index = 0;
if (c->audio_buffer_write == 0) c->audio_buffer_write = get_buffer_offset_from_frame(qMax(timeline_in, c->audio_target_frame));
if (c->audio_buffer_write == 0) c->audio_buffer_write = get_buffer_offset_from_frame(c->sequence, qMax(timeline_in, c->audio_target_frame));
int offset = audio_ibuffer_read - c->audio_buffer_write;
if (offset > 0) {
c->audio_buffer_write += offset;
@@ -317,7 +319,7 @@ void cache_audio_worker(Clip* c, Clip* nest) {
if (frame->nb_samples == 0) {
break;
} else {
long buffer_timeline_out = get_buffer_offset_from_frame(timeline_out);
long buffer_timeline_out = get_buffer_offset_from_frame(c->sequence, timeline_out);
audio_write_lock.lock();
while (c->frame_sample_index < nb_bytes
&& c->audio_buffer_write < audio_ibuffer_read+audio_ibuffer_size
@@ -628,9 +630,9 @@ void open_clip_worker(Clip* clip) {
AVFrame* reverse_frame = av_frame_alloc();
reverse_frame->format = sample_format;
reverse_frame->nb_samples = sequence->audio_frequency*2;
reverse_frame->channel_layout = sequence->audio_layout;
reverse_frame->channels = av_get_channel_layout_nb_channels(sequence->audio_layout);
reverse_frame->nb_samples = clip->sequence->audio_frequency*2;
reverse_frame->channel_layout = clip->sequence->audio_layout;
reverse_frame->channels = av_get_channel_layout_nb_channels(clip->sequence->audio_layout);
av_frame_get_buffer(reverse_frame, 0);
clip->queue.append(reverse_frame);
@@ -657,7 +659,7 @@ void open_clip_worker(Clip* clip) {
qDebug() << "[ERROR] Could not set output sample format";
}
int target_sample_rate = sequence->audio_frequency;
int target_sample_rate = clip->sequence->audio_frequency;
if (qFuzzyCompare(clip->speed, 1.0)) {
avfilter_link(clip->buffersrc_ctx, 0, clip->buffersink_ctx, 0);
@@ -670,7 +672,7 @@ void open_clip_worker(Clip* clip) {
avfilter_link(clip->buffersrc_ctx, 0, tempo_filter, 0);
avfilter_link(tempo_filter, 0, clip->buffersink_ctx, 0);
} else {
target_sample_rate = qRound(sequence->audio_frequency / clip->speed);
target_sample_rate = qRound(clip->sequence->audio_frequency / clip->speed);
avfilter_link(clip->buffersrc_ctx, 0, clip->buffersink_ctx, 0);
}
@@ -690,9 +692,9 @@ void open_clip_worker(Clip* clip) {
case MEDIA_TYPE_TONE:
clip->frame = av_frame_alloc();
clip->frame->format = sample_format;
clip->frame->channel_layout = sequence->audio_layout;
clip->frame->channel_layout = clip->sequence->audio_layout;
clip->frame->channels = av_get_channel_layout_nb_channels(clip->frame->channel_layout);
clip->frame->sample_rate = sequence->audio_frequency;
clip->frame->sample_rate = clip->sequence->audio_frequency;
clip->frame->nb_samples = 2048;
av_frame_make_writable(clip->frame);
if (av_frame_get_buffer(clip->frame, 0)) {
+1 -1
View File
@@ -396,8 +396,8 @@ void set_sequence(Sequence* s) {
closeActiveClips(sequence, true);
panel_effect_controls->clear_effects(true);
sequence = s;
panel_sequence_viewer->set_main_sequence();
panel_timeline->update_sequence();
panel_sequence_viewer->set_main_sequence();
panel_timeline->setFocus();
}
-8
View File
@@ -31,12 +31,4 @@ void get_next_audio(Clip* c, bool mix);
void set_sequence(Sequence* s);
void closeActiveClips(Sequence* s, bool wait);
struct ClipCacheData {
Clip& clip;
long playhead;
bool write_A;
bool write_B;
bool reset;
};
#endif // PLAYBACK_H
+10 -6
View File
@@ -72,7 +72,7 @@ void TimelineHeader::set_in_point(long new_in) {
}
undo_stack.push(new SetTimelineInOutCommand(viewer->seq, true, new_in, new_out));
panel_timeline->repaint_timeline(false);
update_parents();
}
void TimelineHeader::set_out_point(long new_out) {
@@ -83,7 +83,7 @@ void TimelineHeader::set_out_point(long new_out) {
new_in = 0;
}
undo_stack.push(new SetTimelineInOutCommand(viewer->seq, true, new_in, new_out));
panel_timeline->repaint_timeline(false);
update_parents();
}
void TimelineHeader::show_text(bool enable) {
@@ -159,7 +159,7 @@ void TimelineHeader::mouseMoveEvent(QMouseEvent* event) {
temp_workarea_out = qMin(qMax(temp_workarea_in+1, frame), sequence_end);
}
panel_timeline->repaint_timeline(false);
update_parents();
} else if (dragging_markers) {
long frame_movement = getHeaderFrameFromScreenPoint(event->pos().x()) - getHeaderFrameFromScreenPoint(drag_start);
@@ -186,7 +186,7 @@ void TimelineHeader::mouseMoveEvent(QMouseEvent* event) {
viewer->seq->markers[selected_markers.at(i)].frame = selected_marker_original_times.at(i) + frame_movement;
}
panel_timeline->repaint_timeline(false);
update_parents();
} else {
set_playhead(event->pos().x());
}
@@ -239,7 +239,7 @@ void TimelineHeader::mouseReleaseEvent(QMouseEvent*) {
dragging = false;
dragging_markers = false;
panel_timeline->snapped = false;
panel_timeline->repaint_timeline(false);
update_parents();
}
}
@@ -248,6 +248,10 @@ void TimelineHeader::focusOutEvent(QFocusEvent*) {
update();
}
void TimelineHeader::update_parents() {
viewer->update_parents();
}
void TimelineHeader::update_zoom(double z) {
zoom = z;
update();
@@ -260,7 +264,7 @@ void TimelineHeader::delete_markers() {
dma->markers.append(selected_markers.at(i));
}
undo_stack.push(dma);
panel_timeline->repaint_timeline(false);
update_parents();
}
}
+2
View File
@@ -34,6 +34,8 @@ protected:
void focusOutEvent(QFocusEvent*);
private:
void update_parents();
bool dragging;
bool resizing_workarea;
+20 -29
View File
@@ -78,7 +78,7 @@ void TimelineWidget::right_click_ripple() {
if (can_ripple) {
undo_stack.push(new RippleCommand(sequence, rc_ripple_min, rc_ripple_min - rc_ripple_max));
panel_timeline->repaint_timeline(true);
update_ui(true);
}
}
@@ -362,7 +362,7 @@ void TimelineWidget::dragMoveEvent(QDragMoveEvent *event) {
if (sequence != NULL && panel_timeline->importing) {
QPoint pos = event->pos();
update_ghosts(pos);
panel_timeline->repaint_timeline(false);
update_ui(false);
}
}
@@ -388,7 +388,7 @@ void TimelineWidget::dragLeaveEvent(QDragLeaveEvent*) {
if (sequence != NULL && panel_timeline->importing) {
panel_timeline->ghosts.clear();
panel_timeline->importing = false;
panel_timeline->repaint_timeline(false);
update_ui(false);
}
}
@@ -503,7 +503,7 @@ void TimelineWidget::dropEvent(QDropEvent* event) {
setFocus();
panel_timeline->repaint_timeline(true);
update_ui(true);
}
}
@@ -518,7 +518,7 @@ void TimelineWidget::mouseDoubleClickEvent(QMouseEvent *event) {
s.out = clip->timeline_out;
s.track = clip->track;
sequence->selections.append(s);
panel_timeline->repaint_timeline(false);
update_ui(false);
}
}
}
@@ -681,7 +681,7 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
panel_timeline->rect_select_init = true;
}
panel_timeline->repaint_timeline(false);
update_ui(false);
}
}
break;
@@ -693,7 +693,7 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
{
panel_timeline->splitting = true;
panel_timeline->split_tracks.append(panel_timeline->drag_track_start);
panel_timeline->repaint_timeline(false);
update_ui(false);
}
break;
}
@@ -707,9 +707,8 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
bool alt = (event->modifiers() & Qt::AltModifier);
bool shift = (event->modifiers() & Qt::ShiftModifier);
if (event->button() == Qt::LeftButton) {
bool repaint = false;
bool redraw = false;
if (event->button() == Qt::LeftButton) {
bool changed = false;
ComboAction* ca = new ComboAction();
bool push_undo = false;
@@ -782,7 +781,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
panel_timeline->delete_areas_and_relink(ca, areas);
push_undo = true;
redraw = true;
changed = true;
if (!shift) {
panel_timeline->creating = false;
@@ -790,7 +789,6 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
}
}
} else if (panel_timeline->moving_proc) {
repaint = true;
if (panel_timeline->ghosts.size() > 0) {
const Ghost& first_ghost = panel_timeline->ghosts.at(0);
@@ -955,10 +953,10 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
}
}
push_undo = true;
redraw = true;
changed = true;
}
} else if (panel_timeline->selecting || panel_timeline->rect_select_proc) {
repaint = true;
changed = true;
} else if (panel_timeline->splitting) {
bool split = false;
for (int i=0;i<panel_timeline->split_tracks.size();i++) {
@@ -969,7 +967,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
}
if (split) {
push_undo = true;
redraw = true;
changed = true;
}
panel_timeline->split_cache.clear();
}
@@ -1006,14 +1004,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
pre_clips.clear();
post_clips.clear();
if (redraw) {
panel_timeline->repaint_timeline(true);
} else {
panel_timeline->update_effect_controls();
if (repaint) {
panel_timeline->repaint_timeline(false);
}
}
update_ui(changed);
}
}
}
@@ -1342,8 +1333,8 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
if (config.edit_tool_also_seeks) {
panel_sequence_viewer->seek(qMin(panel_timeline->drag_frame_start, panel_timeline->cursor_frame));
} else {
panel_timeline->repaint_timeline(false);
} else {
panel_timeline->repaint_timeline();
}
} else if (panel_timeline->moving_init) {
if (track_resizing) {
@@ -1544,7 +1535,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
panel_timeline->moving_proc = true;
}
panel_timeline->repaint_timeline(false);
update_ui(true);
} else if (panel_timeline->splitting) {
int track_start = qMin(panel_timeline->cursor_track, panel_timeline->drag_track_start);
int track_end = qMax(panel_timeline->cursor_track, panel_timeline->drag_track_start);
@@ -1568,7 +1559,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
}
}
}
panel_timeline->repaint_timeline(false);
update_ui(true);
} else if (panel_timeline->rect_select_init) {
if (panel_timeline->rect_select_proc) {
panel_timeline->rect_select_w = event->pos().x() - panel_timeline->rect_select_x;
@@ -1630,7 +1621,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
s.old_track = s.track = clip->track;
}
panel_timeline->repaint_timeline(false);
panel_timeline->repaint_timeline();
} else {
panel_timeline->rect_select_x = event->pos().x();
panel_timeline->rect_select_y = event->pos().y();
@@ -1641,7 +1632,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
}
} else if (isLiveEditing()) {
// redraw because we have a cursor
panel_timeline->repaint_timeline(false);
panel_timeline->repaint_timeline();
} else if (panel_timeline->tool == TIMELINE_TOOL_POINTER ||
panel_timeline->tool == TIMELINE_TOOL_RIPPLE ||
panel_timeline->tool == TIMELINE_TOOL_ROLLING) {
+5 -6
View File
@@ -29,8 +29,7 @@ extern "C" {
ViewerWidget::ViewerWidget(QWidget *parent) :
QOpenGLWidget(parent),
rendering(false),
default_fbo(NULL),
display_sequence(NULL)
default_fbo(NULL)
{
QSurfaceFormat format;
format.setDepthBufferSize(24);
@@ -44,7 +43,7 @@ ViewerWidget::ViewerWidget(QWidget *parent) :
void ViewerWidget::deleteFunction() {
// destroy all textures as well
makeCurrent();
closeActiveClips(display_sequence, true);
closeActiveClips(viewer->seq, true);
doneCurrent();
}
@@ -165,8 +164,8 @@ GLuint ViewerWidget::draw_clip(QOpenGLFramebufferObject* fbo, GLuint texture) {
}
GLuint ViewerWidget::compose_sequence(Clip* nest, bool render_audio) {
Sequence* s = display_sequence;
long playhead = display_sequence->playhead;
Sequence* s = viewer->seq;
long playhead = s->playhead;
if (nest != NULL) {
s = static_cast<Sequence*>(nest->media);
@@ -453,7 +452,7 @@ void ViewerWidget::paintGL() {
// compose video preview
glClearColor(0, 0, 0, 0);
compose_sequence(NULL, (panel_sequence_viewer->playing || rendering));
compose_sequence(NULL, (viewer->playing || rendering));
if (texture_failed) {
if (rendering) {
+2 -2
View File
@@ -9,8 +9,8 @@
#include <QMutex>
#include <QWaitCondition>
class Viewer;
struct Clip;
struct Sequence;
class QOpenGLFramebufferObject;
class ViewerWidget : public QOpenGLWidget
@@ -22,7 +22,7 @@ public:
bool rendering;
void paintGL();
void initializeGL();
Sequence* display_sequence;
Viewer* viewer;
QOpenGLFramebufferObject* default_fbo;
protected: