diff --git a/effects/effect.cpp b/effects/effect.cpp index 059c9e35c..0f8a6da14 100644 --- a/effects/effect.cpp +++ b/effects/effect.cpp @@ -33,6 +33,7 @@ #include "effects/internal/linearfadetransition.h" #include "effects/internal/exponentialfadetransition.h" #include "effects/internal/logarithmicfadetransition.h" +#include "effects/internal/cornerpineffect.h" #include #include @@ -68,6 +69,7 @@ Effect* create_effect(Clip* c, const EffectMeta* em) { case EFFECT_INTERNAL_LINEARFADE: return new LinearFadeTransition(c, em); case EFFECT_INTERNAL_EXPONENTIALFADE: return new ExponentialFadeTransition(c, em); case EFFECT_INTERNAL_LOGARITHMICFADE: return new LogarithmicFadeTransition(c, em); + case EFFECT_INTERNAL_CORNERPIN: return new CornerPinEffect(c, em); } } else { dout << "[ERROR] Invalid effect data"; @@ -117,6 +119,11 @@ void load_internal_effects() { em.internal = EFFECT_INTERNAL_TRANSFORM; video_effects.append(em); + em.name = "Corner Pin"; + em.category = "Distort"; + em.internal = EFFECT_INTERNAL_CORNERPIN; + video_effects.append(em); + em.name = "Text"; em.category = "Render"; em.internal = EFFECT_INTERNAL_TEXT; @@ -132,7 +139,6 @@ void load_internal_effects() { em.internal = EFFECT_INTERNAL_SHAKE; video_effects.append(em); - // internal transitions em.type = EFFECT_TYPE_TRANSITION; em.category = ""; @@ -766,6 +772,7 @@ Effect* Effect::copy(Clip* c) { void Effect::process_shader(double timecode) { glslProgram->setUniformValue("resolution", parent_clip->getWidth(), parent_clip->getHeight()); + glslProgram->setUniformValue("time", (GLfloat) timecode); for (int i=0;iadd_field(EFFECT_FIELD_DOUBLE); bottom_right_y = bottom_right->add_field(EFFECT_FIELD_DOUBLE); - connect(intensity_val, SIGNAL(changed()), this, SLOT(field_changed())); - connect(rotation_val, SIGNAL(changed()), this, SLOT(field_changed())); - connect(frequency_val, SIGNAL(changed()), this, SLOT(field_changed())); + connect(top_left_x, SIGNAL(changed()), this, SLOT(field_changed())); + connect(top_left_y, SIGNAL(changed()), this, SLOT(field_changed())); + connect(top_right_x, SIGNAL(changed()), this, SLOT(field_changed())); + connect(top_right_y, SIGNAL(changed()), this, SLOT(field_changed())); + connect(bottom_left_x, SIGNAL(changed()), this, SLOT(field_changed())); + connect(bottom_left_y, SIGNAL(changed()), this, SLOT(field_changed())); + connect(bottom_right_x, SIGNAL(changed()), this, SLOT(field_changed())); + connect(bottom_right_y, SIGNAL(changed()), this, SLOT(field_changed())); } void CornerPinEffect::process_coords(double timecode, GLTextureCoords &coords) { diff --git a/effects/internal/transformeffect.cpp b/effects/internal/transformeffect.cpp index 45beb3d29..2bdd5e780 100644 --- a/effects/internal/transformeffect.cpp +++ b/effects/internal/transformeffect.cpp @@ -144,13 +144,13 @@ void TransformEffect::process_coords(double timecode, GLTextureCoords& coords) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); break; case BLEND_MODE_OVERLAY: - glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA); + glBlendFunc(GL_SRC_ALPHA, GL_ONE); break; case BLEND_MODE_SCREEN: glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); break; case BLEND_MODE_MULTIPLY: - glBlendFunc(GL_DST_COLOR, GL_ZERO); + glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA); break; default: dout << "[ERROR] Invalid blend mode. This is a bug - please contact developers"; diff --git a/panels/viewer.cpp b/panels/viewer.cpp index 9e10566f7..3e77fb2b1 100644 --- a/panels/viewer.cpp +++ b/panels/viewer.cpp @@ -11,6 +11,7 @@ #include "project/undo.h" #include "ui/audiomonitor.h" #include "ui_timeline.h" +#include "playback/playback.h" #include "debug.h" #define FRAMES_IN_ONE_MINUTE 1798 // 1800 - 2 @@ -99,7 +100,8 @@ void Viewer::reset_all_audio() { void Viewer::assert_audio_device() { if (audio_output->format().sampleRate() != seq->audio_frequency || audio_output->format().channelCount() != av_get_channel_layout_nb_channels(seq->audio_layout)) { - init_audio(seq); + closeActiveClips(seq, true); + init_audio(seq); } } @@ -529,6 +531,8 @@ void Viewer::set_sequence(bool main, Sequence *s) { bool null_sequence = (seq == NULL); + init_audio(seq); + ui->headers->setEnabled(!null_sequence); ui->currentTimecode->setEnabled(!null_sequence); ui->openGLWidget->setEnabled(!null_sequence); @@ -539,8 +543,6 @@ void Viewer::set_sequence(bool main, Sequence *s) { ui->pushButton_4->setEnabled(!null_sequence); ui->pushButton_5->setEnabled(!null_sequence); - init_audio(seq); - if (!null_sequence) { ui->currentTimecode->set_frame_rate(seq->frame_rate); @@ -562,7 +564,7 @@ void Viewer::set_sequence(bool main, Sequence *s) { update_header_zoom(); - viewer_widget->update(); + viewer_widget->update(); update(); } diff --git a/playback/audio.cpp b/playback/audio.cpp index 1e2fcb5c2..5015ef04a 100644 --- a/playback/audio.cpp +++ b/playback/audio.cpp @@ -55,6 +55,7 @@ void init_audio(Sequence* s) { } audio_output = new QAudioOutput(audio_format); + dout << "made output;"; audio_output->setNotifyInterval(5); // connect @@ -68,6 +69,8 @@ void init_audio(Sequence* s) { clear_audio_ibuffer(); } + + dout << "h"; } void stop_audio() { diff --git a/playback/cacher.cpp b/playback/cacher.cpp index 3a26937e8..92ce04d99 100644 --- a/playback/cacher.cpp +++ b/playback/cacher.cpp @@ -297,10 +297,10 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector& nests) { dout << "fsi-post-post:" << c->frame_sample_index; #endif if (c->audio_buffer_write == 0) { - c->audio_buffer_write = get_buffer_offset_from_frame(sequence, qMax(timeline_in, c->audio_target_frame)); + c->audio_buffer_write = get_buffer_offset_from_frame((sequence == NULL) ? c->sequence : sequence, qMax(timeline_in, c->audio_target_frame)); if (frame_skip > 0) { - int target = get_buffer_offset_from_frame(sequence, qMax(timeline_in + frame_skip, c->audio_target_frame)); + int target = get_buffer_offset_from_frame((sequence == NULL) ? c->sequence : sequence, qMax(timeline_in + frame_skip, c->audio_target_frame)); c->frame_sample_index += (target - c->audio_buffer_write); c->audio_buffer_write = target; } @@ -328,7 +328,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector& nests) { // apply any audio effects to the data if (nb_bytes == INT_MAX) nb_bytes = frame->nb_samples * av_get_bytes_per_sample(static_cast(frame->format)) * frame->channels; if (new_frame) { - apply_audio_effects(c, bytes_to_seconds(c->audio_buffer_write, 2, c->sequence->audio_frequency) + audio_ibuffer_timecode + ((double)c->clip_in/c->sequence->frame_rate) - ((double)timeline_in/sequence->frame_rate), frame, nb_bytes, nests); + apply_audio_effects(c, bytes_to_seconds(c->audio_buffer_write, 2, c->sequence->audio_frequency) + audio_ibuffer_timecode + ((double)c->clip_in/c->sequence->frame_rate) - ((double)timeline_in/((sequence == NULL) ? c->sequence->frame_rate : sequence->frame_rate)), frame, nb_bytes, nests); } } break; @@ -360,7 +360,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector& nests) { if (frame->nb_samples == 0) { break; } else { - long buffer_timeline_out = get_buffer_offset_from_frame(sequence, timeline_out); + long buffer_timeline_out = get_buffer_offset_from_frame((sequence == NULL) ? c->sequence : sequence, timeline_out); audio_write_lock.lock(); while (c->frame_sample_index < nb_bytes @@ -786,7 +786,7 @@ void open_clip_worker(Clip* clip) { dout << "[ERROR] Could not set output sample format"; } - int target_sample_rate = sequence->audio_frequency; + int target_sample_rate = audio_output->format().sampleRate(); if (qFuzzyCompare(clip->speed, 1.0)) { avfilter_link(clip->buffersrc_ctx, 0, clip->buffersink_ctx, 0);