nested sequences mostly implemented
This commit is contained in:
+45
-4
@@ -5,6 +5,8 @@
|
||||
#include "io/media.h"
|
||||
#include "playback/playback.h"
|
||||
#include "playback/cacher.h"
|
||||
#include "panels/project.h"
|
||||
#include "project/sequence.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@@ -20,11 +22,11 @@ Clip::Clip(Sequence* s) :
|
||||
timeline_out(0),
|
||||
track(0),
|
||||
undeletable(0),
|
||||
texture(NULL),
|
||||
media(NULL),
|
||||
opening_transition(NULL),
|
||||
closing_transition(NULL),
|
||||
media(NULL),
|
||||
pkt(new AVPacket())
|
||||
pkt(new AVPacket()),
|
||||
texture(NULL)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
@@ -69,7 +71,7 @@ void Clip::reset() {
|
||||
cache_A.unread = false;
|
||||
cache_B.unread = false;
|
||||
reached_end = false;
|
||||
reset_audio = false;
|
||||
audio_reset = false;
|
||||
frame_sample_index = false;
|
||||
audio_buffer_write = false;
|
||||
need_new_audio_frame = false;
|
||||
@@ -83,6 +85,26 @@ void Clip::reset() {
|
||||
cache_B.frames = NULL;
|
||||
}
|
||||
|
||||
void Clip::reset_audio() {
|
||||
switch (media_type) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
audio_reset = true;
|
||||
frame_sample_index = 0;
|
||||
audio_buffer_write = 0;
|
||||
reached_end = false;
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* nested_sequence = static_cast<Sequence*>(media);
|
||||
for (int i=0;i<nested_sequence->clip_count();i++) {
|
||||
Clip* c = nested_sequence->get_clip(i);
|
||||
if (c != NULL) c->reset_audio();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Clip::refresh() {
|
||||
// reinitializes all effects... just in case
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
@@ -90,6 +112,25 @@ void Clip::refresh() {
|
||||
}
|
||||
}
|
||||
|
||||
void Clip::run_video_pre_effect_stack(long playhead, int* anchor_x, int* anchor_y) {
|
||||
for (int j=0;j<effects.size();j++) {
|
||||
if (effects.at(j)->is_enabled()) effects.at(j)->process_gl(anchor_x, anchor_y);
|
||||
}
|
||||
|
||||
if (opening_transition != NULL) {
|
||||
int transition_progress = playhead - timeline_in;
|
||||
if (transition_progress < opening_transition->length) {
|
||||
opening_transition->process_transition((double)transition_progress/(double)opening_transition->length);
|
||||
}
|
||||
}
|
||||
if (closing_transition != NULL) {
|
||||
int transition_progress = closing_transition->length - (playhead - timeline_in - getLength() + closing_transition->length);
|
||||
if (transition_progress < closing_transition->length) {
|
||||
closing_transition->process_transition((double)transition_progress/(double)closing_transition->length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Clip::~Clip() {
|
||||
if (open) {
|
||||
close_clip(this);
|
||||
|
||||
+9
-7
@@ -39,20 +39,23 @@ struct Clip
|
||||
Clip(Sequence* s);
|
||||
~Clip();
|
||||
Clip* copy(Sequence* s);
|
||||
void reset_audio();
|
||||
void reset();
|
||||
void refresh();
|
||||
bool undeletable;
|
||||
void run_video_pre_effect_stack(long playhead, int *anchor_x, int *anchor_y);
|
||||
|
||||
// timeline variables
|
||||
Sequence* sequence;
|
||||
bool enabled;
|
||||
long clip_in;
|
||||
long timeline_in;
|
||||
long timeline_out;
|
||||
int track;
|
||||
bool undeletable;
|
||||
int load_id;
|
||||
QString name;
|
||||
long get_timeline_in_with_transition();
|
||||
long get_timeline_out_with_transition();
|
||||
long timeline_in;
|
||||
long timeline_out;
|
||||
long clip_in;
|
||||
int track;
|
||||
quint8 color_r;
|
||||
quint8 color_g;
|
||||
quint8 color_b;
|
||||
@@ -60,7 +63,6 @@ struct Clip
|
||||
void* media; // attached media
|
||||
int media_type;
|
||||
int media_stream;
|
||||
Sequence* sequence;
|
||||
|
||||
// other variables (should be "duplicated" in copy())
|
||||
QList<Effect*> effects;
|
||||
@@ -100,7 +102,7 @@ struct Clip
|
||||
bool need_new_audio_frame;
|
||||
int frame_sample_index;
|
||||
int audio_buffer_write;
|
||||
bool reset_audio;
|
||||
bool audio_reset;
|
||||
bool audio_just_reset;
|
||||
long audio_target_frame;
|
||||
};
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ Effect::Effect(Clip* c, int t, int i) : parent_clip(c), type(t), id(i) {
|
||||
}
|
||||
|
||||
void Effect::init() {
|
||||
qDebug() << "WRONG" << type << id;
|
||||
qDebug() << "[WARNING] Tried to init base Effect class - type:" << type << "- id:" << id;
|
||||
}
|
||||
|
||||
void Effect::field_changed() {
|
||||
|
||||
+1
-1
@@ -486,7 +486,7 @@ void LinkCommand::redo() {
|
||||
}
|
||||
}
|
||||
|
||||
CheckboxCommand::CheckboxCommand(QCheckBox* b) : box(b), done(true), checked(box->isChecked()) {}
|
||||
CheckboxCommand::CheckboxCommand(QCheckBox* b) : box(b), checked(box->isChecked()), done(true) {}
|
||||
|
||||
CheckboxCommand::~CheckboxCommand() {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user