several conversions to smart pointers
This commit is contained in:
@@ -47,7 +47,7 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
||||
|
||||
int row = 0;
|
||||
|
||||
Footage* f = item->to_footage();
|
||||
FootagePtr f = item->to_footage();
|
||||
|
||||
grid->addWidget(new QLabel(tr("Tracks:"), this), row, 0, 1, 2);
|
||||
row++;
|
||||
@@ -143,7 +143,7 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
||||
}
|
||||
|
||||
void MediaPropertiesDialog::accept() {
|
||||
Footage* f = item->to_footage();
|
||||
FootagePtr f = item->to_footage();
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
class MediaPropertiesDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MediaPropertiesDialog(QWidget *parent, Media* i);
|
||||
MediaPropertiesDialog(QWidget *parent, Media* i);
|
||||
private:
|
||||
QComboBox* interlacing_box;
|
||||
QLineEdit* name_box;
|
||||
Media* item;
|
||||
Media* item;
|
||||
QListWidget* track_list;
|
||||
QDoubleSpinBox* conform_fr;
|
||||
QCheckBox* premultiply_alpha_setting;
|
||||
|
||||
@@ -85,7 +85,7 @@ void NewSequenceDialog::set_sequence_name(const QString& s) {
|
||||
|
||||
void NewSequenceDialog::create() {
|
||||
if (existing_sequence == nullptr) {
|
||||
Sequence* s = new Sequence();
|
||||
SequencePtr s(new Sequence());
|
||||
|
||||
s->name = sequence_name_edit->text();
|
||||
s->width = width_numeric->value();
|
||||
@@ -112,7 +112,7 @@ void NewSequenceDialog::create() {
|
||||
ca->append(esc);
|
||||
|
||||
for (int i=0;i<existing_sequence->clips.size();i++) {
|
||||
Clip* c = existing_sequence->clips.at(i);
|
||||
ClipPtr c = existing_sequence->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
c->refactor_frame_rate(ca, multiplier, true);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class NewSequenceDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NewSequenceDialog(QWidget *parent = 0, Media* existing = 0);
|
||||
explicit NewSequenceDialog(QWidget *parent = nullptr, Media* existing = nullptr);
|
||||
~NewSequenceDialog();
|
||||
|
||||
void set_sequence_name(const QString& s);
|
||||
@@ -45,8 +45,8 @@ private slots:
|
||||
void preset_changed(int index);
|
||||
|
||||
private:
|
||||
Sequence* existing_sequence;
|
||||
Media* existing_item;
|
||||
SequencePtr existing_sequence;
|
||||
Media* existing_item;
|
||||
|
||||
void setup_ui();
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "project/footage.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Footage *> &footage) :
|
||||
ProxyDialog::ProxyDialog(QWidget *parent, const QVector<FootagePtr> &footage) :
|
||||
QDialog(parent),
|
||||
selected_footage(footage)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
class ProxyDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProxyDialog(QWidget* parent, const QVector<Footage*>& footage);
|
||||
ProxyDialog(QWidget* parent, const QVector<FootagePtr>& footage);
|
||||
public slots:
|
||||
// called if user clicks "OK" on the dialog
|
||||
virtual void accept() override;
|
||||
@@ -51,7 +51,7 @@ private:
|
||||
QString proxy_folder_name;
|
||||
|
||||
// list of footage to make proxies for
|
||||
QVector<Footage*> selected_footage;
|
||||
QVector<FootagePtr> selected_footage;
|
||||
private slots:
|
||||
// triggered when the user changes the index in the location combobox
|
||||
void location_changed(int i);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
|
||||
ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media *old_media) :
|
||||
ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media* old_media) :
|
||||
QDialog(parent),
|
||||
media(old_media)
|
||||
{
|
||||
@@ -80,7 +80,7 @@ void ReplaceClipMediaDialog::replace() {
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else {
|
||||
Media* new_item = static_cast<Media*>(selected_items.at(0).internalPointer());
|
||||
Media* new_item = static_cast<Media*>(selected_items.at(0).internalPointer());
|
||||
if (media == new_item) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
@@ -111,7 +111,7 @@ void ReplaceClipMediaDialog::replace() {
|
||||
);
|
||||
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr && c->media == media) {
|
||||
rcmc->clips.append(c);
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@
|
||||
class ReplaceClipMediaDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ReplaceClipMediaDialog(QWidget* parent, Media *old_media);
|
||||
ReplaceClipMediaDialog(QWidget* parent, Media* old_media);
|
||||
private slots:
|
||||
void replace();
|
||||
private:
|
||||
Media* media;
|
||||
Media* media;
|
||||
QTreeView* tree;
|
||||
QCheckBox* use_same_media_in_points;
|
||||
};
|
||||
|
||||
+13
-13
@@ -94,7 +94,7 @@ void SpeedDialog::run() {
|
||||
current_length = -1;
|
||||
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
|
||||
double clip_percent;
|
||||
|
||||
@@ -103,7 +103,7 @@ void SpeedDialog::run() {
|
||||
if (c->track < 0) {
|
||||
bool process_video = true;
|
||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* m = c->media->to_footage();
|
||||
FootagePtr m = c->media->to_footage();
|
||||
FootageStream* ms = m->get_stream_from_file_index(true, c->media_stream);
|
||||
if (ms != nullptr && ms->infinite_length) {
|
||||
process_video = false;
|
||||
@@ -187,7 +187,7 @@ void SpeedDialog::percent_update() {
|
||||
long len_val = -1;
|
||||
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
|
||||
// get frame rate
|
||||
if (frame_rate->isEnabled() && c->track < 0) {
|
||||
@@ -222,7 +222,7 @@ void SpeedDialog::duration_update() {
|
||||
double fr_val = qSNaN();
|
||||
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
|
||||
// get percent
|
||||
long clip_default_length = qRound(c->getLength() * c->speed);
|
||||
@@ -265,7 +265,7 @@ void SpeedDialog::frame_rate_update() {
|
||||
|
||||
// analyze video clips
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
|
||||
// check if all selected clips are currently the same speed
|
||||
if (i == 0) {
|
||||
@@ -297,7 +297,7 @@ void SpeedDialog::frame_rate_update() {
|
||||
|
||||
// analyze audio clips
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
|
||||
if (c->track >= 0) {
|
||||
long new_clip_len = (qIsNaN(old_pc_val) || qIsNaN(pc_val)) ? c->getLength() : ((c->getLength() * c->speed) / pc_val);
|
||||
@@ -312,7 +312,7 @@ void SpeedDialog::frame_rate_update() {
|
||||
duration->set_value((len_val == -1) ? qSNaN() : len_val, false);
|
||||
}
|
||||
|
||||
void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, long& lr) {
|
||||
void set_speed(ComboAction* ca, ClipPtr c, double speed, bool ripple, long& ep, long& lr) {
|
||||
panel_timeline->deselect_area(c->timeline_in, c->timeline_out, c->track);
|
||||
|
||||
long proposed_out = c->timeline_out;
|
||||
@@ -321,7 +321,7 @@ void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, lo
|
||||
ca->append(new SetSpeedAction(c, speed));
|
||||
if (!ripple && proposed_out > c->timeline_out) {
|
||||
for (int i=0;i<c->sequence->clips.size();i++) {
|
||||
Clip* compare = c->sequence->clips.at(i);
|
||||
ClipPtr compare = c->sequence->clips.at(i);
|
||||
if (compare != nullptr
|
||||
&& compare->track == c->track
|
||||
&& compare->timeline_in >= c->timeline_out && compare->timeline_in < proposed_out) {
|
||||
@@ -352,7 +352,7 @@ void SpeedDialog::accept() {
|
||||
long longest_ripple = LONG_MIN;
|
||||
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
if (c->open) close_clip(c, true);
|
||||
|
||||
if (c->track >= 0
|
||||
@@ -372,7 +372,7 @@ void SpeedDialog::accept() {
|
||||
if (!qIsNaN(percent->value())) {
|
||||
// simply set speed
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
set_speed(ca, c, percent->value(), ripple->isChecked(), earliest_point, longest_ripple);
|
||||
}
|
||||
} else if (!qIsNaN(frame_rate->value())) {
|
||||
@@ -382,7 +382,7 @@ void SpeedDialog::accept() {
|
||||
|
||||
// see if we can use the frame rate to change all the speeds
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
if (i == 0) {
|
||||
cached_speed = c->speed;
|
||||
} else if (!qFuzzyCompare(cached_speed, c->speed)) {
|
||||
@@ -400,7 +400,7 @@ void SpeedDialog::accept() {
|
||||
|
||||
// make changes
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
if (c->track < 0) {
|
||||
set_speed(ca, c, frame_rate->value() / c->getMediaFrameRate(), ripple->isChecked(), earliest_point, longest_ripple);
|
||||
} else if (can_change_all) {
|
||||
@@ -410,7 +410,7 @@ void SpeedDialog::accept() {
|
||||
} else if (!qIsNaN(duration->value())) {
|
||||
// simply set duration
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
set_speed(ca, c, (c->getLength() * c->speed) / duration->value(), ripple->isChecked(), earliest_point, longest_ripple);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class SpeedDialog : public QDialog
|
||||
Q_OBJECT
|
||||
public:
|
||||
SpeedDialog(QWidget* parent = 0);
|
||||
QVector<Clip*> clips;
|
||||
QVector<ClipPtr> clips;
|
||||
|
||||
void run();
|
||||
private slots:
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QtMath>
|
||||
|
||||
AudioNoiseEffect::AudioNoiseEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
AudioNoiseEffect::AudioNoiseEffect(ClipPtr c, const EffectMeta *em) : Effect(c, em) {
|
||||
amount_val = add_row(tr("Amount"))->add_field(EFFECT_FIELD_DOUBLE, "amount");
|
||||
amount_val->set_double_minimum_value(0);
|
||||
amount_val->set_double_maximum_value(100);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
class AudioNoiseEffect : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
AudioNoiseEffect(Clip* c, const EffectMeta* em);
|
||||
AudioNoiseEffect(ClipPtr c, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
|
||||
EffectField* amount_val;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "project/clip.h"
|
||||
#include "debug.h"
|
||||
|
||||
CornerPinEffect::CornerPinEffect(Clip *c, const EffectMeta *em) : Effect(c, em) {
|
||||
CornerPinEffect::CornerPinEffect(ClipPtr c, const EffectMeta *em) : Effect(c, em) {
|
||||
enable_coords = true;
|
||||
enable_shader = true;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
class CornerPinEffect : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
CornerPinEffect(Clip* c, const EffectMeta* em);
|
||||
CornerPinEffect(ClipPtr c, const EffectMeta* em);
|
||||
void process_coords(double timecode, GLTextureCoords& coords, int data);
|
||||
void process_shader(double timecode, GLTextureCoords& coords, int iterations);
|
||||
void gizmo_draw(double timecode, GLTextureCoords& coords);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <QOpenGLFunctions>
|
||||
|
||||
CrossDissolveTransition::CrossDissolveTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {
|
||||
CrossDissolveTransition::CrossDissolveTransition(ClipPtr c, ClipPtr s, const EffectMeta* em) : Transition(c, s, em) {
|
||||
enable_coords = true;
|
||||
|
||||
// add_row("Smooth")->add_field(EFFECT_FIELD_BOOL, "smooth");
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
class CrossDissolveTransition : public Transition {
|
||||
public:
|
||||
CrossDissolveTransition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
CrossDissolveTransition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||
void process_coords(double timecode, GLTextureCoords &, int data);
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
CubeTransition::CubeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {
|
||||
CubeTransition::CubeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em) : Transition(c, s, em) {
|
||||
enable_coords = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
class CubeTransition : public Transition {
|
||||
public:
|
||||
CubeTransition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
CubeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||
void process_coords(double timecode, GLTextureCoords &, int data);
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <QtMath>
|
||||
|
||||
ExponentialFadeTransition::ExponentialFadeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {}
|
||||
ExponentialFadeTransition::ExponentialFadeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em) : Transition(c, s, em) {}
|
||||
|
||||
void ExponentialFadeTransition::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int type) {
|
||||
double interval = (timecode_end-timecode_start)/nb_bytes;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
class ExponentialFadeTransition : public Transition {
|
||||
public:
|
||||
ExponentialFadeTransition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
ExponentialFadeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#define FILL_TYPE_LEFT 0
|
||||
#define FILL_TYPE_RIGHT 1
|
||||
|
||||
FillLeftRightEffect::FillLeftRightEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
FillLeftRightEffect::FillLeftRightEffect(ClipPtr c, const EffectMeta *em) : Effect(c, em) {
|
||||
EffectRow* type_row = add_row(tr("Type"));
|
||||
fill_type = type_row->add_field(EFFECT_FIELD_COMBO, "type");
|
||||
fill_type->add_combo_item(tr("Fill Left with Right"), FILL_TYPE_LEFT);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
class FillLeftRightEffect : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FillLeftRightEffect(Clip* c, const EffectMeta* em);
|
||||
FillLeftRightEffect(ClipPtr c, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
private:
|
||||
EffectField* fill_type;
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef void (*f0rGetPluginInfo)(f0r_plugin_info_t* info);
|
||||
typedef void (*f0rSetParamValue) (f0r_instance_t instance,
|
||||
f0r_param_t param, int param_index);
|
||||
|
||||
Frei0rEffect::Frei0rEffect(Clip *c, const EffectMeta *em) :
|
||||
Frei0rEffect::Frei0rEffect(ClipPtr c, const EffectMeta *em) :
|
||||
Effect(c, em),
|
||||
open(false)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef void (*f0rGetParamInfo)(f0r_param_info_t * info,
|
||||
class Frei0rEffect : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Frei0rEffect(Clip* c, const EffectMeta* em);
|
||||
Frei0rEffect(ClipPtr c, const EffectMeta* em);
|
||||
~Frei0rEffect();
|
||||
|
||||
virtual void process_image(double timecode, uint8_t* input, uint8_t* output, int size);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "linearfadetransition.h"
|
||||
|
||||
LinearFadeTransition::LinearFadeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {}
|
||||
LinearFadeTransition::LinearFadeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em) : Transition(c, s, em) {}
|
||||
|
||||
void LinearFadeTransition::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int type) {
|
||||
double interval = (timecode_end-timecode_start)/nb_bytes;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
class LinearFadeTransition : public Transition {
|
||||
public:
|
||||
LinearFadeTransition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
LinearFadeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <QtMath>
|
||||
|
||||
LogarithmicFadeTransition::LogarithmicFadeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {}
|
||||
LogarithmicFadeTransition::LogarithmicFadeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em) : Transition(c, s, em) {}
|
||||
|
||||
void LogarithmicFadeTransition::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int type) {
|
||||
double interval = (timecode_end-timecode_start)/nb_bytes;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
class LogarithmicFadeTransition : public Transition {
|
||||
public:
|
||||
LogarithmicFadeTransition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
LogarithmicFadeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/collapsiblewidget.h"
|
||||
|
||||
PanEffect::PanEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
PanEffect::PanEffect(ClipPtr c, const EffectMeta *em) : Effect(c, em) {
|
||||
EffectRow* pan_row = add_row(tr("Pan"));
|
||||
pan_val = pan_row->add_field(EFFECT_FIELD_DOUBLE, "pan");
|
||||
pan_val->set_double_minimum_value(-100);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
class PanEffect : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PanEffect(Clip* c, const EffectMeta* em);
|
||||
PanEffect(ClipPtr c, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
|
||||
EffectField* pan_val;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
ShakeEffect::ShakeEffect(Clip *c, const EffectMeta *em) : Effect(c, em) {
|
||||
ShakeEffect::ShakeEffect(ClipPtr c, const EffectMeta *em) : Effect(c, em) {
|
||||
enable_coords = true;
|
||||
|
||||
EffectRow* intensity_row = add_row(tr("Intensity"));
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
class ShakeEffect : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ShakeEffect(Clip* c, const EffectMeta* em);
|
||||
ShakeEffect(ClipPtr c, const EffectMeta* em);
|
||||
void process_coords(double timecode, GLTextureCoords& coords, int data);
|
||||
|
||||
EffectField* intensity_val;
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#define SMPTE_STRIP_COUNT 3
|
||||
#define SMPTE_LOWER_BARS 4
|
||||
|
||||
SolidEffect::SolidEffect(Clip* c, const EffectMeta* em) : Effect(c, em) {
|
||||
SolidEffect::SolidEffect(ClipPtr c, const EffectMeta* em) : Effect(c, em) {
|
||||
enable_superimpose = true;
|
||||
|
||||
solid_type = add_row(tr("Type"))->add_field(EFFECT_FIELD_COMBO, "type");
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
class SolidEffect : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SolidEffect(Clip* c, const EffectMeta *em);
|
||||
SolidEffect(ClipPtr c, const EffectMeta *em);
|
||||
void redraw(double timecode);
|
||||
private slots:
|
||||
void ui_update(int);
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "io/config.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
TextEffect::TextEffect(Clip *c, const EffectMeta* em) :
|
||||
TextEffect::TextEffect(ClipPtr c, const EffectMeta* em) :
|
||||
Effect(c, em)
|
||||
{
|
||||
enable_superimpose = true;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
class TextEffect : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TextEffect(Clip* c, const EffectMeta *em);
|
||||
TextEffect(ClipPtr c, const EffectMeta *em);
|
||||
void redraw(double timecode);
|
||||
|
||||
EffectField* text_val;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "io/config.h"
|
||||
#include "playback/playback.h"
|
||||
|
||||
TimecodeEffect::TimecodeEffect(Clip *c, const EffectMeta* em) :
|
||||
TimecodeEffect::TimecodeEffect(ClipPtr c, const EffectMeta* em) :
|
||||
Effect(c, em)
|
||||
{
|
||||
enable_always_update = true;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
class TimecodeEffect : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TimecodeEffect(Clip* c, const EffectMeta *em);
|
||||
TimecodeEffect(ClipPtr c, const EffectMeta *em);
|
||||
void redraw(double timecode);
|
||||
EffectField * scale_val;
|
||||
EffectField * color_val;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "project/sequence.h"
|
||||
#include "debug.h"
|
||||
|
||||
ToneEffect::ToneEffect(Clip* c, const EffectMeta *em) : Effect(c, em), sinX(INT_MIN) {
|
||||
ToneEffect::ToneEffect(ClipPtr c, const EffectMeta *em) : Effect(c, em), sinX(INT_MIN) {
|
||||
type_val = add_row(tr("Type"))->add_field(EFFECT_FIELD_COMBO, "type");
|
||||
type_val->add_combo_item("Sine", TONE_TYPE_SINE);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
class ToneEffect : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ToneEffect(Clip *c, const EffectMeta* em);
|
||||
ToneEffect(ClipPtr c, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
|
||||
EffectField* type_val;
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "panels/viewer.h"
|
||||
#include "ui/viewerwidget.h"
|
||||
|
||||
TransformEffect::TransformEffect(Clip* c, const EffectMeta* em) : Effect(c, em) {
|
||||
TransformEffect::TransformEffect(ClipPtr c, const EffectMeta* em) : Effect(c, em) {
|
||||
enable_coords = true;
|
||||
|
||||
EffectRow* position_row = add_row(tr("Position"));
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
class TransformEffect : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TransformEffect(Clip* c, const EffectMeta* em);
|
||||
TransformEffect(ClipPtr c, const EffectMeta* em);
|
||||
void refresh();
|
||||
void process_coords(double timecode, GLTextureCoords& coords, int data);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "ui/collapsiblewidget.h"
|
||||
#include "debug.h"
|
||||
|
||||
VoidEffect::VoidEffect(Clip *c, const QString& n) : Effect(c, nullptr) {
|
||||
VoidEffect::VoidEffect(ClipPtr c, const QString& n) : Effect(c, nullptr) {
|
||||
name = n;
|
||||
QString display_name;
|
||||
if (n.isEmpty()) {
|
||||
@@ -43,8 +43,8 @@ VoidEffect::VoidEffect(Clip *c, const QString& n) : Effect(c, nullptr) {
|
||||
meta = &void_meta;
|
||||
}
|
||||
|
||||
Effect *VoidEffect::copy(Clip *c) {
|
||||
Effect* copy = new VoidEffect(c, name);
|
||||
EffectPtr VoidEffect::copy(ClipPtr c) {
|
||||
EffectPtr copy(new VoidEffect(c, name));
|
||||
copy->set_enabled(is_enabled());
|
||||
copy_field_keyframes(copy);
|
||||
return copy;
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
class VoidEffect : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
VoidEffect(Clip* c, const QString& n);
|
||||
VoidEffect(ClipPtr c, const QString& n);
|
||||
|
||||
virtual Effect* copy(Clip* c) override;
|
||||
virtual EffectPtr copy(ClipPtr c) override;
|
||||
virtual void load(QXmlStreamReader &stream) override;
|
||||
virtual void save(QXmlStreamWriter &stream) override;
|
||||
private:
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/collapsiblewidget.h"
|
||||
|
||||
VolumeEffect::VolumeEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
VolumeEffect::VolumeEffect(ClipPtr c, const EffectMeta *em) : Effect(c, em) {
|
||||
EffectRow* volume_row = add_row(tr("Volume"));
|
||||
volume_val = volume_row->add_field(EFFECT_FIELD_DOUBLE, "volume");
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
class VolumeEffect : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
VolumeEffect(Clip* c, const EffectMeta* em);
|
||||
VolumeEffect(ClipPtr c, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
|
||||
EffectField* volume_val;
|
||||
|
||||
@@ -252,7 +252,7 @@ void VSTHost::processAudio(long numFrames) {
|
||||
plugin->processReplacing(plugin, inputs, outputs, numFrames);
|
||||
}
|
||||
|
||||
VSTHost::VSTHost(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
VSTHost::VSTHost(ClipPtr c, const EffectMeta *em) : Effect(c, em) {
|
||||
plugin = nullptr;
|
||||
|
||||
inputs = new float* [CHANNEL_COUNT];
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef intptr_t (*dispatcherFuncPtr)(AEffect *effect, int32_t opCode, int32_t i
|
||||
class VSTHost : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
VSTHost(Clip* c, const EffectMeta* em);
|
||||
VSTHost(ClipPtr c, const EffectMeta* em);
|
||||
~VSTHost();
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
|
||||
|
||||
+4
-15
@@ -25,21 +25,10 @@
|
||||
#include "project/transition.h"
|
||||
|
||||
int clipboard_type = CLIPBOARD_TYPE_CLIP;
|
||||
QVector<void*> clipboard;
|
||||
QVector<Transition*> clipboard_transitions;
|
||||
QVector<VoidPtr> clipboard;
|
||||
QVector<TransitionPtr> clipboard_transitions;
|
||||
|
||||
void clear_clipboard() {
|
||||
int clipboard_size = clipboard.size();
|
||||
for (int i=0;i<clipboard_size;i++) {
|
||||
if (clipboard_type == CLIPBOARD_TYPE_CLIP) {
|
||||
delete static_cast<Clip*>(clipboard.at(i));
|
||||
} else if (clipboard_type == CLIPBOARD_TYPE_EFFECT) {
|
||||
delete static_cast<Effect*>(clipboard.at(i));
|
||||
}
|
||||
}
|
||||
clipboard_size = clipboard_transitions.size();
|
||||
for (int i=0;i<clipboard_size;i++) {
|
||||
delete clipboard_transitions.at(i);
|
||||
}
|
||||
clipboard.clear();
|
||||
clipboard.clear();
|
||||
clipboard_transitions.clear();
|
||||
}
|
||||
|
||||
+4
-2
@@ -28,9 +28,11 @@
|
||||
#define CLIPBOARD_TYPE_CLIP 0
|
||||
#define CLIPBOARD_TYPE_EFFECT 1
|
||||
|
||||
using VoidPtr = std::shared_ptr<void>;
|
||||
|
||||
extern int clipboard_type;
|
||||
extern QVector<Transition*> clipboard_transitions;
|
||||
extern QVector<void*> clipboard;
|
||||
extern QVector<TransitionPtr> clipboard_transitions;
|
||||
extern QVector<VoidPtr> clipboard;
|
||||
void clear_clipboard();
|
||||
|
||||
#endif // CLIPBOARD_H
|
||||
|
||||
+16
-16
@@ -41,12 +41,12 @@ LoadThread::LoadThread(bool a) : autorecovery(a), cancelled(false) {
|
||||
connect(this, SIGNAL(finished()), this, SLOT(deleteLater()));
|
||||
connect(this, SIGNAL(success()), this, SLOT(success_func()));
|
||||
connect(this, SIGNAL(error()), this, SLOT(error_func()));
|
||||
connect(this, SIGNAL(start_create_dual_transition(const TransitionData*,Clip*,Clip*,const EffectMeta*)), this, SLOT(create_dual_transition(const TransitionData*,Clip*,Clip*,const EffectMeta*)));
|
||||
connect(this, SIGNAL(start_create_effect_ui(QXmlStreamReader*, Clip*, int, const QString*, const EffectMeta*, long, bool)), this, SLOT(create_effect_ui(QXmlStreamReader*, Clip*, int, const QString*, const EffectMeta*, long, bool)));
|
||||
connect(this, SIGNAL(start_create_dual_transition(const TransitionData*,ClipPtr,ClipPtr,const EffectMeta*)), this, SLOT(create_dual_transition(const TransitionData*,ClipPtr,ClipPtr,const EffectMeta*)));
|
||||
connect(this, SIGNAL(start_create_effect_ui(QXmlStreamReader*, ClipPtr, int, const QString*, const EffectMeta*, long, bool)), this, SLOT(create_effect_ui(QXmlStreamReader*, ClipPtr, int, const QString*, const EffectMeta*, long, bool)));
|
||||
connect(this, SIGNAL(start_question(const QString&, const QString &, int)), this, SLOT(question_func(const QString &, const QString &, int)));
|
||||
}
|
||||
|
||||
void LoadThread::load_effect(QXmlStreamReader& stream, Clip* c) {
|
||||
void LoadThread::load_effect(QXmlStreamReader& stream, ClipPtr c) {
|
||||
int effect_id = -1;
|
||||
QString effect_name;
|
||||
bool effect_enabled = true;
|
||||
@@ -194,7 +194,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
int folder = 0;
|
||||
|
||||
Media* item = new Media(0);
|
||||
Footage* f = new Footage();
|
||||
FootagePtr f(new Footage());
|
||||
|
||||
f->using_inout = false;
|
||||
|
||||
@@ -300,7 +300,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Media* parent = nullptr;
|
||||
Sequence* s = new Sequence();
|
||||
SequencePtr s(new Sequence());
|
||||
|
||||
// load attributes about sequence
|
||||
for (int j=0;j<stream.attributes().size();j++) {
|
||||
@@ -367,7 +367,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
} else if (stream.name() == "clip" && stream.isStartElement()) {
|
||||
int media_type = -1;
|
||||
int media_id, stream_id;
|
||||
Clip* c = new Clip(s);
|
||||
ClipPtr c(new Clip(s));
|
||||
|
||||
// backwards compatibility code
|
||||
c->autoscale = false;
|
||||
@@ -428,7 +428,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
if (media_id >= 0) {
|
||||
for (int j=0;j<loaded_media_items.size();j++) {
|
||||
Footage* m = loaded_media_items.at(j)->to_footage();
|
||||
FootagePtr m = loaded_media_items.at(j)->to_footage();
|
||||
if (m->save_id == media_id) {
|
||||
c->media = loaded_media_items.at(j);
|
||||
c->media_stream = stream_id;
|
||||
@@ -487,7 +487,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
// correct links, clip IDs, transitions
|
||||
for (int i=0;i<s->clips.size();i++) {
|
||||
// correct links
|
||||
Clip* correct_clip = s->clips.at(i);
|
||||
ClipPtr correct_clip = s->clips.at(i);
|
||||
for (int j=0;j<correct_clip->linked.size();j++) {
|
||||
bool found = false;
|
||||
for (int k=0;k<s->clips.size();k++) {
|
||||
@@ -508,7 +508,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
);
|
||||
waitCond.wait(&mutex);
|
||||
if (question_btn == QMessageBox::No) {
|
||||
delete s;
|
||||
s.reset();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -534,8 +534,8 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
// create transitions
|
||||
for (int i=0;i<transition_data.size();i++) {
|
||||
const TransitionData& td = transition_data.at(i);
|
||||
Clip* primary = td.otc;
|
||||
Clip* secondary = td.ctc;
|
||||
ClipPtr primary = td.otc;
|
||||
ClipPtr secondary = td.ctc;
|
||||
if (primary != nullptr || secondary != nullptr) {
|
||||
if (primary == nullptr) {
|
||||
primary = secondary;
|
||||
@@ -760,7 +760,7 @@ void LoadThread::success_func() {
|
||||
|
||||
void LoadThread::create_effect_ui(
|
||||
QXmlStreamReader* stream,
|
||||
Clip* c,
|
||||
ClipPtr c,
|
||||
int type,
|
||||
const QString* effect_name,
|
||||
const EffectMeta* meta,
|
||||
@@ -795,12 +795,12 @@ void LoadThread::create_effect_ui(
|
||||
if (type == TA_NO_TRANSITION) {
|
||||
if (meta == nullptr) {
|
||||
// create void effect
|
||||
VoidEffect* ve = new VoidEffect(c, *effect_name);
|
||||
EffectPtr ve(new VoidEffect(c, *effect_name));
|
||||
ve->set_enabled(effect_enabled);
|
||||
ve->load(*stream);
|
||||
c->effects.append(ve);
|
||||
} else {
|
||||
Effect* e = create_effect(c, meta);
|
||||
EffectPtr e(create_effect(c, meta));
|
||||
e->set_enabled(effect_enabled);
|
||||
e->load(*stream);
|
||||
|
||||
@@ -808,7 +808,7 @@ void LoadThread::create_effect_ui(
|
||||
}
|
||||
} else {
|
||||
int transition_index = create_transition(c, nullptr, meta);
|
||||
Transition* t = c->sequence->transitions.at(transition_index);
|
||||
TransitionPtr t = c->sequence->transitions.at(transition_index);
|
||||
if (effect_length > -1) t->set_length(effect_length);
|
||||
t->set_enabled(effect_enabled);
|
||||
t->load(*stream);
|
||||
@@ -825,7 +825,7 @@ void LoadThread::create_effect_ui(
|
||||
waitCond.wakeAll();
|
||||
}
|
||||
|
||||
void LoadThread::create_dual_transition(const TransitionData* td, Clip* primary, Clip* secondary, const EffectMeta* meta) {
|
||||
void LoadThread::create_dual_transition(const TransitionData* td, ClipPtr primary, ClipPtr secondary, const EffectMeta* meta) {
|
||||
// lock mutex - ensures the load thread is suspended while this happens
|
||||
mutex.lock();
|
||||
|
||||
|
||||
+9
-9
@@ -34,8 +34,8 @@ struct TransitionData {
|
||||
int id;
|
||||
QString name;
|
||||
long length;
|
||||
Clip* otc;
|
||||
Clip* ctc;
|
||||
ClipPtr otc;
|
||||
ClipPtr ctc;
|
||||
};
|
||||
|
||||
class LoadThread : public QThread
|
||||
@@ -49,26 +49,26 @@ signals:
|
||||
void start_question(const QString &title, const QString &text, int buttons);
|
||||
void success();
|
||||
void error();
|
||||
void start_create_effect_ui(QXmlStreamReader* stream, Clip* c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||
void start_create_dual_transition(const TransitionData* td, Clip* primary, Clip* secondary, const EffectMeta* meta);
|
||||
void start_create_effect_ui(QXmlStreamReader* stream, ClipPtr c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||
void start_create_dual_transition(const TransitionData* td, ClipPtr primary, ClipPtr secondary, const EffectMeta* meta);
|
||||
void report_progress(int p);
|
||||
private slots:
|
||||
void question_func(const QString &title, const QString &text, int buttons);
|
||||
void error_func();
|
||||
void success_func();
|
||||
void create_effect_ui(QXmlStreamReader* stream, Clip* c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||
void create_dual_transition(const TransitionData* td, Clip* primary, Clip* secondary, const EffectMeta* meta);
|
||||
void create_effect_ui(QXmlStreamReader* stream, ClipPtr c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||
void create_dual_transition(const TransitionData* td, ClipPtr primary, ClipPtr secondary, const EffectMeta* meta);
|
||||
private:
|
||||
bool autorecovery;
|
||||
|
||||
bool load_worker(QFile& f, QXmlStreamReader& stream, int type);
|
||||
void load_effect(QXmlStreamReader& stream, Clip* c);
|
||||
void load_effect(QXmlStreamReader& stream, ClipPtr c);
|
||||
|
||||
void read_next(QXmlStreamReader& stream);
|
||||
void read_next_start_element(QXmlStreamReader& stream);
|
||||
void update_current_element_count(QXmlStreamReader& stream);
|
||||
|
||||
Sequence* open_seq;
|
||||
SequencePtr open_seq;
|
||||
QVector<Media*> loaded_media_items;
|
||||
QDir proj_dir;
|
||||
QDir internal_proj_dir;
|
||||
@@ -79,7 +79,7 @@ private:
|
||||
bool is_element(QXmlStreamReader& stream);
|
||||
|
||||
QVector<Media*> loaded_folders;
|
||||
QVector<Clip*> loaded_clips;
|
||||
QVector<ClipPtr> loaded_clips;
|
||||
QVector<Media*> loaded_sequences;
|
||||
Media* find_loaded_folder_by_id(int id);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
QSemaphore sem(5); // only 5 preview generators can run at one time
|
||||
|
||||
PreviewGenerator::PreviewGenerator(Media* i, Footage* m, bool r) :
|
||||
PreviewGenerator::PreviewGenerator(Media* i, FootagePtr m, bool r) :
|
||||
QThread(nullptr),
|
||||
fmt_ctx(nullptr),
|
||||
media(i),
|
||||
@@ -48,8 +48,7 @@ PreviewGenerator::PreviewGenerator(Media* i, Footage* m, bool r) :
|
||||
replace(r),
|
||||
cancelled(false)
|
||||
{
|
||||
data_path = get_data_path() + "/previews";
|
||||
QDir data_dir(data_path);
|
||||
data_dir = QDir(get_data_dir().filePath("previews"));
|
||||
if (!data_dir.exists()) {
|
||||
data_dir.mkpath(".");
|
||||
}
|
||||
@@ -506,11 +505,11 @@ void PreviewGenerator::generate_waveform() {
|
||||
}
|
||||
|
||||
QString PreviewGenerator::get_thumbnail_path(const QString& hash, const FootageStream& ms) {
|
||||
return data_path + "/" + hash + "t" + QString::number(ms.file_index);
|
||||
return data_dir.filePath(QString("%1t%2").arg(hash, QString::number(ms.file_index)));
|
||||
}
|
||||
|
||||
QString PreviewGenerator::get_waveform_path(const QString& hash, const FootageStream& ms) {
|
||||
return data_path + "/" + hash + "w" + QString::number(ms.file_index);
|
||||
return data_dir.filePath(QString("%1w%2").arg(hash, QString::number(ms.file_index)));
|
||||
}
|
||||
|
||||
void PreviewGenerator::run() {
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <QThread>
|
||||
#include <QSemaphore>
|
||||
#include <QDir>
|
||||
|
||||
enum IconType {
|
||||
ICON_TYPE_VIDEO,
|
||||
@@ -45,7 +46,7 @@ class PreviewGenerator : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreviewGenerator(Media*, Footage*, bool);
|
||||
PreviewGenerator(Media*, FootagePtr, bool);
|
||||
void run();
|
||||
void cancel();
|
||||
signals:
|
||||
@@ -57,12 +58,12 @@ private:
|
||||
void finalize_media();
|
||||
AVFormatContext* fmt_ctx;
|
||||
Media* media;
|
||||
Footage* footage;
|
||||
FootagePtr footage;
|
||||
bool retrieve_duration;
|
||||
bool contains_still_image;
|
||||
bool replace;
|
||||
bool cancelled;
|
||||
QString data_path;
|
||||
bool cancelled;
|
||||
QDir data_dir;
|
||||
QString get_thumbnail_path(const QString &hash, const FootageStream &ms);
|
||||
QString get_waveform_path(const QString& hash, const FootageStream &ms);
|
||||
};
|
||||
|
||||
@@ -399,7 +399,7 @@ void ProxyGenerator::cancel() {
|
||||
wait();
|
||||
}
|
||||
|
||||
double ProxyGenerator::get_proxy_progress(Footage *f) {
|
||||
double ProxyGenerator::get_proxy_progress(FootagePtr f) {
|
||||
if (proxy_queue.first().footage == f) {
|
||||
return current_progress;
|
||||
}
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@
|
||||
#include "project/footage.h"
|
||||
|
||||
struct ProxyInfo {
|
||||
Footage* footage;
|
||||
FootagePtr footage;
|
||||
double size_multiplier;
|
||||
int codec_type;
|
||||
QString path;
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
void run();
|
||||
void queue(const ProxyInfo& info);
|
||||
void cancel();
|
||||
double get_proxy_progress(Footage* f);
|
||||
double get_proxy_progress(FootagePtr f);
|
||||
private:
|
||||
// queue of footage to process proxies for
|
||||
QVector<ProxyInfo> proxy_queue;
|
||||
|
||||
@@ -32,7 +32,7 @@ extern "C" {
|
||||
#include <libavfilter/avfilter.h>
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int main(int argc, char *argv[]) {
|
||||
olive::Global = std::unique_ptr<OliveGlobal>(new OliveGlobal);
|
||||
|
||||
bool launch_fullscreen = false;
|
||||
|
||||
@@ -64,6 +64,8 @@
|
||||
#include <QPushButton>
|
||||
#include <QTranslator>
|
||||
|
||||
Q_DECLARE_METATYPE(ClipPtr);
|
||||
|
||||
MainWindow* olive::MainWindow;
|
||||
|
||||
#define DEFAULT_CSS "QPushButton::checked { background: rgb(25, 25, 25); }"
|
||||
@@ -100,6 +102,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
first_show(true)
|
||||
{
|
||||
qRegisterMetaType<ClipPtr>();
|
||||
|
||||
init_custom_cursors();
|
||||
|
||||
open_debug_file();
|
||||
|
||||
@@ -148,7 +148,8 @@ SOURCES += \
|
||||
ui/cursors.cpp \
|
||||
ui/menuhelper.cpp \
|
||||
oliveglobal.cpp \
|
||||
ui/focusfilter.cpp
|
||||
ui/focusfilter.cpp \
|
||||
project/comboaction.cpp
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h \
|
||||
@@ -254,7 +255,8 @@ HEADERS += \
|
||||
ui/menuhelper.h \
|
||||
oliveglobal.h \
|
||||
project/projectelements.h \
|
||||
ui/focusfilter.h
|
||||
ui/focusfilter.h \
|
||||
project/comboaction.h
|
||||
|
||||
FORMS +=
|
||||
|
||||
|
||||
+1
-1
@@ -295,7 +295,7 @@ void OliveGlobal::open_speed_dialog() {
|
||||
if (olive::ActiveSequence != nullptr) {
|
||||
SpeedDialog s(olive::MainWindow);
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr && is_clip_selected(c, true)) {
|
||||
s.clips.append(c);
|
||||
}
|
||||
|
||||
+11
-11
@@ -100,7 +100,7 @@ void EffectControls::set_zoom(bool in) {
|
||||
void EffectControls::menu_select(QAction* q) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
if ((c->track < 0) == (effect_menu_subtype == EFFECT_TYPE_VIDEO)) {
|
||||
const EffectMeta* meta = reinterpret_cast<const EffectMeta*>(q->data().value<quintptr>());
|
||||
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
||||
@@ -140,9 +140,9 @@ void EffectControls::copy(bool del) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : nullptr;
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
Effect* effect = c->effects.at(j);
|
||||
EffectPtr effect = c->effects.at(j);
|
||||
if (effect->container->selected) {
|
||||
if (!cleared) {
|
||||
clear_clipboard();
|
||||
@@ -150,7 +150,7 @@ void EffectControls::copy(bool del) {
|
||||
clipboard_type = CLIPBOARD_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
clipboard.append(effect->copy(nullptr));
|
||||
clipboard.append(EffectPtr(effect->copy(nullptr)));
|
||||
|
||||
if (del_com != nullptr) {
|
||||
del_com->clips.append(c);
|
||||
@@ -176,7 +176,7 @@ void EffectControls::scroll_to_frame(long frame) {
|
||||
|
||||
void EffectControls::add_effect_paste_action(QMenu *menu) {
|
||||
QAction* paste_action = menu->addAction(tr("&Paste"), panel_timeline, SLOT(paste(bool)));
|
||||
paste_action->setEnabled(clipboard.size() > 0 && clipboard_type == CLIPBOARD_TYPE_EFFECT);
|
||||
paste_action->setEnabled(clipboard.size() > 0 && clipboard_type == CLIPBOARD_TYPE_EFFECT);
|
||||
}
|
||||
|
||||
void EffectControls::cut() {
|
||||
@@ -282,7 +282,7 @@ void EffectControls::clear_effects(bool clear_cache) {
|
||||
|
||||
void EffectControls::deselect_all_effects(QWidget* sender) {
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
if (c->effects.at(j)->container != sender) {
|
||||
c->effects.at(j)->container->header_click(false, false);
|
||||
@@ -292,7 +292,7 @@ void EffectControls::deselect_all_effects(QWidget* sender) {
|
||||
panel_sequence_viewer->viewer_widget->update();
|
||||
}
|
||||
|
||||
void EffectControls::open_effect(QVBoxLayout* layout, Effect* e) {
|
||||
void EffectControls::open_effect(QVBoxLayout* layout, EffectPtr e) {
|
||||
CollapsibleWidget* container = e->container;
|
||||
layout->addWidget(container);
|
||||
connect(container, SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
@@ -505,7 +505,7 @@ void EffectControls::load_effects() {
|
||||
if (!multiple) {
|
||||
// load in new clips
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
QVBoxLayout* layout;
|
||||
if (c->track < 0) {
|
||||
vcontainer->setVisible(true);
|
||||
@@ -539,9 +539,9 @@ void EffectControls::delete_effects() {
|
||||
if (mode == TA_NO_TRANSITION) {
|
||||
EffectDeleteCommand* command = new EffectDeleteCommand();
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
Effect* effect = c->effects.at(j);
|
||||
EffectPtr effect = c->effects.at(j);
|
||||
if (effect->container->selected) {
|
||||
command->clips.append(c);
|
||||
command->fx.append(j);
|
||||
@@ -595,7 +595,7 @@ void EffectControls::resizeEvent(QResizeEvent*) {
|
||||
bool EffectControls::is_focused() {
|
||||
if (this->hasFocus()) return true;
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
if (c != nullptr) {
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
if (c->effects.at(j)->container->is_focused()) {
|
||||
|
||||
@@ -100,7 +100,7 @@ private:
|
||||
void show_effect_menu(int type, int subtype);
|
||||
void load_effects();
|
||||
void load_keyframes();
|
||||
void open_effect(QVBoxLayout* hlayout, Effect* e);
|
||||
void open_effect(QVBoxLayout* hlayout, EffectPtr e);
|
||||
|
||||
void setup_ui();
|
||||
|
||||
|
||||
+2
-2
@@ -50,7 +50,7 @@ void update_effect_controls() {
|
||||
int mode = TA_NO_TRANSITION;
|
||||
if (olive::ActiveSequence != nullptr) {
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* clip = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr clip = olive::ActiveSequence->clips.at(i);
|
||||
if (clip != nullptr) {
|
||||
for (int j=0;j<olive::ActiveSequence->selections.size();j++) {
|
||||
const Selection& s = olive::ActiveSequence->selections.at(j);
|
||||
@@ -88,7 +88,7 @@ void update_effect_controls() {
|
||||
if (aclip >= 0) selected_clips.append(aclip);
|
||||
if (vclip >= 0 && aclip >= 0) {
|
||||
bool found = false;
|
||||
Clip* vclip_ref = olive::ActiveSequence->clips.at(vclip);
|
||||
ClipPtr vclip_ref = olive::ActiveSequence->clips.at(vclip);
|
||||
for (int i=0;i<vclip_ref->linked.size();i++) {
|
||||
if (vclip_ref->linked.at(i) == aclip) {
|
||||
found = true;
|
||||
|
||||
+66
-62
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "oliveglobal.h"
|
||||
|
||||
#include "panels.h"
|
||||
#include "playback/playback.h"
|
||||
#include "io/previewgenerator.h"
|
||||
#include "project/undo.h"
|
||||
@@ -257,10 +258,10 @@ QString Project::get_next_sequence_name(QString start) {
|
||||
return name;
|
||||
}
|
||||
|
||||
Sequence* create_sequence_from_media(QVector<Media*>& media_list) {
|
||||
Sequence* s = new Sequence();
|
||||
SequencePtr create_sequence_from_media(QVector<Media*>& media_list) {
|
||||
SequencePtr s(new Sequence());
|
||||
|
||||
s->name = panel_project->get_next_sequence_name();
|
||||
s->name = panel_project->get_next_sequence_name();
|
||||
|
||||
// shitty hardcoded default values
|
||||
s->width = 1920;
|
||||
@@ -272,11 +273,11 @@ Sequence* create_sequence_from_media(QVector<Media*>& media_list) {
|
||||
bool got_video_values = false;
|
||||
bool got_audio_values = false;
|
||||
for (int i=0;i<media_list.size();i++) {
|
||||
Media* media = media_list.at(i);
|
||||
Media* media = media_list.at(i);
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* m = media->to_footage();
|
||||
FootagePtr m = media->to_footage();
|
||||
if (m->ready) {
|
||||
if (!got_video_values) {
|
||||
for (int j=0;j<m->video_tracks.size();j++) {
|
||||
@@ -304,7 +305,7 @@ Sequence* create_sequence_from_media(QVector<Media*>& media_list) {
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* seq = media->to_sequence();
|
||||
SequencePtr seq = media->to_sequence();
|
||||
s->width = seq->width;
|
||||
s->height = seq->height;
|
||||
s->frame_rate = seq->frame_rate;
|
||||
@@ -327,7 +328,7 @@ void Project::duplicate_selected() {
|
||||
bool duped = false;
|
||||
ComboAction* ca = new ComboAction();
|
||||
for (int j=0;j<items.size();j++) {
|
||||
Media* i = item_to_media(items.at(j));
|
||||
Media* i = item_to_media(items.at(j));
|
||||
if (i->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
create_sequence_internal(ca, i->to_sequence()->copy(), false, item_to_media(items.at(j).parent()));
|
||||
duped = true;
|
||||
@@ -343,7 +344,7 @@ void Project::duplicate_selected() {
|
||||
void Project::replace_selected_file() {
|
||||
QModelIndexList selected_items = get_current_selected();
|
||||
if (selected_items.size() == 1) {
|
||||
Media* item = item_to_media(selected_items.at(0));
|
||||
Media* item = item_to_media(selected_items.at(0));
|
||||
if (item->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
replace_media(item, nullptr);
|
||||
}
|
||||
@@ -373,7 +374,7 @@ void Project::replace_clip_media() {
|
||||
} else {
|
||||
QModelIndexList selected_items = get_current_selected();
|
||||
if (selected_items.size() == 1) {
|
||||
Media* item = item_to_media(selected_items.at(0));
|
||||
Media* item = item_to_media(selected_items.at(0));
|
||||
if (item->get_type() == MEDIA_TYPE_SEQUENCE && olive::ActiveSequence == item->to_sequence()) {
|
||||
QMessageBox::critical(this,
|
||||
tr("Active sequence selected"),
|
||||
@@ -390,7 +391,7 @@ void Project::replace_clip_media() {
|
||||
void Project::open_properties() {
|
||||
QModelIndexList selected_items = get_current_selected();
|
||||
if (selected_items.size() == 1) {
|
||||
Media* item = item_to_media(selected_items.at(0));
|
||||
Media* item = item_to_media(selected_items.at(0));
|
||||
switch (item->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
@@ -438,13 +439,16 @@ void Project::new_folder() {
|
||||
|
||||
void Project::new_sequence() {
|
||||
NewSequenceDialog nsd(this);
|
||||
nsd.set_sequence_name(panel_project->get_next_sequence_name());
|
||||
nsd.set_sequence_name(get_next_sequence_name());
|
||||
nsd.exec();
|
||||
}
|
||||
|
||||
Media* Project::create_sequence_internal(ComboAction *ca, Sequence *s, bool open, Media* parent) {
|
||||
if (parent == nullptr) parent = project_model.get_root();
|
||||
Media* item = new Media(parent);
|
||||
Media* Project::create_sequence_internal(ComboAction *ca, SequencePtr s, bool open, Media* parent) {
|
||||
if (parent == nullptr) {
|
||||
parent = project_model.get_root();
|
||||
}
|
||||
|
||||
Media* item(new Media(parent));
|
||||
item->set_sequence(s);
|
||||
|
||||
if (ca != nullptr) {
|
||||
@@ -466,7 +470,7 @@ QString Project::get_file_name_from_path(const QString& path) {
|
||||
}
|
||||
|
||||
/*Media* Project::new_item() {
|
||||
Media* item = new Media(0);
|
||||
Media* item = new Media(0);
|
||||
//item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||
return item;
|
||||
}*/
|
||||
@@ -476,22 +480,22 @@ bool Project::is_focused() {
|
||||
}
|
||||
|
||||
Media* Project::create_folder_internal(QString name) {
|
||||
Media* item = new Media(nullptr);
|
||||
Media* item = new Media(nullptr);
|
||||
item->set_folder();
|
||||
item->set_name(name);
|
||||
return item;
|
||||
}
|
||||
|
||||
Media *Project::item_to_media(const QModelIndex &index) {
|
||||
return static_cast<Media*>(sorter->mapToSource(index).internalPointer());
|
||||
return static_cast<Media*>(sorter->mapToSource(index).internalPointer());
|
||||
// return static_cast<Media*>(index.internalPointer());
|
||||
}
|
||||
|
||||
void Project::get_all_media_from_table(QList<Media*>& items, QList<Media*>& list, int search_type) {
|
||||
for (int i=0;i<items.size();i++) {
|
||||
Media* item = items.at(i);
|
||||
Media* item = items.at(i);
|
||||
if (item->get_type() == MEDIA_TYPE_FOLDER) {
|
||||
QList<Media*> children;
|
||||
QList<Media*> children;
|
||||
for (int j=0;j<item->childCount();j++) {
|
||||
children.append(item->child(j));
|
||||
}
|
||||
@@ -505,8 +509,8 @@ void Project::get_all_media_from_table(QList<Media*>& items, QList<Media*>& list
|
||||
bool delete_clips_in_clipboard_with_media(ComboAction* ca, Media* m) {
|
||||
int delete_count = 0;
|
||||
if (clipboard_type == CLIPBOARD_TYPE_CLIP) {
|
||||
for (int i=0;i<clipboard.size();i++) {
|
||||
Clip* c = static_cast<Clip*>(clipboard.at(i));
|
||||
for (int i=0;i<clipboard.size();i++) {
|
||||
ClipPtr c = std::static_pointer_cast<Clip>(clipboard.at(i));
|
||||
if (c->media == m) {
|
||||
ca->append(new RemoveClipsFromClipboard(i-delete_count));
|
||||
delete_count++;
|
||||
@@ -519,7 +523,7 @@ bool delete_clips_in_clipboard_with_media(ComboAction* ca, Media* m) {
|
||||
void Project::delete_selected_media() {
|
||||
ComboAction* ca = new ComboAction();
|
||||
QModelIndexList selected_items = get_current_selected();
|
||||
QList<Media*> items;
|
||||
QList<Media*> items;
|
||||
for (int i=0;i<selected_items.size();i++) {
|
||||
items.append(item_to_media(selected_items.at(i)));
|
||||
}
|
||||
@@ -527,25 +531,25 @@ void Project::delete_selected_media() {
|
||||
bool redraw = false;
|
||||
|
||||
// check if media is in use
|
||||
QVector<Media*> parents;
|
||||
QList<Media*> sequence_items;
|
||||
QList<Media*> all_top_level_items;
|
||||
QVector<Media*> parents;
|
||||
QList<Media*> sequence_items;
|
||||
QList<Media*> all_top_level_items;
|
||||
for (int i=0;i<project_model.childCount();i++) {
|
||||
all_top_level_items.append(project_model.child(i));
|
||||
}
|
||||
get_all_media_from_table(all_top_level_items, sequence_items, MEDIA_TYPE_SEQUENCE); // find all sequences in project
|
||||
if (sequence_items.size() > 0) {
|
||||
QList<Media*> media_items;
|
||||
QList<Media*> media_items;
|
||||
get_all_media_from_table(items, media_items, MEDIA_TYPE_FOOTAGE);
|
||||
for (int i=0;i<media_items.size();i++) {
|
||||
Media* item = media_items.at(i);
|
||||
Footage* media = item->to_footage();
|
||||
Media* item = media_items.at(i);
|
||||
FootagePtr media = item->to_footage();
|
||||
bool confirm_delete = false;
|
||||
for (int j=0;j<sequence_items.size();j++) {
|
||||
Sequence* s = sequence_items.at(j)->to_sequence();
|
||||
SequencePtr s = sequence_items.at(j)->to_sequence();
|
||||
for (int k=0;k<s->clips.size();k++) {
|
||||
Clip* c = s->clips.at(k);
|
||||
if (c != nullptr && c->media == item) {
|
||||
ClipPtr c = s->clips.at(k);
|
||||
if (c != nullptr && c->media == item) {
|
||||
if (!confirm_delete) {
|
||||
// we found a reference, so we know we'll need to ask if the user wants to delete it
|
||||
QMessageBox confirm(this);
|
||||
@@ -562,13 +566,13 @@ void Project::delete_selected_media() {
|
||||
redraw = true;
|
||||
} else if (confirm.clickedButton() == skip_button) {
|
||||
// remove media item and any folders containing it from the remove list
|
||||
Media* parent = item;
|
||||
Media* parent = item;
|
||||
while (parent != nullptr) {
|
||||
parents.append(parent);
|
||||
|
||||
// re-add item's siblings
|
||||
for (int m=0;m<parent->childCount();m++) {
|
||||
Media* child = parent->child(m);
|
||||
Media* child = parent->child(m);
|
||||
bool found = false;
|
||||
for (int n=0;n<items.size();n++) {
|
||||
if (items.at(n) == child) {
|
||||
@@ -628,7 +632,7 @@ void Project::delete_selected_media() {
|
||||
if (items.at(i)->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
redraw = true;
|
||||
|
||||
Sequence* s = items.at(i)->to_sequence();
|
||||
SequencePtr s = items.at(i)->to_sequence();
|
||||
|
||||
if (s == olive::ActiveSequence) {
|
||||
ca->append(new ChangeSequenceAction(nullptr));
|
||||
@@ -640,8 +644,8 @@ void Project::delete_selected_media() {
|
||||
} else if (items.at(i)->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
if (panel_footage_viewer->seq != nullptr) {
|
||||
for (int j=0;j<panel_footage_viewer->seq->clips.size();j++) {
|
||||
Clip* c = panel_footage_viewer->seq->clips.at(j);
|
||||
if (c != nullptr && c->media == items.at(i)) {
|
||||
ClipPtr c = panel_footage_viewer->seq->clips.at(j);
|
||||
if (c != nullptr && c->media == items.at(i)) {
|
||||
panel_footage_viewer->set_media(nullptr);
|
||||
break;
|
||||
}
|
||||
@@ -689,7 +693,7 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
for (int i=0;i<files.size();i++) {
|
||||
if (QFileInfo(files.at(i)).isDir()) {
|
||||
QString folder_name = get_file_name_from_path(files.at(i));
|
||||
Media* folder = create_folder_internal(folder_name);
|
||||
Media* folder = create_folder_internal(folder_name);
|
||||
|
||||
QDir directory(files.at(i));
|
||||
directory.setFilter(QDir::NoDotAndDotDot | QDir::AllEntries);
|
||||
@@ -714,7 +718,7 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
QString file(files.at(i));
|
||||
bool skip = false;
|
||||
|
||||
/* Heuristic to determine whether file is part of an image sequence */
|
||||
/* Heuristic to determine whether file is part of an image sequence */
|
||||
|
||||
// check file extension (assume it's not a
|
||||
|
||||
@@ -791,8 +795,8 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
}
|
||||
|
||||
if (!skip) {
|
||||
Media* item;
|
||||
Footage* m;
|
||||
Media* item;
|
||||
FootagePtr m;
|
||||
|
||||
if (replace != nullptr) {
|
||||
item = replace;
|
||||
@@ -800,7 +804,7 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
m->reset();
|
||||
} else {
|
||||
item = new Media(parent);
|
||||
m = new Footage();
|
||||
m = FootagePtr(new Footage());
|
||||
}
|
||||
|
||||
m->using_inout = false;
|
||||
@@ -842,7 +846,7 @@ Media* Project::get_selected_folder() {
|
||||
// if one item is selected and it's a folder, return it
|
||||
QModelIndexList selected_items = get_current_selected();
|
||||
if (selected_items.size() == 1) {
|
||||
Media* m = item_to_media(selected_items.at(0));
|
||||
Media* m = item_to_media(selected_items.at(0));
|
||||
if (m->get_type() == MEDIA_TYPE_FOLDER) return m;
|
||||
}
|
||||
return nullptr;
|
||||
@@ -851,7 +855,7 @@ Media* Project::get_selected_folder() {
|
||||
bool Project::reveal_media(Media *media, QModelIndex parent) {
|
||||
for (int i=0;i<project_model.rowCount(parent);i++) {
|
||||
const QModelIndex& item = project_model.index(i, 0, parent);
|
||||
Media* m = project_model.getItem(item);
|
||||
Media* m = project_model.getItem(item);
|
||||
|
||||
if (m->get_type() == MEDIA_TYPE_FOLDER) {
|
||||
|
||||
@@ -923,10 +927,10 @@ void Project::delete_clips_using_selected_media() {
|
||||
bool deleted = false;
|
||||
QModelIndexList items = get_current_selected();
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
const ClipPtr& c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
for (int j=0;j<items.size();j++) {
|
||||
Media* m = item_to_media(items.at(j));
|
||||
Media* m = item_to_media(items.at(j));
|
||||
if (c->media == m) {
|
||||
ca->append(new DeleteClipAction(olive::ActiveSequence, i));
|
||||
deleted = true;
|
||||
@@ -935,7 +939,7 @@ void Project::delete_clips_using_selected_media() {
|
||||
}
|
||||
}
|
||||
for (int j=0;j<items.size();j++) {
|
||||
Media* m = item_to_media(items.at(j));
|
||||
Media* m = item_to_media(items.at(j));
|
||||
if (delete_clips_in_clipboard_with_media(ca, m)) deleted = true;
|
||||
}
|
||||
if (deleted) {
|
||||
@@ -952,9 +956,9 @@ void Project::clear() {
|
||||
panel_effect_controls->clear_effects(true);
|
||||
|
||||
// delete sequences first because it's important to close all the clips before deleting the media
|
||||
QVector<Media*> sequences = list_all_project_sequences();
|
||||
QVector<Media*> sequences = list_all_project_sequences();
|
||||
for (int i=0;i<sequences.size();i++) {
|
||||
delete sequences.at(i)->to_sequence();
|
||||
sequences.at(i)->to_sequence().reset();
|
||||
sequences.at(i)->set_sequence(nullptr);
|
||||
}
|
||||
|
||||
@@ -962,7 +966,7 @@ void Project::clear() {
|
||||
project_model.clear();
|
||||
|
||||
// update tree view (sometimes this doesn't seem to update reliably)
|
||||
panel_project->tree_view->update();
|
||||
tree_view->update();
|
||||
}
|
||||
|
||||
void Project::new_project() {
|
||||
@@ -990,7 +994,7 @@ void save_marker(QXmlStreamWriter& stream, const Marker& m) {
|
||||
void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only, const QModelIndex& parent) {
|
||||
for (int i=0;i<project_model.rowCount(parent);i++) {
|
||||
const QModelIndex& item = project_model.index(i, 0, parent);
|
||||
Media* m = project_model.getItem(item);
|
||||
Media* m = project_model.getItem(item);
|
||||
|
||||
if (type == m->get_type()) {
|
||||
if (m->get_type() == MEDIA_TYPE_FOLDER) {
|
||||
@@ -1013,7 +1017,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
} else {
|
||||
int folder = m->parentItem()->temp_id;
|
||||
if (type == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = m->to_footage();
|
||||
FootagePtr f = m->to_footage();
|
||||
f->save_id = media_id;
|
||||
stream.writeStartElement("footage");
|
||||
stream.writeAttribute("id", QString::number(media_id));
|
||||
@@ -1061,7 +1065,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
stream.writeEndElement(); // footage
|
||||
media_id++;
|
||||
} else if (type == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* s = m->to_sequence();
|
||||
SequencePtr s = m->to_sequence();
|
||||
if (set_ids_only) {
|
||||
s->save_id = sequence_id;
|
||||
sequence_id++;
|
||||
@@ -1083,7 +1087,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
stream.writeAttribute("workareaOut", QString::number(s->workarea_out));
|
||||
|
||||
for (int j=0;j<s->transitions.size();j++) {
|
||||
Transition* t = s->transitions.at(j);
|
||||
TransitionPtr t = s->transitions.at(j);
|
||||
if (t != nullptr) {
|
||||
stream.writeStartElement("transition");
|
||||
stream.writeAttribute("id", QString::number(j));
|
||||
@@ -1094,7 +1098,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
}
|
||||
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
Clip* c = s->clips.at(j);
|
||||
const ClipPtr& c = s->clips.at(j);
|
||||
if (c != nullptr) {
|
||||
stream.writeStartElement("clip"); // clip
|
||||
stream.writeAttribute("id", QString::number(j));
|
||||
@@ -1305,7 +1309,7 @@ void Project::add_recent_project(QString url) {
|
||||
|
||||
void Project::list_all_sequences_worker(QVector<Media*>* list, Media* parent) {
|
||||
for (int i=0;i<project_model.childCount(parent);i++) {
|
||||
Media* item = project_model.child(i, parent);
|
||||
Media* item = project_model.child(i, parent);
|
||||
switch (item->get_type()) {
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
list->append(item);
|
||||
@@ -1318,16 +1322,16 @@ void Project::list_all_sequences_worker(QVector<Media*>* list, Media* parent) {
|
||||
}
|
||||
|
||||
QVector<Media*> Project::list_all_project_sequences() {
|
||||
QVector<Media*> list;
|
||||
QVector<Media*> list;
|
||||
list_all_sequences_worker(&list, nullptr);
|
||||
return list;
|
||||
}
|
||||
|
||||
QModelIndexList Project::get_current_selected() {
|
||||
if (olive::CurrentConfig.project_view_type == PROJECT_VIEW_TREE) {
|
||||
return panel_project->tree_view->selectionModel()->selectedRows();
|
||||
return tree_view->selectionModel()->selectedRows();
|
||||
}
|
||||
return panel_project->icon_view->selectionModel()->selectedIndexes();
|
||||
return icon_view->selectionModel()->selectedIndexes();
|
||||
}
|
||||
|
||||
#define THROBBER_LIMIT 20
|
||||
@@ -1366,11 +1370,11 @@ void MediaThrobber::stop(int icon_type, bool replace) {
|
||||
}
|
||||
|
||||
// refresh all clips
|
||||
QVector<Media*> sequences = panel_project->list_all_project_sequences();
|
||||
QVector<Media*> sequences = panel_project->list_all_project_sequences();
|
||||
for (int i=0;i<sequences.size();i++) {
|
||||
Sequence* s = sequences.at(i)->to_sequence();
|
||||
SequencePtr s = sequences.at(i)->to_sequence();
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
Clip* c = s->clips.at(j);
|
||||
const ClipPtr& c = s->clips.at(j);
|
||||
if (c != nullptr) {
|
||||
c->refresh();
|
||||
}
|
||||
@@ -1380,7 +1384,7 @@ void MediaThrobber::stop(int icon_type, bool replace) {
|
||||
// redraw clips
|
||||
update_ui(replace);
|
||||
|
||||
panel_project->tree_view->viewport()->update();
|
||||
panel_project->tree_view->viewport()->update();
|
||||
item->throbber = nullptr;
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
+15
-17
@@ -37,8 +37,6 @@
|
||||
#include "project/sourcescommon.h"
|
||||
#include "ui/sourceiconview.h"
|
||||
|
||||
#include "panels.h"
|
||||
|
||||
#include "ui/sourcetable.h"
|
||||
|
||||
#define LOAD_TYPE_VERSION 69
|
||||
@@ -48,7 +46,7 @@ extern QString autorecovery_filename;
|
||||
extern QStringList recent_projects;
|
||||
extern ProjectModel project_model;
|
||||
|
||||
Sequence* create_sequence_from_media(QVector<Media *> &media_list);
|
||||
SequencePtr create_sequence_from_media(QVector<Media *> &media_list);
|
||||
|
||||
QString get_channel_layout_name(int channels, uint64_t layout);
|
||||
QString get_interlacing_name(int interlacing);
|
||||
@@ -56,15 +54,15 @@ QString get_interlacing_name(int interlacing);
|
||||
class Project : public QDockWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Project(QWidget *parent = 0);
|
||||
explicit Project(QWidget *parent = nullptr);
|
||||
~Project();
|
||||
bool is_focused();
|
||||
void clear();
|
||||
Media* create_sequence_internal(ComboAction *ca, Sequence* s, bool open, Media* parent);
|
||||
QString get_next_sequence_name(QString start = 0);
|
||||
void process_file_list(QStringList& files, bool recursive = false, Media* replace = nullptr, Media *parent = nullptr);
|
||||
void replace_media(Media* item, QString filename);
|
||||
Media *get_selected_folder();
|
||||
Media* create_sequence_internal(ComboAction *ca, SequencePtr s, bool open, Media* parent);
|
||||
QString get_next_sequence_name(QString start = nullptr);
|
||||
void process_file_list(QStringList& files, bool recursive = false, Media* replace = nullptr, Media *parent = nullptr);
|
||||
void replace_media(Media* item, QString filename);
|
||||
Media* get_selected_folder();
|
||||
bool reveal_media(Media *media, QModelIndex parent = QModelIndex());
|
||||
void add_recent_project(QString url);
|
||||
|
||||
@@ -72,12 +70,12 @@ public:
|
||||
void load_project(bool autorecovery);
|
||||
void save_project(bool autorecovery);
|
||||
|
||||
Media* create_folder_internal(QString name);
|
||||
Media* item_to_media(const QModelIndex& index);
|
||||
Media* create_folder_internal(QString name);
|
||||
Media* item_to_media(const QModelIndex& index);
|
||||
|
||||
void save_recent_projects();
|
||||
|
||||
QVector<Media*> list_all_project_sequences();
|
||||
QVector<Media*> list_all_project_sequences();
|
||||
|
||||
SourceTable* tree_view;
|
||||
SourceIconView* icon_view;
|
||||
@@ -85,11 +83,11 @@ public:
|
||||
|
||||
ProjectFilter* sorter;
|
||||
|
||||
QVector<Media*> last_imported_media;
|
||||
QVector<Media*> last_imported_media;
|
||||
|
||||
QModelIndexList get_current_selected();
|
||||
|
||||
void start_preview_generator(Media* item, bool replacing);
|
||||
void start_preview_generator(Media* item, bool replacing);
|
||||
void get_all_media_from_table(QList<Media *> &items, QList<Media *> &list, int type = -1);
|
||||
|
||||
QWidget* toolbar_widget;
|
||||
@@ -108,7 +106,7 @@ private:
|
||||
int folder_id;
|
||||
int media_id;
|
||||
int sequence_id;
|
||||
void list_all_sequences_worker(QVector<Media *> *list, Media* parent);
|
||||
void list_all_sequences_worker(QVector<Media *> *list, Media* parent);
|
||||
QString get_file_name_from_path(const QString &path);
|
||||
QDir proj_dir;
|
||||
QWidget* icon_view_container;
|
||||
@@ -127,7 +125,7 @@ private slots:
|
||||
class MediaThrobber : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MediaThrobber(Media*);
|
||||
MediaThrobber(Media*);
|
||||
public slots:
|
||||
void start();
|
||||
void stop(int, bool replace);
|
||||
@@ -136,7 +134,7 @@ private slots:
|
||||
private:
|
||||
QPixmap pixmap;
|
||||
int animation;
|
||||
Media* item;
|
||||
Media* item;
|
||||
QTimer* animator;
|
||||
};
|
||||
|
||||
|
||||
+83
-79
@@ -122,7 +122,7 @@ void Timeline::previous_cut() {
|
||||
&& olive::ActiveSequence->playhead > 0) {
|
||||
long p_cut = 0;
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
if (c->timeline_out > p_cut && c->timeline_out < olive::ActiveSequence->playhead) {
|
||||
p_cut = c->timeline_out;
|
||||
@@ -140,7 +140,7 @@ void Timeline::next_cut() {
|
||||
bool seek_enabled = false;
|
||||
long n_cut = LONG_MAX;
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
if (c->timeline_in < n_cut && c->timeline_in > olive::ActiveSequence->playhead) {
|
||||
n_cut = c->timeline_in;
|
||||
@@ -155,7 +155,7 @@ void Timeline::next_cut() {
|
||||
}
|
||||
}
|
||||
|
||||
void ripple_clips(ComboAction* ca, Sequence *s, long point, long length, const QVector<int>& ignore) {
|
||||
void ripple_clips(ComboAction* ca, SequencePtr s, long point, long length, const QVector<int>& ignore) {
|
||||
ca->append(new RippleAction(s, point, length, ignore));
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ void Timeline::toggle_show_all() {
|
||||
}
|
||||
}
|
||||
|
||||
void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector<Media*>& media_list) {
|
||||
void Timeline::create_ghosts_from_media(SequencePtr seq, long entry_point, QVector<Media*>& media_list) {
|
||||
video_ghosts = false;
|
||||
audio_ghosts = false;
|
||||
|
||||
@@ -179,8 +179,8 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
|
||||
bool can_import = true;
|
||||
|
||||
Media* medium = media_list.at(i);
|
||||
Footage* m = nullptr;
|
||||
Sequence* s = nullptr;
|
||||
FootagePtr m = nullptr;
|
||||
SequencePtr s = nullptr;
|
||||
long sequence_length = 0;
|
||||
long default_clip_in = 0;
|
||||
long default_clip_out = 0;
|
||||
@@ -276,16 +276,16 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
|
||||
}
|
||||
}
|
||||
|
||||
void Timeline::add_clips_from_ghosts(ComboAction* ca, Sequence* s) {
|
||||
void Timeline::add_clips_from_ghosts(ComboAction* ca, SequencePtr s) {
|
||||
// add clips
|
||||
long earliest_point = LONG_MAX;
|
||||
QVector<Clip*> added_clips;
|
||||
QVector<ClipPtr> added_clips;
|
||||
for (int i=0;i<ghosts.size();i++) {
|
||||
const Ghost& g = ghosts.at(i);
|
||||
|
||||
earliest_point = qMin(earliest_point, g.in);
|
||||
|
||||
Clip* c = new Clip(s);
|
||||
ClipPtr c = ClipPtr(new Clip(s));
|
||||
c->media = g.media;
|
||||
c->media_stream = g.media_stream;
|
||||
c->timeline_in = g.in;
|
||||
@@ -293,7 +293,7 @@ void Timeline::add_clips_from_ghosts(ComboAction* ca, Sequence* s) {
|
||||
c->clip_in = g.clip_in;
|
||||
c->track = g.track;
|
||||
if (c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* m = c->media->to_footage();
|
||||
FootagePtr m = c->media->to_footage();
|
||||
if (m->video_tracks.size() == 0) {
|
||||
// audio only (greenish)
|
||||
c->color_r = 128;
|
||||
@@ -317,7 +317,7 @@ void Timeline::add_clips_from_ghosts(ComboAction* ca, Sequence* s) {
|
||||
c->color_g = 128;
|
||||
c->color_b = 128;
|
||||
|
||||
Sequence* media = c->media->to_sequence();
|
||||
SequencePtr media = c->media->to_sequence();
|
||||
c->name = media->name;
|
||||
}
|
||||
c->recalculateMaxLength();
|
||||
@@ -327,9 +327,9 @@ void Timeline::add_clips_from_ghosts(ComboAction* ca, Sequence* s) {
|
||||
|
||||
// link clips from the same media
|
||||
for (int i=0;i<added_clips.size();i++) {
|
||||
Clip* c = added_clips.at(i);
|
||||
ClipPtr c = added_clips.at(i);
|
||||
for (int j=0;j<added_clips.size();j++) {
|
||||
Clip* cc = added_clips.at(j);
|
||||
ClipPtr cc = added_clips.at(j);
|
||||
if (c != cc && c->media == cc->media) {
|
||||
c->linked.append(j);
|
||||
}
|
||||
@@ -367,7 +367,7 @@ void Timeline::add_transition() {
|
||||
bool adding = false;
|
||||
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr && is_clip_selected(c, true)) {
|
||||
int transition_to_add = (c->track < 0) ? TRANSITION_INTERNAL_CROSSDISSOLVE : TRANSITION_INTERNAL_LINEARFADE;
|
||||
if (c->get_opening_transition() == nullptr) {
|
||||
@@ -397,7 +397,7 @@ void Timeline::nest() {
|
||||
|
||||
// get selected clips
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr && is_clip_selected(c, true)) {
|
||||
selected_clips.append(i);
|
||||
earliest_point = qMin(c->timeline_in, earliest_point);
|
||||
@@ -408,7 +408,7 @@ void Timeline::nest() {
|
||||
if (!selected_clips.isEmpty()) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
|
||||
Sequence* s = new Sequence();
|
||||
SequencePtr s(new Sequence());
|
||||
|
||||
// create "nest" sequence
|
||||
s->name = panel_project->get_next_sequence_name(tr("Nested Sequence"));
|
||||
@@ -424,7 +424,7 @@ void Timeline::nest() {
|
||||
ca->append(new DeleteClipAction(olive::ActiveSequence, selected_clips.at(i)));
|
||||
|
||||
// copy to new
|
||||
Clip* copy = olive::ActiveSequence->clips.at(selected_clips.at(i))->copy(s);
|
||||
ClipPtr copy(olive::ActiveSequence->clips.at(selected_clips.at(i))->copy(s));
|
||||
copy->timeline_in -= earliest_point;
|
||||
copy->timeline_out -= earliest_point;
|
||||
s->clips.append(copy);
|
||||
@@ -536,7 +536,7 @@ void Timeline::select_all() {
|
||||
if (olive::ActiveSequence != nullptr) {
|
||||
olive::ActiveSequence->selections.clear();
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
Selection s;
|
||||
s.in = c->timeline_in;
|
||||
@@ -556,7 +556,7 @@ void Timeline::scroll_to_frame(long frame) {
|
||||
void Timeline::select_from_playhead() {
|
||||
olive::ActiveSequence->selections.clear();
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr
|
||||
&& c->timeline_in <= olive::ActiveSequence->playhead
|
||||
&& c->timeline_out > olive::ActiveSequence->playhead) {
|
||||
@@ -576,7 +576,7 @@ bool Timeline::can_ripple_empty_space(long frame, int track) {
|
||||
rc_ripple_max = LONG_MAX;
|
||||
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
if (c->timeline_in > frame || c->timeline_out > frame) {
|
||||
at_end_of_sequence = false;
|
||||
@@ -667,7 +667,7 @@ void Timeline::toggle_enable_on_selected_clips() {
|
||||
ComboAction* ca = new ComboAction();
|
||||
bool push_undo = false;
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr && is_clip_selected(c, true)) {
|
||||
ca->append(new SetBool(&c->enabled, !c->enabled));
|
||||
push_undo = true;
|
||||
@@ -706,7 +706,7 @@ void Timeline::delete_selection(QVector<Selection>& selections, bool ripple_dele
|
||||
|
||||
bool can_ripple = true;
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr && c->timeline_in < ripple_point && c->timeline_out > ripple_point) {
|
||||
// conflict detected, but this clip may be getting deleted so let's check
|
||||
bool deleted = false;
|
||||
@@ -721,7 +721,7 @@ void Timeline::delete_selection(QVector<Selection>& selections, bool ripple_dele
|
||||
}
|
||||
if (!deleted) {
|
||||
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
||||
Clip* cc = olive::ActiveSequence->clips.at(j);
|
||||
ClipPtr cc = olive::ActiveSequence->clips.at(j);
|
||||
if (cc != nullptr
|
||||
&& cc->track == c->track
|
||||
&& cc->timeline_in > c->timeline_out
|
||||
@@ -781,7 +781,7 @@ void Timeline::decheck_tool_buttons(QObject* sender) {
|
||||
|
||||
QVector<int> Timeline::get_tracks_of_linked_clips(int i) {
|
||||
QVector<int> tracks;
|
||||
Clip* clip = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr clip = olive::ActiveSequence->clips.at(i);
|
||||
for (int j=0;j<clip->linked.size();j++) {
|
||||
tracks.append(olive::ActiveSequence->clips.at(clip->linked.at(j))->track);
|
||||
}
|
||||
@@ -796,7 +796,7 @@ void Timeline::zoom_out() {
|
||||
multiply_zoom(0.5);
|
||||
}
|
||||
|
||||
bool is_clip_selected(Clip* clip, bool containing) {
|
||||
bool is_clip_selected(ClipPtr clip, bool containing) {
|
||||
for (int i=0;i<clip->sequence->selections.size();i++) {
|
||||
const Selection& s = clip->sequence->selections.at(i);
|
||||
if (clip->track == s.track && ((clip->timeline_in >= s.in && clip->timeline_out <= s.out && containing) ||
|
||||
@@ -811,12 +811,12 @@ void Timeline::snapping_clicked(bool checked) {
|
||||
snapping = checked;
|
||||
}
|
||||
|
||||
Clip* Timeline::split_clip(ComboAction* ca, bool transitions, int p, long frame) {
|
||||
ClipPtr Timeline::split_clip(ComboAction* ca, bool transitions, int p, long frame) {
|
||||
return split_clip(ca, transitions, p, frame, frame);
|
||||
}
|
||||
|
||||
Clip* Timeline::split_clip(ComboAction* ca, bool transitions, int p, long frame, long post_in) {
|
||||
Clip* pre = olive::ActiveSequence->clips.at(p);
|
||||
ClipPtr Timeline::split_clip(ComboAction* ca, bool transitions, int p, long frame, long post_in) {
|
||||
ClipPtr pre = olive::ActiveSequence->clips.at(p);
|
||||
if (pre != nullptr && pre->timeline_in < frame && pre->timeline_out > frame) { // guard against attempts to split at in/out points
|
||||
bool splitting_closing_dual_transition = false;
|
||||
|
||||
@@ -826,7 +826,7 @@ Clip* Timeline::split_clip(ComboAction* ca, bool transitions, int p, long frame,
|
||||
splitting_closing_dual_transition = true;
|
||||
}
|
||||
|
||||
Clip* post = pre->copy(olive::ActiveSequence, transitions && !splitting_closing_dual_transition);
|
||||
ClipPtr post = ClipPtr(pre->copy(olive::ActiveSequence, transitions && !splitting_closing_dual_transition));
|
||||
|
||||
long new_clip_length = frame - pre->timeline_in;
|
||||
|
||||
@@ -891,12 +891,12 @@ bool Timeline::split_clip_and_relink(ComboAction *ca, int clip, long frame, bool
|
||||
|
||||
split_cache.append(clip);
|
||||
|
||||
Clip* c = olive::ActiveSequence->clips.at(clip);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(clip);
|
||||
if (c != nullptr) {
|
||||
QVector<int> pre_clips;
|
||||
QVector<Clip*> post_clips;
|
||||
QVector<ClipPtr> post_clips;
|
||||
|
||||
Clip* post = split_clip(ca, true, clip, frame);
|
||||
ClipPtr post = split_clip(ca, true, clip, frame);
|
||||
|
||||
// if alt is not down, split clips links too
|
||||
if (post == nullptr) {
|
||||
@@ -912,10 +912,10 @@ bool Timeline::split_clip_and_relink(ComboAction *ca, int clip, long frame, bool
|
||||
for (int i=0;i<c->linked.size();i++) {
|
||||
int l = c->linked.at(i);
|
||||
if (!has_clip_been_split(l)) {
|
||||
Clip* link = olive::ActiveSequence->clips.at(l);
|
||||
ClipPtr link = olive::ActiveSequence->clips.at(l);
|
||||
if ((original_clip_is_selected && is_clip_selected(link, true)) || !original_clip_is_selected) {
|
||||
split_cache.append(l);
|
||||
Clip* s = split_clip(ca, true, l, frame);
|
||||
ClipPtr s = split_clip(ca, true, l, frame);
|
||||
if (s != nullptr) {
|
||||
pre_clips.append(l);
|
||||
post_clips.append(s);
|
||||
@@ -963,7 +963,7 @@ void Timeline::clean_up_selections(QVector<Selection>& areas) {
|
||||
}
|
||||
}
|
||||
|
||||
bool selection_contains_transition(const Selection& s, Clip* c, int type) {
|
||||
bool selection_contains_transition(const Selection& s, ClipPtr c, int type) {
|
||||
if (type == TA_OPENING_TRANSITION) {
|
||||
return c->get_opening_transition() != nullptr
|
||||
&& s.out == c->timeline_in + c->get_opening_transition()->get_true_length()
|
||||
@@ -982,12 +982,12 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
||||
panel_effect_controls->clear_effects(true);
|
||||
|
||||
QVector<int> pre_clips;
|
||||
QVector<Clip*> post_clips;
|
||||
QVector<ClipPtr> post_clips;
|
||||
|
||||
for (int i=0;i<areas.size();i++) {
|
||||
const Selection& s = areas.at(i);
|
||||
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(j);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(j);
|
||||
if (c != nullptr && c->track == s.track && !c->undeletable) {
|
||||
if (selection_contains_transition(s, c, TA_OPENING_TRANSITION)) {
|
||||
// delete opening transition
|
||||
@@ -1002,7 +1002,7 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
||||
// middle of clip is within deletion area
|
||||
|
||||
// duplicate clip
|
||||
Clip* post = split_clip(ca, true, j, s.in, s.out);
|
||||
ClipPtr post = split_clip(ca, true, j, s.in, s.out);
|
||||
|
||||
pre_clips.append(j);
|
||||
post_clips.append(post);
|
||||
@@ -1053,7 +1053,7 @@ void Timeline::copy(bool del) {
|
||||
long min_in = 0;
|
||||
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
for (int j=0;j<olive::ActiveSequence->selections.size();j++) {
|
||||
const Selection& s = olive::ActiveSequence->selections.at(j);
|
||||
@@ -1064,7 +1064,7 @@ void Timeline::copy(bool del) {
|
||||
clipboard_type = CLIPBOARD_TYPE_CLIP;
|
||||
}
|
||||
|
||||
Clip* copied_clip = c->copy(nullptr);
|
||||
ClipPtr copied_clip = c->copy(nullptr);
|
||||
|
||||
// copy linked IDs (we correct these later in paste())
|
||||
copied_clip->linked = c->linked;
|
||||
@@ -1087,16 +1087,16 @@ void Timeline::copy(bool del) {
|
||||
|
||||
copied_clip->load_id = i;
|
||||
|
||||
clipboard.append(copied_clip);
|
||||
clipboard.append(copied_clip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0;i<clipboard.size();i++) {
|
||||
for (int i=0;i<clipboard.size();i++) {
|
||||
// initialize all timeline_ins to 0 or offsets of
|
||||
static_cast<Clip*>(clipboard.at(i))->timeline_in -= min_in;
|
||||
static_cast<Clip*>(clipboard.at(i))->timeline_out -= min_in;
|
||||
std::static_pointer_cast<Clip>(clipboard.at(i))->timeline_in -= min_in;
|
||||
std::static_pointer_cast<Clip>(clipboard.at(i))->timeline_out -= min_in;
|
||||
}
|
||||
|
||||
if (del && copied) {
|
||||
@@ -1104,11 +1104,11 @@ void Timeline::copy(bool del) {
|
||||
}
|
||||
}
|
||||
|
||||
void Timeline::relink_clips_using_ids(QVector<int>& old_clips, QVector<Clip*>& new_clips) {
|
||||
void Timeline::relink_clips_using_ids(QVector<int>& old_clips, QVector<ClipPtr>& new_clips) {
|
||||
// relink pasted clips
|
||||
for (int i=0;i<old_clips.size();i++) {
|
||||
// these indices should correspond
|
||||
Clip* oc = olive::ActiveSequence->clips.at(old_clips.at(i));
|
||||
ClipPtr oc = olive::ActiveSequence->clips.at(old_clips.at(i));
|
||||
for (int j=0;j<oc->linked.size();j++) {
|
||||
for (int k=0;k<old_clips.size();k++) { // find clip with that ID
|
||||
if (oc->linked.at(j) == old_clips.at(k)) {
|
||||
@@ -1123,19 +1123,19 @@ void Timeline::relink_clips_using_ids(QVector<int>& old_clips, QVector<Clip*>& n
|
||||
|
||||
void Timeline::paste(bool insert) {
|
||||
if (clipboard.size() > 0) {
|
||||
if (clipboard_type == CLIPBOARD_TYPE_CLIP) {
|
||||
if (clipboard_type == CLIPBOARD_TYPE_CLIP) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
|
||||
// create copies and delete areas that we'll be pasting to
|
||||
QVector<Selection> delete_areas;
|
||||
QVector<Clip*> pasted_clips;
|
||||
QVector<ClipPtr> pasted_clips;
|
||||
long paste_start = LONG_MAX;
|
||||
long paste_end = LONG_MIN;
|
||||
for (int i=0;i<clipboard.size();i++) {
|
||||
Clip* c = static_cast<Clip*>(clipboard.at(i));
|
||||
for (int i=0;i<clipboard.size();i++) {
|
||||
ClipPtr c = std::static_pointer_cast<Clip>(clipboard.at(i));
|
||||
|
||||
// create copy of clip and offset by playhead
|
||||
Clip* cc = c->copy(olive::ActiveSequence);
|
||||
ClipPtr cc(c->copy(olive::ActiveSequence));
|
||||
|
||||
// convert frame rates
|
||||
cc->timeline_in = refactor_frame_number(cc->timeline_in, c->cached_fr, olive::ActiveSequence->frame_rate);
|
||||
@@ -1168,13 +1168,13 @@ void Timeline::paste(bool insert) {
|
||||
}
|
||||
|
||||
// correct linked clips
|
||||
for (int i=0;i<clipboard.size();i++) {
|
||||
for (int i=0;i<clipboard.size();i++) {
|
||||
// these indices should correspond
|
||||
Clip* oc = static_cast<Clip*>(clipboard.at(i));
|
||||
ClipPtr oc = std::static_pointer_cast<Clip>(clipboard.at(i));
|
||||
|
||||
for (int j=0;j<oc->linked.size();j++) {
|
||||
for (int k=0;k<clipboard.size();k++) { // find clip with that ID
|
||||
Clip* comp = static_cast<Clip*>(clipboard.at(k));
|
||||
for (int k=0;k<clipboard.size();k++) { // find clip with that ID
|
||||
ClipPtr comp = std::static_pointer_cast<Clip>(clipboard.at(k));
|
||||
if (comp->load_id == oc->linked.at(j)) {
|
||||
pasted_clips.at(i)->linked.append(k);
|
||||
}
|
||||
@@ -1200,10 +1200,10 @@ void Timeline::paste(bool insert) {
|
||||
bool ask_conflict = true;
|
||||
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr && is_clip_selected(c, true)) {
|
||||
for (int j=0;j<clipboard.size();j++) {
|
||||
Effect* e = static_cast<Effect*>(clipboard.at(j));
|
||||
for (int j=0;j<clipboard.size();j++) {
|
||||
EffectPtr e = std::static_pointer_cast<Effect>(clipboard.at(j));
|
||||
if ((c->track < 0) == (e->meta->subtype == EFFECT_TYPE_VIDEO)) {
|
||||
int found = -1;
|
||||
if (ask_conflict) {
|
||||
@@ -1283,7 +1283,7 @@ void Timeline::edit_to_point_internal(bool in, bool ripple) {
|
||||
|
||||
// find closest in point to playhead
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
track_min = qMin(track_min, c->track);
|
||||
track_max = qMax(track_max, c->track);
|
||||
@@ -1382,18 +1382,18 @@ bool Timeline::split_selection(ComboAction* ca) {
|
||||
|
||||
// temporary relinking vectors
|
||||
QVector<int> pre_splits;
|
||||
QVector<Clip*> post_splits;
|
||||
QVector<Clip*> secondary_post_splits;
|
||||
QVector<ClipPtr> post_splits;
|
||||
QVector<ClipPtr> secondary_post_splits;
|
||||
|
||||
// find clips within selection and split
|
||||
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
||||
Clip* clip = olive::ActiveSequence->clips.at(j);
|
||||
ClipPtr clip = olive::ActiveSequence->clips.at(j);
|
||||
if (clip != nullptr) {
|
||||
for (int i=0;i<olive::ActiveSequence->selections.size();i++) {
|
||||
const Selection& s = olive::ActiveSequence->selections.at(i);
|
||||
if (s.track == clip->track) {
|
||||
Clip* post_b = split_clip(ca, true, j, s.out);
|
||||
Clip* post_a = split_clip(ca, post_b == nullptr, j, s.in);
|
||||
ClipPtr post_b = split_clip(ca, true, j, s.out);
|
||||
ClipPtr post_a = split_clip(ca, post_b == nullptr, j, s.in);
|
||||
pre_splits.append(j);
|
||||
post_splits.append(post_a);
|
||||
secondary_post_splits.append(post_b);
|
||||
@@ -1424,7 +1424,7 @@ bool Timeline::split_selection(ComboAction* ca) {
|
||||
bool Timeline::split_all_clips_at_point(ComboAction* ca, long point) {
|
||||
bool split = false;
|
||||
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(j);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(j);
|
||||
if (c != nullptr) {
|
||||
// always relinks
|
||||
if (split_clip_and_relink(ca, j, point, true)) {
|
||||
@@ -1443,11 +1443,11 @@ void Timeline::split_at_playhead() {
|
||||
if (olive::ActiveSequence->selections.size() > 0) {
|
||||
// see if whole clips are selected
|
||||
QVector<int> pre_clips;
|
||||
QVector<Clip*> post_clips;
|
||||
QVector<ClipPtr> post_clips;
|
||||
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
||||
Clip* clip = olive::ActiveSequence->clips.at(j);
|
||||
ClipPtr clip = olive::ActiveSequence->clips.at(j);
|
||||
if (clip != nullptr && is_clip_selected(clip, true)) {
|
||||
Clip* s = split_clip(ca, true, j, olive::ActiveSequence->playhead);
|
||||
ClipPtr s = split_clip(ca, true, j, olive::ActiveSequence->playhead);
|
||||
if (s != nullptr) {
|
||||
pre_clips.append(j);
|
||||
post_clips.append(s);
|
||||
@@ -1555,7 +1555,7 @@ bool Timeline::snap_to_timeline(long* l, bool use_playhead, bool use_markers, bo
|
||||
|
||||
// snap to clip/transition
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
if (snap_to_point(c->timeline_in, l)) {
|
||||
return true;
|
||||
@@ -1587,7 +1587,7 @@ void Timeline::set_marker() {
|
||||
bool clip_mode = false;
|
||||
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr
|
||||
&& is_clip_selected(c, true)) {
|
||||
|
||||
@@ -1642,7 +1642,7 @@ void Timeline::toggle_links() {
|
||||
LinkCommand* command = new LinkCommand();
|
||||
command->s = olive::ActiveSequence;
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||
if (c != nullptr && is_clip_selected(c, true)) {
|
||||
if (!command->clips.contains(i)) command->clips.append(i);
|
||||
|
||||
@@ -1665,22 +1665,26 @@ void Timeline::toggle_links() {
|
||||
|
||||
void Timeline::increase_track_height() {
|
||||
for (int i=0;i<video_track_heights.size();i++) {
|
||||
video_track_heights[i] += TRACK_HEIGHT_INCREMENT;
|
||||
video_track_heights[i] += olive::timeline::kTrackHeightIncrement;
|
||||
}
|
||||
for (int i=0;i<audio_track_heights.size();i++) {
|
||||
audio_track_heights[i] += TRACK_HEIGHT_INCREMENT;
|
||||
audio_track_heights[i] += olive::timeline::kTrackHeightIncrement;
|
||||
}
|
||||
repaint_timeline();
|
||||
}
|
||||
|
||||
void Timeline::decrease_track_height() {
|
||||
for (int i=0;i<video_track_heights.size();i++) {
|
||||
video_track_heights[i] -= TRACK_HEIGHT_INCREMENT;
|
||||
if (video_track_heights[i] < TRACK_MIN_HEIGHT) video_track_heights[i] = TRACK_MIN_HEIGHT;
|
||||
for (int i=0;i<video_track_heights.size();i++) {
|
||||
video_track_heights[i] = qMax(
|
||||
video_track_heights[i] - olive::timeline::kTrackHeightIncrement,
|
||||
olive::timeline::kTrackMinHeight
|
||||
);
|
||||
}
|
||||
for (int i=0;i<audio_track_heights.size();i++) {
|
||||
audio_track_heights[i] -= TRACK_HEIGHT_INCREMENT;
|
||||
if (audio_track_heights[i] < TRACK_MIN_HEIGHT) audio_track_heights[i] = TRACK_MIN_HEIGHT;
|
||||
audio_track_heights[i] = qMax(
|
||||
audio_track_heights[i] - olive::timeline::kTrackHeightIncrement,
|
||||
olive::timeline::kTrackMinHeight
|
||||
);
|
||||
}
|
||||
repaint_timeline();
|
||||
}
|
||||
@@ -2059,7 +2063,7 @@ void Timeline::setup_ui() {
|
||||
setWidget(dockWidgetContents);
|
||||
}
|
||||
|
||||
void move_clip(ComboAction* ca, Clip *c, long iin, long iout, long iclip_in, int itrack, bool verify_transitions, bool relative) {
|
||||
void move_clip(ComboAction* ca, ClipPtr c, long iin, long iout, long iclip_in, int itrack, bool verify_transitions, bool relative) {
|
||||
ca->append(new MoveClipAction(c, iin, iout, iclip_in, itrack, relative));
|
||||
|
||||
if (verify_transitions) {
|
||||
|
||||
+17
-28
@@ -23,10 +23,17 @@
|
||||
|
||||
#include "ui/timelinetools.h"
|
||||
#include "project/selection.h"
|
||||
#include "project/clip.h"
|
||||
#include "project/undo.h"
|
||||
#include "ui/timelineheader.h"
|
||||
#include "ui/resizablescrollbar.h"
|
||||
#include "ui/audiomonitor.h"
|
||||
#include "ui/timelinewidget.h"
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QVector>
|
||||
#include <QTime>
|
||||
#include <QPushButton>
|
||||
|
||||
#define TRACK_DEFAULT_HEIGHT 40
|
||||
|
||||
@@ -37,30 +44,12 @@
|
||||
#define ADD_OBJ_NOISE 4
|
||||
#define ADD_OBJ_AUDIO 5
|
||||
|
||||
class QPushButton;
|
||||
class SourceTable;
|
||||
class ViewerWidget;
|
||||
class ComboAction;
|
||||
class Effect;
|
||||
class Media;
|
||||
class Transition;
|
||||
class TimelineHeader;
|
||||
class TimelineWidget;
|
||||
class ResizableScrollBar;
|
||||
class AudioMonitor;
|
||||
class QScrollBar;
|
||||
struct EffectMeta;
|
||||
struct Sequence;
|
||||
class Clip;
|
||||
struct Footage;
|
||||
struct FootageStream;
|
||||
|
||||
bool is_clip_selected(Clip* clip, bool containing);
|
||||
bool is_clip_selected(ClipPtr clip, bool containing);
|
||||
int getScreenPointFromFrame(double zoom, long frame);
|
||||
long getFrameFromScreenPoint(double zoom, int x);
|
||||
bool selection_contains_transition(const Selection& s, Clip* c, int type);
|
||||
void move_clip(ComboAction *ca, Clip *c, long iin, long iout, long iclip_in, int itrack, bool verify_transitions = true, bool relative = false);
|
||||
void ripple_clips(ComboAction *ca, Sequence* s, long point, long length, const QVector<int>& ignore = QVector<int>());
|
||||
bool selection_contains_transition(const Selection& s, ClipPtr c, int type);
|
||||
void move_clip(ComboAction *ca, ClipPtr c, long iin, long iout, long iclip_in, int itrack, bool verify_transitions = true, bool relative = false);
|
||||
void ripple_clips(ComboAction *ca, SequencePtr s, long point, long length, const QVector<int>& ignore = QVector<int>());
|
||||
|
||||
struct Ghost {
|
||||
int clip;
|
||||
@@ -85,7 +74,7 @@ struct Ghost {
|
||||
bool trimming;
|
||||
|
||||
// transition trimming
|
||||
Transition* transition;
|
||||
TransitionPtr transition;
|
||||
};
|
||||
|
||||
class Timeline : public QDockWidget
|
||||
@@ -98,15 +87,15 @@ public:
|
||||
bool focused();
|
||||
void multiply_zoom(double m);
|
||||
void copy(bool del);
|
||||
Clip* split_clip(ComboAction* ca, bool transitions, int p, long frame);
|
||||
Clip* split_clip(ComboAction* ca, bool transitions, int p, long frame, long post_in);
|
||||
ClipPtr split_clip(ComboAction* ca, bool transitions, int p, long frame);
|
||||
ClipPtr split_clip(ComboAction* ca, bool transitions, int p, long frame, long post_in);
|
||||
bool split_selection(ComboAction* ca);
|
||||
bool split_all_clips_at_point(ComboAction *ca, long point);
|
||||
bool split_clip_and_relink(ComboAction* ca, int clip, long frame, bool relink);
|
||||
void clean_up_selections(QVector<Selection>& areas);
|
||||
void deselect_area(long in, long out, int track);
|
||||
void delete_areas_and_relink(ComboAction *ca, QVector<Selection>& areas, bool deselect_areas);
|
||||
void relink_clips_using_ids(QVector<int>& old_clips, QVector<Clip*>& new_clips);
|
||||
void relink_clips_using_ids(QVector<int>& old_clips, QVector<ClipPtr>& new_clips);
|
||||
void update_sequence();
|
||||
|
||||
QVector<int> get_tracks_of_linked_clips(int i);
|
||||
@@ -114,8 +103,8 @@ public:
|
||||
void edit_to_point_internal(bool in, bool ripple);
|
||||
void delete_in_out_internal(bool ripple);
|
||||
|
||||
void create_ghosts_from_media(Sequence *seq, long entry_point, QVector<Media *> &media_list);
|
||||
void add_clips_from_ghosts(ComboAction *ca, Sequence *s);
|
||||
void create_ghosts_from_media(SequencePtr seq, long entry_point, QVector<Media *> &media_list);
|
||||
void add_clips_from_ghosts(ComboAction *ca, SequencePtr s);
|
||||
|
||||
int getTimelineScreenPointFromFrame(long frame);
|
||||
long getTimelineFrameFromScreenPoint(int x);
|
||||
|
||||
+10
-11
@@ -123,7 +123,7 @@ void Viewer::reset_all_audio() {
|
||||
if (seq != nullptr) {
|
||||
long last_frame = 0;
|
||||
for (int i=0;i<seq->clips.size();i++) {
|
||||
Clip* c = seq->clips.at(i);
|
||||
ClipPtr c = seq->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
c->reset_audio();
|
||||
last_frame = qMax(last_frame, c->timeline_out);
|
||||
@@ -438,9 +438,9 @@ void Viewer::pause() {
|
||||
panel_project->process_file_list(file_list);
|
||||
|
||||
// add it to the sequence
|
||||
Clip* c = new Clip(seq);
|
||||
ClipPtr c = ClipPtr(new Clip(seq));
|
||||
Media* m = panel_project->last_imported_media.at(0);
|
||||
Footage* f = m->to_footage();
|
||||
FootagePtr f = m->to_footage();
|
||||
|
||||
f->ready_lock.lock();
|
||||
|
||||
@@ -457,7 +457,7 @@ void Viewer::pause() {
|
||||
|
||||
f->ready_lock.unlock();
|
||||
|
||||
QVector<Clip*> add_clips;
|
||||
QVector<ClipPtr> add_clips;
|
||||
add_clips.append(c);
|
||||
olive::UndoStack.push(new AddClipCommand(seq, add_clips)); // add clip
|
||||
}
|
||||
@@ -720,11 +720,11 @@ void Viewer::set_media(Media* m) {
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* footage = media->to_footage();
|
||||
FootagePtr footage = media->to_footage();
|
||||
|
||||
marker_ref = &footage->markers;
|
||||
|
||||
seq = new Sequence();
|
||||
seq = SequencePtr(new Sequence());
|
||||
created_sequence = true;
|
||||
seq->wrapper_sequence = true;
|
||||
seq->name = footage->name;
|
||||
@@ -743,7 +743,7 @@ void Viewer::set_media(Media* m) {
|
||||
seq->height = video_stream.video_height;
|
||||
if (video_stream.video_frame_rate > 0 && !video_stream.infinite_length) seq->frame_rate = video_stream.video_frame_rate * footage->speed;
|
||||
|
||||
Clip* c = new Clip(seq);
|
||||
ClipPtr c = ClipPtr(new Clip(seq));
|
||||
c->media = media;
|
||||
c->media_stream = video_stream.file_index;
|
||||
c->timeline_in = 0;
|
||||
@@ -762,7 +762,7 @@ void Viewer::set_media(Media* m) {
|
||||
const FootageStream& audio_stream = footage->audio_tracks.at(0);
|
||||
seq->audio_frequency = audio_stream.audio_frequency;
|
||||
|
||||
Clip* c = new Clip(seq);
|
||||
ClipPtr c = ClipPtr(new Clip(seq));
|
||||
c->media = media;
|
||||
c->media_stream = audio_stream.file_index;
|
||||
c->timeline_in = 0;
|
||||
@@ -848,13 +848,12 @@ void Viewer::clean_created_seq() {
|
||||
undo_stack.command(i)
|
||||
}*/
|
||||
|
||||
delete seq;
|
||||
seq = nullptr;
|
||||
seq.reset();
|
||||
created_sequence = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::set_sequence(bool main, Sequence *s) {
|
||||
void Viewer::set_sequence(bool main, SequencePtr s) {
|
||||
pause();
|
||||
|
||||
reset_all_audio();
|
||||
|
||||
+10
-12
@@ -24,19 +24,17 @@
|
||||
#include <QDockWidget>
|
||||
#include <QTimer>
|
||||
#include <QIcon>
|
||||
|
||||
class Timeline;
|
||||
class Media;
|
||||
struct Sequence;
|
||||
class TimelineHeader;
|
||||
class ResizableScrollBar;
|
||||
class ViewerContainer;
|
||||
class LabelSlider;
|
||||
class QPushButton;
|
||||
class QLabel;
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "project/marker.h"
|
||||
#include "project/media.h"
|
||||
|
||||
#include "ui/viewerwidget.h"
|
||||
#include "ui/timelinewidget.h"
|
||||
#include "ui/timelineheader.h"
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/resizablescrollbar.h"
|
||||
|
||||
bool frame_rate_is_droppable(float rate);
|
||||
long timecode_to_frame(const QString& s, int view, double frame_rate);
|
||||
@@ -92,7 +90,7 @@ public:
|
||||
ViewerWidget* viewer_widget;
|
||||
|
||||
Media* media;
|
||||
Sequence* seq;
|
||||
SequencePtr seq;
|
||||
QVector<Marker>* marker_ref;
|
||||
|
||||
void set_marker();
|
||||
@@ -124,7 +122,7 @@ private slots:
|
||||
private:
|
||||
void update_window_title();
|
||||
void clean_created_seq();
|
||||
void set_sequence(bool main, Sequence* s);
|
||||
void set_sequence(bool main, SequencePtr s);
|
||||
bool main_sequence;
|
||||
bool created_sequence;
|
||||
long cached_end_frame;
|
||||
|
||||
+4
-8
@@ -25,15 +25,11 @@
|
||||
#include <QThread>
|
||||
#include <QWaitCondition>
|
||||
#include <QMutex>
|
||||
#include <QIODevice>
|
||||
#include <QAudioOutput>
|
||||
#include <QComboBox>
|
||||
|
||||
//#define INT16_MAX 0x7fff
|
||||
//#define INT16_MIN (-INT16_MAX-1)
|
||||
|
||||
class QIODevice;
|
||||
class QAudioOutput;
|
||||
class QComboBox;
|
||||
|
||||
struct Sequence;
|
||||
#include "project/sequence.h"
|
||||
|
||||
class AudioSenderThread : public QThread {
|
||||
Q_OBJECT
|
||||
|
||||
+12
-12
@@ -62,13 +62,13 @@ double bytes_to_seconds(int nb_bytes, int nb_channels, int sample_rate) {
|
||||
return ((double) (nb_bytes >> 1) / nb_channels / sample_rate);
|
||||
}
|
||||
|
||||
void apply_audio_effects(Clip* c, double timecode_start, AVFrame* frame, int nb_bytes, QVector<Clip*> nests) {
|
||||
void apply_audio_effects(ClipPtr c, double timecode_start, AVFrame* frame, int nb_bytes, QVector<ClipPtr> nests) {
|
||||
// perform all audio effects
|
||||
double timecode_end;
|
||||
timecode_end = timecode_start + bytes_to_seconds(nb_bytes, frame->channels, frame->sample_rate);
|
||||
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
Effect* e = c->effects.at(j);
|
||||
EffectPtr e = c->effects.at(j);
|
||||
if (e->is_enabled()) e->process_audio(timecode_start, timecode_end, frame->data[0], nb_bytes, 2);
|
||||
}
|
||||
if (c->get_opening_transition() != nullptr) {
|
||||
@@ -98,7 +98,7 @@ void apply_audio_effects(Clip* c, double timecode_start, AVFrame* frame, int nb_
|
||||
}
|
||||
|
||||
if (!nests.isEmpty()) {
|
||||
Clip* next_nest = nests.last();
|
||||
ClipPtr next_nest = nests.last();
|
||||
nests.removeLast();
|
||||
apply_audio_effects(next_nest, timecode_start + (((double)c->get_timeline_in_with_transition()-c->get_clip_in_with_transition())/c->sequence->frame_rate), frame, nb_bytes, nests);
|
||||
}
|
||||
@@ -106,7 +106,7 @@ void apply_audio_effects(Clip* c, double timecode_start, AVFrame* frame, int nb_
|
||||
|
||||
#define AUDIO_BUFFER_PADDING 2048
|
||||
|
||||
void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests, int playback_speed) {
|
||||
void cache_audio_worker(ClipPtr c, bool scrubbing, QVector<ClipPtr>& nests, int playback_speed) {
|
||||
long timeline_in = c->get_timeline_in_with_transition();
|
||||
long timeline_out = c->get_timeline_out_with_transition();
|
||||
long target_frame = c->audio_target_frame;
|
||||
@@ -460,7 +460,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests, int play
|
||||
QMetaObject::invokeMethod(panel_sequence_viewer, "play_wake", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void cache_video_worker(Clip* c, long playhead) {
|
||||
void cache_video_worker(ClipPtr c, long playhead) {
|
||||
int read_ret, send_ret, retr_ret;
|
||||
|
||||
int64_t target_pts = seconds_to_timestamp(c, playhead_to_clip_seconds(c, playhead));
|
||||
@@ -498,7 +498,7 @@ void cache_video_worker(Clip* c, long playhead) {
|
||||
while (true) {
|
||||
AVFrame* frame = av_frame_alloc();
|
||||
|
||||
Footage* media = c->media->to_footage();
|
||||
FootagePtr media = c->media->to_footage();
|
||||
const FootageStream* ms = media->get_stream_from_file_index(true, c->media_stream);
|
||||
|
||||
while ((retr_ret = av_buffersink_get_frame(c->buffersink_ctx, frame)) == AVERROR(EAGAIN)) {
|
||||
@@ -585,7 +585,7 @@ void cache_video_worker(Clip* c, long playhead) {
|
||||
}
|
||||
}
|
||||
|
||||
void reset_cache(Clip* c, long target_frame, int playback_speed) {
|
||||
void reset_cache(ClipPtr c, long target_frame, int playback_speed) {
|
||||
// if we seek to a whole other place in the timeline, we'll need to reset the cache with new values
|
||||
if (c->media == nullptr) {
|
||||
if (c->track >= 0) {
|
||||
@@ -671,11 +671,11 @@ void reset_cache(Clip* c, long target_frame, int playback_speed) {
|
||||
}
|
||||
}
|
||||
|
||||
Cacher::Cacher(Clip* c) : clip(c) {}
|
||||
Cacher::Cacher(ClipPtr c) : clip(c) {}
|
||||
|
||||
AVSampleFormat sample_format = AV_SAMPLE_FMT_S16;
|
||||
|
||||
void open_clip_worker(Clip* clip) {
|
||||
void open_clip_worker(ClipPtr clip) {
|
||||
qint64 time_start = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
if (clip->media == nullptr) {
|
||||
@@ -694,7 +694,7 @@ void open_clip_worker(Clip* clip) {
|
||||
}
|
||||
} else if (clip->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
// opens file resource for FFmpeg and prepares Clip struct for playback
|
||||
Footage* m = clip->media->to_footage();
|
||||
FootagePtr m = clip->media->to_footage();
|
||||
|
||||
// byte array for retriving raw bytes from QString URL
|
||||
QByteArray ba;
|
||||
@@ -947,7 +947,7 @@ void open_clip_worker(Clip* clip) {
|
||||
qInfo() << "Clip opened on track" << clip->track << "(took" << (QDateTime::currentMSecsSinceEpoch() - time_start) << "ms)";
|
||||
}
|
||||
|
||||
void cache_clip_worker(Clip* clip, long playhead, bool reset, bool scrubbing, QVector<Clip*> nests, int playback_speed) {
|
||||
void cache_clip_worker(ClipPtr clip, long playhead, bool reset, bool scrubbing, QVector<ClipPtr> nests, int playback_speed) {
|
||||
if (reset) {
|
||||
// note: for video, playhead is in "internal clip" frames - for audio, it's the timeline playhead
|
||||
reset_cache(clip, playhead, playback_speed);
|
||||
@@ -967,7 +967,7 @@ void cache_clip_worker(Clip* clip, long playhead, bool reset, bool scrubbing, QV
|
||||
}
|
||||
}
|
||||
|
||||
void close_clip_worker(Clip* clip) {
|
||||
void close_clip_worker(ClipPtr clip) {
|
||||
clip->finished_opening = false;
|
||||
|
||||
if (clip->media != nullptr && clip->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
|
||||
+7
-6
@@ -25,12 +25,13 @@
|
||||
#include <QVector>
|
||||
|
||||
class Clip;
|
||||
using ClipPtr = std::shared_ptr<Clip>;
|
||||
|
||||
class Cacher : public QThread
|
||||
{
|
||||
// Q_OBJECT
|
||||
public:
|
||||
Cacher(Clip* c);
|
||||
Cacher(ClipPtr c);
|
||||
void run();
|
||||
|
||||
bool caching;
|
||||
@@ -42,14 +43,14 @@ public:
|
||||
bool interrupt;
|
||||
bool queued;
|
||||
int playback_speed;
|
||||
QVector<Clip*> nests;
|
||||
QVector<ClipPtr> nests;
|
||||
|
||||
private:
|
||||
Clip* clip;
|
||||
ClipPtr clip;
|
||||
};
|
||||
|
||||
void open_clip_worker(Clip* clip);
|
||||
void cache_clip_worker(Clip* clip, long playhead, bool reset, bool scrubbing, QVector<Clip *> nest, int playback_speed);
|
||||
void close_clip_worker(Clip* clip);
|
||||
void open_clip_worker(ClipPtr clip);
|
||||
void cache_clip_worker(ClipPtr clip, long playhead, bool reset, bool scrubbing, QVector<ClipPtr> nest, int playback_speed);
|
||||
void close_clip_worker(ClipPtr clip);
|
||||
|
||||
#endif // CACHER_H
|
||||
|
||||
+17
-18
@@ -36,7 +36,6 @@
|
||||
#include "debug.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavutil/pixdesc.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libswscale/swscale.h>
|
||||
@@ -59,11 +58,11 @@ long refactor_frame_number(long framenumber, double source_frame_rate, double ta
|
||||
return qRound((double(framenumber)/source_frame_rate)*target_frame_rate);
|
||||
}
|
||||
|
||||
bool clip_uses_cacher(Clip* clip) {
|
||||
bool clip_uses_cacher(ClipPtr clip) {
|
||||
return (clip->media == nullptr && clip->track >= 0) || (clip->media != nullptr && clip->media->get_type() == MEDIA_TYPE_FOOTAGE);
|
||||
}
|
||||
|
||||
void open_clip(Clip* clip, bool multithreaded) {
|
||||
void open_clip(ClipPtr clip, bool multithreaded) {
|
||||
if (clip_uses_cacher(clip)) {
|
||||
clip->multithreaded = multithreaded;
|
||||
if (multithreaded) {
|
||||
@@ -85,7 +84,7 @@ void open_clip(Clip* clip, bool multithreaded) {
|
||||
}
|
||||
}
|
||||
|
||||
void close_clip(Clip* clip, bool wait) {
|
||||
void close_clip(ClipPtr clip, bool wait) {
|
||||
clip->finished_opening = false;
|
||||
|
||||
// destroy opengl texture in main thread
|
||||
@@ -129,7 +128,7 @@ void close_clip(Clip* clip, bool wait) {
|
||||
}
|
||||
}
|
||||
|
||||
void cache_clip(Clip* clip, long playhead, bool reset, bool scrubbing, QVector<Clip*>& nests, int playback_speed) {
|
||||
void cache_clip(ClipPtr clip, long playhead, bool reset, bool scrubbing, QVector<ClipPtr>& nests, int playback_speed) {
|
||||
if (clip_uses_cacher(clip)) {
|
||||
if (clip->multithreaded) {
|
||||
clip->cacher->playhead = playhead;
|
||||
@@ -147,11 +146,11 @@ void cache_clip(Clip* clip, long playhead, bool reset, bool scrubbing, QVector<C
|
||||
}
|
||||
}
|
||||
|
||||
double get_timecode(Clip* c, long playhead) {
|
||||
double get_timecode(ClipPtr c, long playhead) {
|
||||
return ((double)(playhead-c->get_timeline_in_with_transition()+c->get_clip_in_with_transition())/(double)c->sequence->frame_rate);
|
||||
}
|
||||
|
||||
void get_clip_frame(Clip* c, long playhead, bool& texture_failed) {
|
||||
void get_clip_frame(ClipPtr c, long playhead, bool& texture_failed) {
|
||||
if (c->finished_opening) {
|
||||
const FootageStream* ms = c->media->to_footage()->get_stream_from_file_index(c->track < 0, c->media_stream);
|
||||
|
||||
@@ -336,7 +335,7 @@ void get_clip_frame(Clip* c, long playhead, bool& texture_failed) {
|
||||
}
|
||||
|
||||
for (int i=0;i<c->effects.size();i++) {
|
||||
Effect* e = c->effects.at(i);
|
||||
EffectPtr e = c->effects.at(i);
|
||||
if (e->enable_image && e->is_enabled()) {
|
||||
if (data_buffer_1 == target_frame->data[0]) {
|
||||
data_buffer_1 = new uint8_t[frame_size];
|
||||
@@ -366,16 +365,16 @@ void get_clip_frame(Clip* c, long playhead, bool& texture_failed) {
|
||||
c->queue_lock.unlock();
|
||||
|
||||
// get more frames
|
||||
QVector<Clip*> empty;
|
||||
QVector<ClipPtr> empty;
|
||||
if (cache) cache_clip(c, playhead, reset, false, empty, false);
|
||||
}
|
||||
}
|
||||
|
||||
long playhead_to_clip_frame(Clip* c, long playhead) {
|
||||
long playhead_to_clip_frame(ClipPtr c, long playhead) {
|
||||
return (qMax(0L, playhead - c->get_timeline_in_with_transition()) + c->get_clip_in_with_transition());
|
||||
}
|
||||
|
||||
double playhead_to_clip_seconds(Clip* c, long playhead) {
|
||||
double playhead_to_clip_seconds(ClipPtr c, long playhead) {
|
||||
// returns time in seconds
|
||||
long clip_frame = playhead_to_clip_frame(c, playhead);
|
||||
if (c->reverse) clip_frame = c->getMaximumLength() - clip_frame - 1;
|
||||
@@ -384,15 +383,15 @@ double playhead_to_clip_seconds(Clip* c, long playhead) {
|
||||
return secs;
|
||||
}
|
||||
|
||||
int64_t seconds_to_timestamp(Clip* c, double seconds) {
|
||||
int64_t seconds_to_timestamp(ClipPtr c, double seconds) {
|
||||
return qRound64(seconds * av_q2d(av_inv_q(c->stream->time_base))) + qMax((int64_t) 0, c->stream->start_time);
|
||||
}
|
||||
|
||||
int64_t playhead_to_timestamp(Clip* c, long playhead) {
|
||||
int64_t playhead_to_timestamp(ClipPtr c, long playhead) {
|
||||
return seconds_to_timestamp(c, playhead_to_clip_seconds(c, playhead));
|
||||
}
|
||||
|
||||
int retrieve_next_frame(Clip* c, AVFrame* f) {
|
||||
int retrieve_next_frame(ClipPtr c, AVFrame* f) {
|
||||
int result = 0;
|
||||
int receive_ret;
|
||||
|
||||
@@ -438,7 +437,7 @@ int retrieve_next_frame(Clip* c, AVFrame* f) {
|
||||
return result;
|
||||
}
|
||||
|
||||
bool is_clip_active(Clip* c, long playhead) {
|
||||
bool is_clip_active(ClipPtr c, long playhead) {
|
||||
// these buffers allow clips to be opened and prepared well before they're displayed
|
||||
// as well as closed a little after they're not needed anymore
|
||||
int open_buffer = qCeil(c->sequence->frame_rate*2);
|
||||
@@ -451,7 +450,7 @@ bool is_clip_active(Clip* c, long playhead) {
|
||||
&& playhead - c->get_timeline_in_with_transition() + c->get_clip_in_with_transition() < c->getMaximumLength();
|
||||
}
|
||||
|
||||
void set_sequence(Sequence* s) {
|
||||
void set_sequence(SequencePtr s) {
|
||||
panel_effect_controls->clear_effects(true);
|
||||
olive::ActiveSequence = s;
|
||||
panel_sequence_viewer->set_main_sequence();
|
||||
@@ -459,10 +458,10 @@ void set_sequence(Sequence* s) {
|
||||
panel_timeline->setFocus();
|
||||
}
|
||||
|
||||
void closeActiveClips(Sequence *s) {
|
||||
void closeActiveClips(SequencePtr s) {
|
||||
if (s != nullptr) {
|
||||
for (int i=0;i<s->clips.size();i++) {
|
||||
Clip* c = s->clips.at(i);
|
||||
ClipPtr c = s->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
closeActiveClips(c->media->to_sequence());
|
||||
|
||||
+23
-21
@@ -24,30 +24,32 @@
|
||||
#include <QVector>
|
||||
#include <QMutex>
|
||||
|
||||
class Clip;
|
||||
struct ClipCache;
|
||||
struct Sequence;
|
||||
struct AVFrame;
|
||||
#include "project/clip.h"
|
||||
#include "project/sequence.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
}
|
||||
|
||||
long refactor_frame_number(long framenumber, double source_frame_rate, double target_frame_rate);
|
||||
bool clip_uses_cacher(Clip* clip);
|
||||
void open_clip(Clip* clip, bool multithreaded);
|
||||
void cache_clip(Clip* clip, long playhead, bool reset, bool scrubbing, QVector<Clip *> &nests, int playback_speed);
|
||||
void close_clip(Clip* clip, bool wait);
|
||||
void handle_media(Sequence* sequence, long playhead, bool multithreaded);
|
||||
void reset_cache(Clip* c, long target_frame, int playback_speed);
|
||||
void get_clip_frame(Clip* c, long playhead, bool &texture_failed);
|
||||
double get_timecode(Clip* c, long playhead);
|
||||
bool clip_uses_cacher(ClipPtr clip);
|
||||
void open_clip(ClipPtr clip, bool multithreaded);
|
||||
void cache_clip(ClipPtr clip, long playhead, bool reset, bool scrubbing, QVector<ClipPtr> &nests, int playback_speed);
|
||||
void close_clip(ClipPtr clip, bool wait);
|
||||
void handle_media(SequencePtr sequence, long playhead, bool multithreaded);
|
||||
void reset_cache(ClipPtr c, long target_frame, int playback_speed);
|
||||
void get_clip_frame(ClipPtr c, long playhead, bool &texture_failed);
|
||||
double get_timecode(ClipPtr c, long playhead);
|
||||
|
||||
long playhead_to_clip_frame(Clip* c, long playhead);
|
||||
double playhead_to_clip_seconds(Clip* c, long playhead);
|
||||
int64_t seconds_to_timestamp(Clip* c, double seconds);
|
||||
int64_t playhead_to_timestamp(Clip* c, long playhead);
|
||||
long playhead_to_clip_frame(ClipPtr c, long playhead);
|
||||
double playhead_to_clip_seconds(ClipPtr c, long playhead);
|
||||
int64_t seconds_to_timestamp(ClipPtr c, double seconds);
|
||||
int64_t playhead_to_timestamp(ClipPtr c, long playhead);
|
||||
|
||||
int retrieve_next_frame(Clip* c, AVFrame* f);
|
||||
bool is_clip_active(Clip* c, long playhead);
|
||||
void get_next_audio(Clip* c, bool mix);
|
||||
void set_sequence(Sequence* s);
|
||||
void closeActiveClips(Sequence* s);
|
||||
int retrieve_next_frame(ClipPtr c, AVFrame* f);
|
||||
bool is_clip_active(ClipPtr c, long playhead);
|
||||
void get_next_audio(ClipPtr c, bool mix);
|
||||
void set_sequence(SequencePtr s);
|
||||
void closeActiveClips(SequencePtr s);
|
||||
|
||||
#endif // PLAYBACK_H
|
||||
|
||||
+18
-24
@@ -34,11 +34,7 @@
|
||||
#include "undo.h"
|
||||
#include "debug.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
}
|
||||
|
||||
Clip::Clip(Sequence* s) :
|
||||
Clip::Clip(SequencePtr s) :
|
||||
sequence(s),
|
||||
enabled(true),
|
||||
clip_in(0),
|
||||
@@ -64,8 +60,8 @@ Clip::Clip(Sequence* s) :
|
||||
reset();
|
||||
}
|
||||
|
||||
Clip* Clip::copy(Sequence* s, bool duplicate_transitions) {
|
||||
Clip* copy = new Clip(s);
|
||||
ClipPtr Clip::copy(SequencePtr s, bool duplicate_transitions) {
|
||||
ClipPtr copy(new Clip(s));
|
||||
|
||||
copy->enabled = enabled;
|
||||
copy->name = QString(name);
|
||||
@@ -122,9 +118,9 @@ void Clip::reset_audio() {
|
||||
frame_sample_index = -1;
|
||||
audio_buffer_write = 0;
|
||||
} else if (media->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* nested_sequence = media->to_sequence();
|
||||
SequencePtr nested_sequence = media->to_sequence();
|
||||
for (int i=0;i<nested_sequence->clips.size();i++) {
|
||||
Clip* c = nested_sequence->clips.at(i);
|
||||
ClipPtr c = nested_sequence->clips.at(i);
|
||||
if (c != nullptr) c->reset_audio();
|
||||
}
|
||||
}
|
||||
@@ -133,7 +129,7 @@ void Clip::reset_audio() {
|
||||
void Clip::refresh() {
|
||||
// validates media if it was replaced
|
||||
if (replaced && media != nullptr && media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* m = media->to_footage();
|
||||
FootagePtr m = media->to_footage();
|
||||
|
||||
if (track < 0 && m->video_tracks.size() > 0) {
|
||||
media_stream = m->video_tracks.at(0).file_index;
|
||||
@@ -177,7 +173,7 @@ QVector<Marker> &Clip::get_markers() {
|
||||
return markers;
|
||||
}
|
||||
|
||||
Transition* Clip::get_opening_transition() {
|
||||
TransitionPtr Clip::get_opening_transition() {
|
||||
if (opening_transition > -1) {
|
||||
if (this->sequence == nullptr) {
|
||||
return clipboard_transitions.at(opening_transition);
|
||||
@@ -188,7 +184,7 @@ Transition* Clip::get_opening_transition() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Transition* Clip::get_closing_transition() {
|
||||
TransitionPtr Clip::get_closing_transition() {
|
||||
if (closing_transition > -1) {
|
||||
if (this->sequence == nullptr) {
|
||||
return clipboard_transitions.at(closing_transition);
|
||||
@@ -201,15 +197,13 @@ Transition* Clip::get_closing_transition() {
|
||||
|
||||
Clip::~Clip() {
|
||||
if (open) {
|
||||
close_clip(this, true);
|
||||
close_clip(ClipPtr(this), true);
|
||||
}
|
||||
|
||||
if (opening_transition != -1) this->sequence->hard_delete_transition(this, TA_OPENING_TRANSITION);
|
||||
if (closing_transition != -1) this->sequence->hard_delete_transition(this, TA_CLOSING_TRANSITION);
|
||||
if (opening_transition != -1) this->sequence->hard_delete_transition(ClipPtr(this), TA_OPENING_TRANSITION);
|
||||
if (closing_transition != -1) this->sequence->hard_delete_transition(ClipPtr(this), TA_CLOSING_TRANSITION);
|
||||
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
delete effects.at(i);
|
||||
}
|
||||
effects.clear();
|
||||
av_packet_free(&pkt);
|
||||
}
|
||||
|
||||
@@ -265,7 +259,7 @@ void Clip::recalculateMaxLength() {
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* m = media->to_footage();
|
||||
FootagePtr m = media->to_footage();
|
||||
const FootageStream* ms = m->get_stream_from_file_index(track < 0, media_stream);
|
||||
if (ms != nullptr && ms->infinite_length) {
|
||||
calculated_length = LONG_MAX;
|
||||
@@ -276,7 +270,7 @@ void Clip::recalculateMaxLength() {
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media->to_sequence();
|
||||
SequencePtr s = media->to_sequence();
|
||||
calculated_length = refactor_frame_number(s->getEndFrame(), s->frame_rate, fr);
|
||||
}
|
||||
break;
|
||||
@@ -301,7 +295,7 @@ int Clip::getWidth() {
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media->to_sequence();
|
||||
SequencePtr s = media->to_sequence();
|
||||
return s->width;
|
||||
break;
|
||||
}
|
||||
@@ -320,7 +314,7 @@ int Clip::getHeight() {
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media->to_sequence();
|
||||
SequencePtr s = media->to_sequence();
|
||||
return s->height;
|
||||
}
|
||||
}
|
||||
@@ -329,7 +323,7 @@ int Clip::getHeight() {
|
||||
|
||||
void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points) {
|
||||
if (change_timeline_points) {
|
||||
move_clip(ca, this,
|
||||
move_clip(ca, ClipPtr(this),
|
||||
qRound((double) timeline_in * multiplier),
|
||||
qRound((double) timeline_out * multiplier),
|
||||
qRound((double) clip_in * multiplier),
|
||||
@@ -338,7 +332,7 @@ void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_t
|
||||
|
||||
// move keyframes
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
Effect* e = effects.at(i);
|
||||
EffectPtr e = effects.at(i);
|
||||
for (int j=0;j<e->row_count();j++) {
|
||||
EffectRow* r = e->row(j);
|
||||
for (int l=0;l<r->fieldCount();l++) {
|
||||
|
||||
+25
-28
@@ -24,37 +24,34 @@
|
||||
#include <QWaitCondition>
|
||||
#include <QMutex>
|
||||
#include <QVector>
|
||||
#include <QOpenGLFramebufferObject>
|
||||
#include <QOpenGLTexture>
|
||||
|
||||
#include "playback/cacher.h"
|
||||
|
||||
#include "project/effect.h"
|
||||
#include "project/transition.h"
|
||||
#include "project/comboaction.h"
|
||||
#include "project/media.h"
|
||||
#include "footage.h"
|
||||
|
||||
#include "marker.h"
|
||||
|
||||
class Cacher;
|
||||
class Effect;
|
||||
class Transition;
|
||||
class QOpenGLFramebufferObject;
|
||||
class ComboAction;
|
||||
class Media;
|
||||
struct Sequence;
|
||||
struct Footage;
|
||||
struct FootageStream;
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavfilter/avfilter.h>
|
||||
}
|
||||
|
||||
struct AVFormatContext;
|
||||
struct AVStream;
|
||||
struct AVCodec;
|
||||
struct AVCodecContext;
|
||||
struct AVFrame;
|
||||
struct AVPacket;
|
||||
struct SwsContext;
|
||||
struct SwrContext;
|
||||
struct AVFilterGraph;
|
||||
struct AVFilterContext;
|
||||
struct AVDictionary;
|
||||
class QOpenGLTexture;
|
||||
using ClipPtr = std::shared_ptr<Clip>;
|
||||
|
||||
class Sequence;
|
||||
using SequencePtr = std::shared_ptr<Sequence>;
|
||||
|
||||
class Clip {
|
||||
public:
|
||||
Clip(Sequence* s);
|
||||
Clip(SequencePtr s);
|
||||
~Clip();
|
||||
Clip* copy(Sequence* s, bool duplicate_transitions = true);
|
||||
ClipPtr copy(SequencePtr s, bool duplicate_transitions = true);
|
||||
void reset_audio();
|
||||
void reset();
|
||||
void refresh();
|
||||
@@ -68,7 +65,7 @@ public:
|
||||
int getWidth();
|
||||
int getHeight();
|
||||
void refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points);
|
||||
Sequence* sequence;
|
||||
SequencePtr sequence;
|
||||
|
||||
// queue functions
|
||||
void queue_clear();
|
||||
@@ -84,7 +81,7 @@ public:
|
||||
quint8 color_r;
|
||||
quint8 color_g;
|
||||
quint8 color_b;
|
||||
Media* media;
|
||||
Media* media;
|
||||
int media_stream;
|
||||
double speed;
|
||||
double cached_fr;
|
||||
@@ -96,12 +93,12 @@ public:
|
||||
QVector<Marker>& get_markers();
|
||||
|
||||
// other variables (should be deep copied/duplicated in copy())
|
||||
QList<Effect*> effects;
|
||||
QList<EffectPtr> effects;
|
||||
QVector<int> linked;
|
||||
int opening_transition;
|
||||
Transition* get_opening_transition();
|
||||
TransitionPtr get_opening_transition();
|
||||
int closing_transition;
|
||||
Transition* get_closing_transition();
|
||||
TransitionPtr get_closing_transition();
|
||||
|
||||
// media handling
|
||||
AVFormatContext* formatCtx;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "comboaction.h"
|
||||
|
||||
ComboAction::ComboAction() {}
|
||||
|
||||
ComboAction::~ComboAction() {
|
||||
for (int i=0;i<commands.size();i++) {
|
||||
delete commands.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::undo() {
|
||||
for (int i=commands.size()-1;i>=0;i--) {
|
||||
commands.at(i)->undo();
|
||||
}
|
||||
for (int i=0;i<post_commands.size();i++) {
|
||||
post_commands.at(i)->undo();
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::redo() {
|
||||
for (int i=0;i<commands.size();i++) {
|
||||
commands.at(i)->redo();
|
||||
}
|
||||
for (int i=0;i<post_commands.size();i++) {
|
||||
post_commands.at(i)->redo();
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::append(QUndoCommand* u) {
|
||||
commands.append(u);
|
||||
}
|
||||
|
||||
void ComboAction::appendPost(QUndoCommand* u) {
|
||||
post_commands.append(u);
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
#ifndef COMBOACTION_H
|
||||
#define COMBOACTION_H
|
||||
|
||||
#include <QUndoCommand>
|
||||
#include <QVector>
|
||||
|
||||
/**
|
||||
* @brief The ComboAction class
|
||||
*
|
||||
* The Undo/Redo system works by stacking an action that knows how to "do" and also "undo" itself. As Olive is
|
||||
* a very complex program, there are many actions that can in one "user action". For example, moving a clip over
|
||||
* another will delete the clip under it, which is at least two actions that need to be undone if the user clicks
|
||||
* undo, however the user only (knowingly) did one thing and would find it confusing if this one user action required
|
||||
* to undos to complete undo.
|
||||
*
|
||||
* To address this, ComboAction is an undo action that simply compiles several possible actions into one, doing them
|
||||
* all on every redo, and undoing them all on every undo.
|
||||
*/
|
||||
class ComboAction : public QUndoCommand {
|
||||
public:
|
||||
/**
|
||||
* @brief ComboAction Constructor. Currently empty.
|
||||
*/
|
||||
ComboAction();
|
||||
|
||||
/**
|
||||
* @brief ~ComboAction Destructor. Cleans up all QUndoCommand classes that have been added to it.
|
||||
*/
|
||||
virtual ~ComboAction() override;
|
||||
|
||||
/**
|
||||
* @brief Undo Function
|
||||
*
|
||||
* Called by the QUndoStack to undo.
|
||||
*
|
||||
* Calls QUndoCommand::undo() on all QUndoCommand objects added by append()
|
||||
* in REVERSE order to how they were added. Then calls QUndoCommand::redo() on every action added by appendPost()
|
||||
* in the order they were added (not in reverse).
|
||||
*/
|
||||
virtual void undo() override;
|
||||
|
||||
/**
|
||||
* @brief Redo Function
|
||||
*
|
||||
* Called by the QUndoStack to redo.
|
||||
*
|
||||
* Calls QUndoCommand::redo() on all QUndoCommand objects added by append()
|
||||
* in the order they were added. Then calls QUndoCommand::redo() on every action added by appendPost() in
|
||||
* the order they were added.
|
||||
*/
|
||||
virtual void redo() override;
|
||||
|
||||
/**
|
||||
* @brief Add an undo action
|
||||
*
|
||||
* Add an action to be done/undone. ComboAction takes ownership of this QUndoCommand and will delete it when
|
||||
* it is deleted.
|
||||
*
|
||||
* @param u
|
||||
*
|
||||
* The QUndoCommand to add.
|
||||
*/
|
||||
void append(QUndoCommand* u);
|
||||
|
||||
/**
|
||||
* @brief Add a post-undo PostAction
|
||||
*
|
||||
* Sometimes the results of all the actions require another function to be called (e.g. repainting the Viewer).
|
||||
* QUndoCommand objects added by appendPost() will run after EVERY QUndoCommand added by append() has been run.
|
||||
*
|
||||
* @param u
|
||||
*
|
||||
* The PostAction to add
|
||||
*/
|
||||
void appendPost(QUndoCommand* u);
|
||||
private:
|
||||
/**
|
||||
* @brief Internal array of QUndoCommand objects
|
||||
*/
|
||||
QVector<QUndoCommand*> commands;
|
||||
|
||||
/**
|
||||
* @brief Internal array of PostAction objects
|
||||
*/
|
||||
QVector<QUndoCommand*> post_commands;
|
||||
};
|
||||
|
||||
#endif // COMBOACTION_H
|
||||
+21
-21
@@ -69,31 +69,31 @@
|
||||
|
||||
QVector<EffectMeta> effects;
|
||||
|
||||
Effect* create_effect(Clip* c, const EffectMeta* em) {
|
||||
EffectPtr create_effect(ClipPtr c, const EffectMeta* em) {
|
||||
if (em->internal >= 0 && em->internal < EFFECT_INTERNAL_COUNT) {
|
||||
// must be an internal effect
|
||||
switch (em->internal) {
|
||||
case EFFECT_INTERNAL_TRANSFORM: return new TransformEffect(c, em);
|
||||
case EFFECT_INTERNAL_TEXT: return new TextEffect(c, em);
|
||||
case EFFECT_INTERNAL_TIMECODE: return new TimecodeEffect(c, em);
|
||||
case EFFECT_INTERNAL_SOLID: return new SolidEffect(c, em);
|
||||
case EFFECT_INTERNAL_NOISE: return new AudioNoiseEffect(c, em);
|
||||
case EFFECT_INTERNAL_VOLUME: return new VolumeEffect(c, em);
|
||||
case EFFECT_INTERNAL_PAN: return new PanEffect(c, em);
|
||||
case EFFECT_INTERNAL_TONE: return new ToneEffect(c, em);
|
||||
case EFFECT_INTERNAL_SHAKE: return new ShakeEffect(c, em);
|
||||
case EFFECT_INTERNAL_CORNERPIN: return new CornerPinEffect(c, em);
|
||||
case EFFECT_INTERNAL_FILLLEFTRIGHT: return new FillLeftRightEffect(c, em);
|
||||
case EFFECT_INTERNAL_TRANSFORM: return EffectPtr(new TransformEffect(c, em));
|
||||
case EFFECT_INTERNAL_TEXT: return EffectPtr(new TextEffect(c, em));
|
||||
case EFFECT_INTERNAL_TIMECODE: return EffectPtr(new TimecodeEffect(c, em));
|
||||
case EFFECT_INTERNAL_SOLID: return EffectPtr(new SolidEffect(c, em));
|
||||
case EFFECT_INTERNAL_NOISE: return EffectPtr(new AudioNoiseEffect(c, em));
|
||||
case EFFECT_INTERNAL_VOLUME: return EffectPtr(new VolumeEffect(c, em));
|
||||
case EFFECT_INTERNAL_PAN: return EffectPtr(new PanEffect(c, em));
|
||||
case EFFECT_INTERNAL_TONE: return EffectPtr(new ToneEffect(c, em));
|
||||
case EFFECT_INTERNAL_SHAKE: return EffectPtr(new ShakeEffect(c, em));
|
||||
case EFFECT_INTERNAL_CORNERPIN: return EffectPtr(new CornerPinEffect(c, em));
|
||||
case EFFECT_INTERNAL_FILLLEFTRIGHT: return EffectPtr(new FillLeftRightEffect(c, em));
|
||||
#ifndef NOVST
|
||||
case EFFECT_INTERNAL_VST: return new VSTHost(c, em);
|
||||
case EFFECT_INTERNAL_VST: return EffectPtr(new VSTHost(c, em));
|
||||
#endif
|
||||
#ifndef NOFREI0R
|
||||
case EFFECT_INTERNAL_FREI0R: return new Frei0rEffect(c, em);
|
||||
case EFFECT_INTERNAL_FREI0R: return EffectPtr(new Frei0rEffect(c, em));
|
||||
#endif
|
||||
}
|
||||
} else if (!em->filename.isEmpty()) {
|
||||
// load effect from file
|
||||
return new Effect(c, em);
|
||||
return EffectPtr(new Effect(c, em));
|
||||
} else {
|
||||
qCritical() << "Invalid effect data";
|
||||
QMessageBox::critical(olive::MainWindow,
|
||||
@@ -112,7 +112,7 @@ const EffectMeta* get_internal_meta(int internal_id, int type) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Effect::Effect(Clip* c, const EffectMeta *em) :
|
||||
Effect::Effect(ClipPtr c, const EffectMeta *em) :
|
||||
parent_clip(c),
|
||||
meta(em),
|
||||
enable_shader(false),
|
||||
@@ -344,7 +344,7 @@ Effect::~Effect() {
|
||||
}
|
||||
}
|
||||
|
||||
void Effect::copy_field_keyframes(Effect* e) {
|
||||
void Effect::copy_field_keyframes(EffectPtr e) {
|
||||
for (int i=0;i<rows.size();i++) {
|
||||
EffectRow* row = rows.at(i);
|
||||
EffectRow* copy_row = e->rows.at(i);
|
||||
@@ -498,7 +498,7 @@ void Effect::load_from_file() {
|
||||
QFile file_handle(file);
|
||||
if (file_handle.open(QFile::ReadOnly)) {
|
||||
|
||||
olive::UndoStack.push(new SetEffectData(this, file_handle.readAll()));
|
||||
olive::UndoStack.push(new SetEffectData(EffectPtr(this), file_handle.readAll()));
|
||||
|
||||
file_handle.close();
|
||||
|
||||
@@ -515,7 +515,7 @@ void Effect::load_from_file() {
|
||||
int Effect::get_index_in_clip() {
|
||||
if (parent_clip != nullptr) {
|
||||
for (int i=0;i<parent_clip->effects.size();i++) {
|
||||
if (parent_clip->effects.at(i) == this) {
|
||||
if (parent_clip->effects.at(i).get() == this) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -854,8 +854,8 @@ void Effect::setIterations(int i) {
|
||||
|
||||
void Effect::process_image(double, uint8_t *, uint8_t *, int){}
|
||||
|
||||
Effect* Effect::copy(Clip* c) {
|
||||
Effect* copy = create_effect(c, meta);
|
||||
EffectPtr Effect::copy(ClipPtr c) {
|
||||
EffectPtr copy = create_effect(c, meta);
|
||||
copy->set_enabled(is_enabled());
|
||||
copy_field_keyframes(copy);
|
||||
return copy;
|
||||
|
||||
+18
-15
@@ -30,19 +30,22 @@
|
||||
#include <QOpenGLTexture>
|
||||
#include <QMutex>
|
||||
#include <QThread>
|
||||
class QLabel;
|
||||
class QWidget;
|
||||
class CollapsibleWidget;
|
||||
class QGridLayout;
|
||||
class QPushButton;
|
||||
class QMouseEvent;
|
||||
#include <QLabel>
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QPushButton>
|
||||
#include <QMouseEvent>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamWriter>
|
||||
|
||||
#include "ui/collapsiblewidget.h"
|
||||
#include "ui/checkboxex.h"
|
||||
|
||||
class Clip;
|
||||
class QXmlStreamReader;
|
||||
class QXmlStreamWriter;
|
||||
using ClipPtr = std::shared_ptr<Clip>;
|
||||
|
||||
class Effect;
|
||||
class EffectRow;
|
||||
class CheckboxEx;
|
||||
using EffectPtr = std::shared_ptr<Effect>;
|
||||
|
||||
struct EffectMeta {
|
||||
QString name;
|
||||
@@ -57,7 +60,7 @@ struct EffectMeta {
|
||||
extern QVector<EffectMeta> effects;
|
||||
|
||||
double log_volume(double linear);
|
||||
Effect* create_effect(Clip* c, const EffectMeta *em);
|
||||
EffectPtr create_effect(ClipPtr c, const EffectMeta *em);
|
||||
const EffectMeta* get_internal_meta(int internal_id, int type);
|
||||
|
||||
enum EffectType {
|
||||
@@ -166,9 +169,9 @@ qint16 mix_audio_sample(qint16 a, qint16 b);
|
||||
class Effect : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Effect(Clip* c, const EffectMeta* em);
|
||||
Effect(ClipPtr c, const EffectMeta* em);
|
||||
~Effect();
|
||||
Clip* parent_clip;
|
||||
ClipPtr parent_clip;
|
||||
const EffectMeta* meta;
|
||||
int id;
|
||||
QString name;
|
||||
@@ -187,8 +190,8 @@ public:
|
||||
|
||||
virtual void refresh();
|
||||
|
||||
virtual Effect* copy(Clip* c);
|
||||
void copy_field_keyframes(Effect *e);
|
||||
virtual EffectPtr copy(ClipPtr c);
|
||||
void copy_field_keyframes(EffectPtr e);
|
||||
|
||||
virtual void load(QXmlStreamReader& stream);
|
||||
virtual void custom_load(QXmlStreamReader& stream);
|
||||
|
||||
@@ -116,7 +116,7 @@ void EffectRow::set_keyframe_enabled(bool enabled) {
|
||||
|
||||
void EffectRow::goto_previous_key() {
|
||||
long key = LONG_MIN;
|
||||
Clip* c = parent_effect->parent_clip;
|
||||
ClipPtr c = parent_effect->parent_clip;
|
||||
for (int i=0;i<fieldCount();i++) {
|
||||
EffectField* f = field(i);
|
||||
for (int j=0;j<f->keyframes.size();j++) {
|
||||
@@ -132,7 +132,7 @@ void EffectRow::goto_previous_key() {
|
||||
void EffectRow::toggle_key() {
|
||||
QVector<EffectField*> key_fields;
|
||||
QVector<int> key_field_index;
|
||||
Clip* c = parent_effect->parent_clip;
|
||||
ClipPtr c = parent_effect->parent_clip;
|
||||
for (int j=0;j<fieldCount();j++) {
|
||||
EffectField* f = field(j);
|
||||
for (int i=0;i<f->keyframes.size();i++) {
|
||||
@@ -159,7 +159,7 @@ void EffectRow::toggle_key() {
|
||||
|
||||
void EffectRow::goto_next_key() {
|
||||
long key = LONG_MAX;
|
||||
Clip* c = parent_effect->parent_clip;
|
||||
ClipPtr c = parent_effect->parent_clip;
|
||||
for (int i=0;i<fieldCount();i++) {
|
||||
EffectField* f = field(i);
|
||||
for (int j=0;j<f->keyframes.size();j++) {
|
||||
|
||||
+3
-1
@@ -37,7 +37,7 @@ enum VideoInterlacingMode {
|
||||
VIDEO_BOTTOM_FIELD_FIRST
|
||||
};
|
||||
|
||||
struct Sequence;
|
||||
class Sequence;
|
||||
class Clip;
|
||||
class PreviewGenerator;
|
||||
class MediaThrobber;
|
||||
@@ -101,4 +101,6 @@ struct Footage {
|
||||
void reset();
|
||||
};
|
||||
|
||||
using FootagePtr = std::shared_ptr<Footage>;
|
||||
|
||||
#endif // FOOTAGE_H
|
||||
|
||||
+3
-3
@@ -48,7 +48,7 @@ void draw_marker(QPainter &p, int x, int y, int bottom, bool selected) {
|
||||
p.drawPolygon(points, 5);
|
||||
}
|
||||
|
||||
void set_marker_internal(Sequence* seq, const QVector<int>& clips) {
|
||||
void set_marker_internal(SequencePtr seq, const QVector<int>& clips) {
|
||||
// if clips is empty, the marker is being added to the sequence
|
||||
|
||||
// add_marker is used to determine whether we're adding a marker, depending on whether the user input a marker name
|
||||
@@ -78,7 +78,7 @@ void set_marker_internal(Sequence* seq, const QVector<int>& clips) {
|
||||
|
||||
// add a marker action for each clip
|
||||
foreach (int i, clips) {
|
||||
Clip* c = seq->clips.at(i);
|
||||
ClipPtr c = seq->clips.at(i);
|
||||
ca->append(new AddMarkerAction(&c->get_markers(),
|
||||
seq->playhead - c->timeline_in + c->clip_in,
|
||||
marker_name));
|
||||
@@ -119,7 +119,7 @@ void set_marker_internal(Sequence* seq, const QVector<int>& clips) {
|
||||
}
|
||||
}
|
||||
|
||||
void set_marker_internal(Sequence* seq) {
|
||||
void set_marker_internal(SequencePtr seq) {
|
||||
// create empty clip array
|
||||
QVector<int> clips;
|
||||
|
||||
|
||||
+4
-3
@@ -26,7 +26,8 @@
|
||||
#include <QString>
|
||||
#include <QPainter>
|
||||
|
||||
struct Sequence;
|
||||
class Sequence;
|
||||
using SequencePtr = std::shared_ptr<Sequence>;
|
||||
|
||||
struct Marker {
|
||||
long frame;
|
||||
@@ -35,7 +36,7 @@ struct Marker {
|
||||
|
||||
void draw_marker(QPainter& p, int x, int y, int bottom, bool selected);
|
||||
|
||||
void set_marker_internal(Sequence* seq, const QVector<int>& clips);
|
||||
void set_marker_internal(Sequence* seq);
|
||||
void set_marker_internal(SequencePtr seq, const QVector<int>& clips);
|
||||
void set_marker_internal(SequencePtr seq);
|
||||
|
||||
#endif // MARKER_H
|
||||
|
||||
+20
-21
@@ -68,30 +68,29 @@ Media::Media(Media* iparent) :
|
||||
{}
|
||||
|
||||
Media::~Media() {
|
||||
switch (get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE: delete to_footage(); break;
|
||||
case MEDIA_TYPE_SEQUENCE: if (object != nullptr) delete to_sequence(); break;
|
||||
}
|
||||
for (int i=0;i<children.size();i++) {
|
||||
delete children.at(i);
|
||||
}
|
||||
delete throbber;
|
||||
}
|
||||
|
||||
Footage *Media::to_footage() {
|
||||
return static_cast<Footage*>(object);
|
||||
FootagePtr Media::to_footage() {
|
||||
return std::static_pointer_cast<Footage>(object);
|
||||
}
|
||||
|
||||
Sequence *Media::to_sequence() {
|
||||
return static_cast<Sequence*>(object);
|
||||
SequencePtr Media::to_sequence() {
|
||||
return std::static_pointer_cast<Sequence>(object);
|
||||
}
|
||||
|
||||
void Media::set_footage(Footage *f) {
|
||||
void Media::set_footage(FootagePtr f) {
|
||||
type = MEDIA_TYPE_FOOTAGE;
|
||||
object = f;
|
||||
object = VoidPtr(f);
|
||||
}
|
||||
|
||||
void Media::set_sequence(Sequence *s) {
|
||||
void Media::set_sequence(SequencePtr s) {
|
||||
set_icon(QIcon(":/icons/sequence.png"));
|
||||
type = MEDIA_TYPE_SEQUENCE;
|
||||
object = s;
|
||||
object = VoidPtr(s);
|
||||
if (s != nullptr) update_tooltip();
|
||||
}
|
||||
|
||||
@@ -114,7 +113,7 @@ void Media::update_tooltip(const QString& error) {
|
||||
switch (type) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* f = to_footage();
|
||||
FootagePtr f = to_footage();
|
||||
tooltip = QCoreApplication::translate("Media", "Name:") + " " + f->name + "\n" + QCoreApplication::translate("Media", "Filename:") + " " + f->url + "\n";
|
||||
|
||||
if (error.isEmpty()) {
|
||||
@@ -185,7 +184,7 @@ void Media::update_tooltip(const QString& error) {
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = to_sequence();
|
||||
SequencePtr s = to_sequence();
|
||||
|
||||
tooltip = QCoreApplication::translate("Media", "Name: %1"
|
||||
"\nVideo Dimensions: %2x%3"
|
||||
@@ -205,7 +204,7 @@ void Media::update_tooltip(const QString& error) {
|
||||
|
||||
}
|
||||
|
||||
void *Media::to_object() {
|
||||
VoidPtr Media::to_object() {
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -233,7 +232,7 @@ double Media::get_frame_rate(int stream) {
|
||||
switch (get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* f = to_footage();
|
||||
FootagePtr f = to_footage();
|
||||
if (stream < 0) return f->video_tracks.at(0).video_frame_rate * f->speed;
|
||||
return f->get_stream_from_file_index(true, stream)->video_frame_rate * f->speed;
|
||||
}
|
||||
@@ -246,7 +245,7 @@ int Media::get_sampling_rate(int stream) {
|
||||
switch (get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* f = to_footage();
|
||||
FootagePtr f = to_footage();
|
||||
if (stream < 0) return f->audio_tracks.at(0).audio_frequency * f->speed;
|
||||
return to_footage()->get_stream_from_file_index(false, stream)->audio_frequency * f->speed;
|
||||
}
|
||||
@@ -288,7 +287,7 @@ QVariant Media::data(int column, int role) {
|
||||
case Qt::DecorationRole:
|
||||
if (column == 0) {
|
||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = to_footage();
|
||||
FootagePtr f = to_footage();
|
||||
if (f->video_tracks.size() > 0
|
||||
&& f->video_tracks.at(0).preview_done) {
|
||||
return f->video_tracks.at(0).video_preview_square;
|
||||
@@ -304,11 +303,11 @@ QVariant Media::data(int column, int role) {
|
||||
case 1:
|
||||
if (root) return QCoreApplication::translate("Media", "Duration");
|
||||
if (get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* s = to_sequence();
|
||||
SequencePtr s = to_sequence();
|
||||
return frame_to_timecode(s->getEndFrame(), olive::CurrentConfig.timecode_view, s->frame_rate);
|
||||
}
|
||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = to_footage();
|
||||
FootagePtr f = to_footage();
|
||||
double r = 30;
|
||||
|
||||
if (f->video_tracks.size() > 0 && !qIsNull(f->video_tracks.at(0).video_frame_rate))
|
||||
@@ -322,7 +321,7 @@ QVariant Media::data(int column, int role) {
|
||||
if (root) return QCoreApplication::translate("Media", "Rate");
|
||||
if (get_type() == MEDIA_TYPE_SEQUENCE) return QString::number(get_frame_rate()) + " FPS";
|
||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = to_footage();
|
||||
FootagePtr f = to_footage();
|
||||
double r;
|
||||
if (f->video_tracks.size() > 0 && !qIsNull(r = get_frame_rate())) {
|
||||
return QString::number(get_frame_rate()) + " FPS";
|
||||
|
||||
+13
-9
@@ -23,8 +23,10 @@
|
||||
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <QIcon>
|
||||
|
||||
#include "project/marker.h"
|
||||
#include "project/footage.h"
|
||||
|
||||
enum MediaType {
|
||||
MEDIA_TYPE_FOOTAGE,
|
||||
@@ -32,25 +34,27 @@ enum MediaType {
|
||||
MEDIA_TYPE_FOLDER
|
||||
};
|
||||
|
||||
struct Footage;
|
||||
class Sequence;
|
||||
using SequencePtr = std::shared_ptr<Sequence>;
|
||||
|
||||
using VoidPtr = std::shared_ptr<void>;
|
||||
|
||||
class MediaThrobber;
|
||||
struct Sequence;
|
||||
#include <QIcon>
|
||||
|
||||
class Media
|
||||
{
|
||||
public:
|
||||
Media(Media* iparent);
|
||||
~Media();
|
||||
Footage *to_footage();
|
||||
Sequence* to_sequence();
|
||||
void set_footage(Footage* f);
|
||||
void set_sequence(Sequence* s);
|
||||
FootagePtr to_footage();
|
||||
SequencePtr to_sequence();
|
||||
void set_footage(FootagePtr f);
|
||||
void set_sequence(SequencePtr s);
|
||||
void set_folder();
|
||||
void set_icon(const QIcon &ico);
|
||||
void set_parent(Media* p);
|
||||
void update_tooltip(const QString& error = 0);
|
||||
void *to_object();
|
||||
VoidPtr to_object();
|
||||
int get_type();
|
||||
const QString& get_name();
|
||||
void set_name(const QString& n);
|
||||
@@ -78,7 +82,7 @@ public:
|
||||
int temp_id2;
|
||||
private:
|
||||
int type;
|
||||
void* object;
|
||||
VoidPtr object;
|
||||
|
||||
// item functions
|
||||
QList<Media*> children;
|
||||
|
||||
@@ -99,8 +99,8 @@ QModelIndex ProjectModel::index(int row, int column, const QModelIndex &parent)
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QModelIndex ProjectModel::create_index(int arow, int acolumn, void* aid) {
|
||||
return createIndex(arow, acolumn, aid);
|
||||
QModelIndex ProjectModel::create_index(int arow, int acolumn, void* adata) {
|
||||
return createIndex(arow, acolumn, adata);
|
||||
}
|
||||
|
||||
QModelIndex ProjectModel::parent(const QModelIndex &index) const {
|
||||
|
||||
+11
-11
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
class Media;
|
||||
#include "project/media.h"
|
||||
|
||||
class ProjectModel : public QAbstractItemModel
|
||||
{
|
||||
@@ -35,29 +35,29 @@ public:
|
||||
void make_root();
|
||||
void destroy_root();
|
||||
void clear();
|
||||
Media* get_root();
|
||||
Media* get_root();
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex create_index(int arow, int acolumn, void *aid);
|
||||
QModelIndex create_index(int arow, int acolumn, void *adata);
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
Media *getItem(const QModelIndex &index) const;
|
||||
Media* getItem(const QModelIndex &index) const;
|
||||
|
||||
void appendChild(Media* parent, Media* child);
|
||||
void moveChild(Media *child, Media *to);
|
||||
void removeChild(Media *parent, Media* m);
|
||||
Media *child(int i, Media* parent = nullptr);
|
||||
int childCount(Media* parent = nullptr);
|
||||
void set_icon(Media* m, const QIcon &ico);
|
||||
void appendChild(Media* parent, Media* child);
|
||||
void moveChild(Media* child, Media* to);
|
||||
void removeChild(Media* parent, Media* m);
|
||||
Media* child(int i, Media* parent = nullptr);
|
||||
int childCount(Media* parent = nullptr);
|
||||
void set_icon(Media* m, const QIcon &ico);
|
||||
|
||||
private:
|
||||
Media* root_item;
|
||||
Media* root_item;
|
||||
};
|
||||
|
||||
#endif // PROJECTMODEL_H
|
||||
|
||||
+13
-22
@@ -20,9 +20,6 @@
|
||||
|
||||
#include "sequence.h"
|
||||
|
||||
#include "clip.h"
|
||||
#include "transition.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "debug.h"
|
||||
@@ -36,15 +33,10 @@ Sequence::Sequence() :
|
||||
{
|
||||
}
|
||||
|
||||
Sequence::~Sequence() {
|
||||
// dealloc all clips
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
delete clips.at(i);
|
||||
}
|
||||
}
|
||||
Sequence::~Sequence() {}
|
||||
|
||||
Sequence* Sequence::copy() {
|
||||
Sequence* s = new Sequence();
|
||||
SequencePtr Sequence::copy() {
|
||||
SequencePtr s(new Sequence());
|
||||
s->name = QCoreApplication::translate("Sequence", "%1 (copy)").arg(name);
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
@@ -53,11 +45,11 @@ Sequence* Sequence::copy() {
|
||||
s->audio_layout = audio_layout;
|
||||
s->clips.resize(clips.size());
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
if (c == nullptr) {
|
||||
s->clips[i] = nullptr;
|
||||
} else {
|
||||
Clip* copy = c->copy(s);
|
||||
ClipPtr copy = c->copy(s);
|
||||
copy->linked = c->linked;
|
||||
s->clips[i] = copy;
|
||||
}
|
||||
@@ -68,7 +60,7 @@ Sequence* Sequence::copy() {
|
||||
long Sequence::getEndFrame() {
|
||||
long end = 0;
|
||||
for (int j=0;j<clips.size();j++) {
|
||||
Clip* c = clips.at(j);
|
||||
ClipPtr c = clips.at(j);
|
||||
if (c != nullptr && c->timeline_out > end) {
|
||||
end = c->timeline_out;
|
||||
}
|
||||
@@ -76,15 +68,15 @@ long Sequence::getEndFrame() {
|
||||
return end;
|
||||
}
|
||||
|
||||
void Sequence::hard_delete_transition(Clip *c, int type) {
|
||||
void Sequence::hard_delete_transition(ClipPtr c, int type) {
|
||||
int transition_index = (type == TA_OPENING_TRANSITION) ? c->opening_transition : c->closing_transition;
|
||||
if (transition_index > -1) {
|
||||
bool del = true;
|
||||
|
||||
Transition* t = transitions.at(transition_index);
|
||||
TransitionPtr t = transitions.at(transition_index);
|
||||
if (t->secondary_clip != nullptr) {
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* comp = clips.at(i);
|
||||
ClipPtr comp = clips.at(i);
|
||||
if (comp != nullptr
|
||||
&& c != comp
|
||||
&& (c->opening_transition == transition_index
|
||||
@@ -100,9 +92,8 @@ void Sequence::hard_delete_transition(Clip *c, int type) {
|
||||
}
|
||||
}
|
||||
|
||||
if (del) {
|
||||
delete transitions.at(transition_index);
|
||||
transitions[transition_index] = nullptr;
|
||||
if (del) {
|
||||
transitions[transition_index].reset();
|
||||
}
|
||||
|
||||
if (type == TA_OPENING_TRANSITION) {
|
||||
@@ -117,7 +108,7 @@ void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
|
||||
int vt = 0;
|
||||
int at = 0;
|
||||
for (int j=0;j<clips.size();j++) {
|
||||
Clip* c = clips.at(j);
|
||||
ClipPtr c = clips.at(j);
|
||||
if (c != nullptr) {
|
||||
if (c->track < 0 && c->track < vt) { // video clip
|
||||
vt = c->track;
|
||||
@@ -131,4 +122,4 @@ void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
|
||||
}
|
||||
|
||||
// static variable for the currently active sequence
|
||||
Sequence* olive::ActiveSequence = nullptr;
|
||||
SequencePtr olive::ActiveSequence = nullptr;
|
||||
|
||||
+11
-10
@@ -23,21 +23,20 @@
|
||||
|
||||
#include <QVector>
|
||||
|
||||
#include "project/clip.h"
|
||||
#include "project/marker.h"
|
||||
#include "project/transition.h"
|
||||
#include "project/selection.h"
|
||||
|
||||
class Clip;
|
||||
class Transition;
|
||||
class Media;
|
||||
|
||||
struct Sequence {
|
||||
class Sequence {
|
||||
public:
|
||||
Sequence();
|
||||
~Sequence();
|
||||
Sequence* copy();
|
||||
SequencePtr copy();
|
||||
QString name;
|
||||
void getTrackLimits(int* video_tracks, int* audio_tracks);
|
||||
long getEndFrame();
|
||||
void hard_delete_transition(Clip *c, int type);
|
||||
void hard_delete_transition(ClipPtr c, int type);
|
||||
int width;
|
||||
int height;
|
||||
double frame_rate;
|
||||
@@ -56,13 +55,15 @@ struct Sequence {
|
||||
int save_id;
|
||||
|
||||
QVector<Marker> markers;
|
||||
QVector<Clip*> clips;
|
||||
QVector<Transition*> transitions;
|
||||
QVector<ClipPtr> clips;
|
||||
QVector<TransitionPtr> transitions;
|
||||
};
|
||||
|
||||
using SequencePtr = std::shared_ptr<Sequence>;
|
||||
|
||||
// static variable for the currently active sequence
|
||||
namespace olive {
|
||||
extern Sequence* ActiveSequence;
|
||||
extern SequencePtr ActiveSequence;
|
||||
}
|
||||
|
||||
#endif // SEQUENCE_H
|
||||
|
||||
@@ -62,7 +62,7 @@ void SourcesCommon::create_seq_from_selected() {
|
||||
}
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
Sequence* s = create_sequence_from_media(media_list);
|
||||
SequencePtr s = create_sequence_from_media(media_list);
|
||||
|
||||
// add clips to it
|
||||
panel_timeline->create_ghosts_from_media(s, 0, media_list);
|
||||
@@ -334,7 +334,7 @@ void SourcesCommon::dropEvent(QWidget* parent, QDropEvent *event, const QModelIn
|
||||
|
||||
void SourcesCommon::reveal_in_browser() {
|
||||
Media* media = project_parent->item_to_media(selected_items.at(0));
|
||||
Footage* m = media->to_footage();
|
||||
FootagePtr m = media->to_footage();
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
QStringList args;
|
||||
@@ -385,7 +385,7 @@ void SourcesCommon::clear_proxies_from_selected() {
|
||||
QList<QString> delete_list;
|
||||
|
||||
for (int i=0;i<cached_selected_footage.size();i++) {
|
||||
Footage* f = cached_selected_footage.at(i);
|
||||
FootagePtr f = cached_selected_footage.at(i);
|
||||
|
||||
if (f->proxy && !f->proxy_path.isEmpty()) {
|
||||
if (QFileInfo::exists(f->proxy_path)) {
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include <QTimer>
|
||||
#include <QVector>
|
||||
|
||||
#include "project/footage.h"
|
||||
|
||||
class Project;
|
||||
class QMouseEvent;
|
||||
class Media;
|
||||
@@ -63,7 +65,7 @@ private:
|
||||
QTimer rename_timer;
|
||||
|
||||
// we cache the selected footage items for open_create_proxy_dialog()
|
||||
QVector<Footage*> cached_selected_footage;
|
||||
QVector<FootagePtr> cached_selected_footage;
|
||||
};
|
||||
|
||||
#endif // SOURCESCOMMON_H
|
||||
|
||||
+12
-12
@@ -41,7 +41,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QCoreApplication>
|
||||
|
||||
Transition::Transition(Clip* c, Clip* s, const EffectMeta* em) :
|
||||
Transition::Transition(ClipPtr c, ClipPtr s, const EffectMeta* em) :
|
||||
Effect(c, em), secondary_clip(s),
|
||||
length(30)
|
||||
{
|
||||
@@ -55,7 +55,7 @@ Transition::Transition(Clip* c, Clip* s, const EffectMeta* em) :
|
||||
length_ui_ele->set_frame_rate(parent_clip->sequence == nullptr ? parent_clip->cached_fr : parent_clip->sequence->frame_rate);
|
||||
}
|
||||
|
||||
int Transition::copy(Clip *c, Clip* s) {
|
||||
int Transition::copy(ClipPtr c, ClipPtr s) {
|
||||
return create_transition(c, s, meta, length);
|
||||
}
|
||||
|
||||
@@ -80,18 +80,18 @@ void Transition::set_length_from_slider() {
|
||||
update_ui(false);
|
||||
}
|
||||
|
||||
Transition* get_transition_from_meta(Clip* c, Clip* s, const EffectMeta* em) {
|
||||
TransitionPtr get_transition_from_meta(ClipPtr c, ClipPtr s, const EffectMeta* em) {
|
||||
if (!em->filename.isEmpty()) {
|
||||
// load effect from file
|
||||
return new Transition(c, s, em);
|
||||
return TransitionPtr(new Transition(c, s, em));
|
||||
} else if (em->internal >= 0 && em->internal < TRANSITION_INTERNAL_COUNT) {
|
||||
// must be an internal effect
|
||||
switch (em->internal) {
|
||||
case TRANSITION_INTERNAL_CROSSDISSOLVE: return new CrossDissolveTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_LINEARFADE: return new LinearFadeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_EXPONENTIALFADE: return new ExponentialFadeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_LOGARITHMICFADE: return new LogarithmicFadeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_CUBE: return new CubeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_CROSSDISSOLVE: return TransitionPtr(new CrossDissolveTransition(c, s, em));
|
||||
case TRANSITION_INTERNAL_LINEARFADE: return TransitionPtr(new LinearFadeTransition(c, s, em));
|
||||
case TRANSITION_INTERNAL_EXPONENTIALFADE: return TransitionPtr(new ExponentialFadeTransition(c, s, em));
|
||||
case TRANSITION_INTERNAL_LOGARITHMICFADE: return TransitionPtr(new LogarithmicFadeTransition(c, s, em));
|
||||
case TRANSITION_INTERNAL_CUBE: return TransitionPtr(new CubeTransition(c, s, em));
|
||||
}
|
||||
} else {
|
||||
qCritical() << "Invalid transition data";
|
||||
@@ -103,11 +103,11 @@ Transition* get_transition_from_meta(Clip* c, Clip* s, const EffectMeta* em) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int create_transition(Clip* c, Clip* s, const EffectMeta* em, long length) {
|
||||
Transition* t = get_transition_from_meta(c, s, em);
|
||||
int create_transition(ClipPtr c, ClipPtr s, const EffectMeta* em, long length) {
|
||||
TransitionPtr t(get_transition_from_meta(c, s, em));
|
||||
if (t != nullptr) {
|
||||
if (length >= 0) t->set_length(length);
|
||||
QVector<Transition*>& transition_list = (c->sequence == nullptr) ? clipboard_transitions : c->sequence->transitions;
|
||||
QVector<TransitionPtr>& transition_list = (c->sequence == nullptr) ? clipboard_transitions : c->sequence->transitions;
|
||||
transition_list.append(t);
|
||||
return transition_list.size() - 1;
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@
|
||||
#define TRANSITION_INTERNAL_CUBE 4
|
||||
#define TRANSITION_INTERNAL_COUNT 5
|
||||
|
||||
int create_transition(Clip* c, Clip* s, const EffectMeta* em, long length = -1);
|
||||
int create_transition(ClipPtr c, ClipPtr s, const EffectMeta* em, long length = -1);
|
||||
|
||||
class Transition : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Transition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
int copy(Clip* c, Clip* s);
|
||||
Clip* secondary_clip;
|
||||
Transition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||
int copy(ClipPtr c, ClipPtr s);
|
||||
ClipPtr secondary_clip;
|
||||
void set_length(long l);
|
||||
long get_true_length();
|
||||
long get_length();
|
||||
@@ -52,4 +52,6 @@ private:
|
||||
EffectField* length_field;
|
||||
};
|
||||
|
||||
using TransitionPtr = std::shared_ptr<Transition>;
|
||||
|
||||
#endif // TRANSITION_H
|
||||
|
||||
+45
-104
@@ -48,41 +48,7 @@
|
||||
|
||||
QUndoStack olive::UndoStack;
|
||||
|
||||
ComboAction::ComboAction() {}
|
||||
|
||||
ComboAction::~ComboAction() {
|
||||
for (int i=0;i<commands.size();i++) {
|
||||
delete commands.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::undo() {
|
||||
for (int i=commands.size()-1;i>=0;i--) {
|
||||
commands.at(i)->undo();
|
||||
}
|
||||
for (int i=0;i<post_commands.size();i++) {
|
||||
post_commands.at(i)->undo();
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::redo() {
|
||||
for (int i=0;i<commands.size();i++) {
|
||||
commands.at(i)->redo();
|
||||
}
|
||||
for (int i=0;i<post_commands.size();i++) {
|
||||
post_commands.at(i)->redo();
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::append(QUndoCommand* u) {
|
||||
commands.append(u);
|
||||
}
|
||||
|
||||
void ComboAction::appendPost(QUndoCommand* u) {
|
||||
post_commands.append(u);
|
||||
}
|
||||
|
||||
MoveClipAction::MoveClipAction(Clip *c, long iin, long iout, long iclip_in, int itrack, bool irelative) {
|
||||
MoveClipAction::MoveClipAction(ClipPtr c, long iin, long iout, long iclip_in, int itrack, bool irelative) {
|
||||
clip = c;
|
||||
|
||||
old_in = c->timeline_in;
|
||||
@@ -126,16 +92,14 @@ void MoveClipAction::doRedo() {
|
||||
}
|
||||
}
|
||||
|
||||
DeleteClipAction::DeleteClipAction(Sequence* s, int clip) {
|
||||
DeleteClipAction::DeleteClipAction(SequencePtr s, int clip) {
|
||||
seq = s;
|
||||
index = clip;
|
||||
opening_transition = -1;
|
||||
closing_transition = -1;
|
||||
}
|
||||
|
||||
DeleteClipAction::~DeleteClipAction() {
|
||||
if (ref != nullptr) delete ref;
|
||||
}
|
||||
DeleteClipAction::~DeleteClipAction() {}
|
||||
|
||||
void DeleteClipAction::doUndo() {
|
||||
// restore ref to clip
|
||||
@@ -187,7 +151,7 @@ void DeleteClipAction::doRedo() {
|
||||
linkClipIndex.clear();
|
||||
linkLinkIndex.clear();
|
||||
for (int i=0;i<seq->clips.size();i++) {
|
||||
Clip* c = seq->clips.at(i);
|
||||
ClipPtr c = seq->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
for (int j=0;j<c->linked.size();j++) {
|
||||
if (c->linked.at(j) == index) {
|
||||
@@ -200,7 +164,7 @@ void DeleteClipAction::doRedo() {
|
||||
}
|
||||
}
|
||||
|
||||
ChangeSequenceAction::ChangeSequenceAction(Sequence* s) {
|
||||
ChangeSequenceAction::ChangeSequenceAction(SequencePtr s) {
|
||||
new_sequence = s;
|
||||
}
|
||||
|
||||
@@ -213,7 +177,7 @@ void ChangeSequenceAction::doRedo() {
|
||||
set_sequence(new_sequence);
|
||||
}
|
||||
|
||||
SetTimelineInOutCommand::SetTimelineInOutCommand(Sequence *s, bool enabled, long in, long out) {
|
||||
SetTimelineInOutCommand::SetTimelineInOutCommand(SequencePtr s, bool enabled, long in, long out) {
|
||||
seq = s;
|
||||
new_enabled = enabled;
|
||||
new_in = in;
|
||||
@@ -227,7 +191,7 @@ void SetTimelineInOutCommand::doUndo() {
|
||||
|
||||
// footage viewer functions
|
||||
if (seq->wrapper_sequence) {
|
||||
Footage* m = seq->clips.at(0)->media->to_footage();
|
||||
FootagePtr m = seq->clips.at(0)->media->to_footage();
|
||||
m->using_inout = old_enabled;
|
||||
m->in = old_in;
|
||||
m->out = old_out;
|
||||
@@ -245,14 +209,14 @@ void SetTimelineInOutCommand::doRedo() {
|
||||
|
||||
// footage viewer functions
|
||||
if (seq->wrapper_sequence) {
|
||||
Footage* m = seq->clips.at(0)->media->to_footage();
|
||||
FootagePtr m = seq->clips.at(0)->media->to_footage();
|
||||
m->using_inout = new_enabled;
|
||||
m->in = new_in;
|
||||
m->out = new_out;
|
||||
}
|
||||
}
|
||||
|
||||
AddEffectCommand::AddEffectCommand(Clip* c, Effect* e, const EffectMeta *m, int insert_pos) {
|
||||
AddEffectCommand::AddEffectCommand(ClipPtr c, EffectPtr e, const EffectMeta *m, int insert_pos) {
|
||||
clip = c;
|
||||
ref = e;
|
||||
meta = m;
|
||||
@@ -260,10 +224,6 @@ AddEffectCommand::AddEffectCommand(Clip* c, Effect* e, const EffectMeta *m, int
|
||||
done = false;
|
||||
}
|
||||
|
||||
AddEffectCommand::~AddEffectCommand() {
|
||||
if (!done && ref != nullptr) delete ref;
|
||||
}
|
||||
|
||||
void AddEffectCommand::doUndo() {
|
||||
clip->effects.last()->close();
|
||||
if (pos < 0) {
|
||||
@@ -286,9 +246,9 @@ void AddEffectCommand::doRedo() {
|
||||
done = true;
|
||||
}
|
||||
|
||||
AddTransitionCommand::AddTransitionCommand(Clip* c,
|
||||
Clip *s,
|
||||
Transition* copy,
|
||||
AddTransitionCommand::AddTransitionCommand(ClipPtr c,
|
||||
ClipPtr s,
|
||||
TransitionPtr copy,
|
||||
const EffectMeta *itransition,
|
||||
int itype,
|
||||
int ilength) {
|
||||
@@ -337,24 +297,24 @@ void AddTransitionCommand::doRedo() {
|
||||
}
|
||||
}
|
||||
|
||||
ModifyTransitionCommand::ModifyTransitionCommand(Clip* c, int itype, long ilength) {
|
||||
ModifyTransitionCommand::ModifyTransitionCommand(ClipPtr c, int itype, long ilength) {
|
||||
clip = c;
|
||||
type = itype;
|
||||
new_length = ilength;
|
||||
}
|
||||
|
||||
void ModifyTransitionCommand::doUndo() {
|
||||
Transition* t = (type == TA_OPENING_TRANSITION) ? clip->get_opening_transition() : clip->get_closing_transition();
|
||||
TransitionPtr t = (type == TA_OPENING_TRANSITION) ? clip->get_opening_transition() : clip->get_closing_transition();
|
||||
t->set_length(old_length);
|
||||
}
|
||||
|
||||
void ModifyTransitionCommand::doRedo() {
|
||||
Transition* t = (type == TA_OPENING_TRANSITION) ? clip->get_opening_transition() : clip->get_closing_transition();
|
||||
TransitionPtr t = (type == TA_OPENING_TRANSITION) ? clip->get_opening_transition() : clip->get_closing_transition();
|
||||
old_length = t->get_true_length();
|
||||
t->set_length(new_length);
|
||||
}
|
||||
|
||||
DeleteTransitionCommand::DeleteTransitionCommand(Sequence* s, int transition_index) {
|
||||
DeleteTransitionCommand::DeleteTransitionCommand(SequencePtr s, int transition_index) {
|
||||
seq = s;
|
||||
index = transition_index;
|
||||
transition = nullptr;
|
||||
@@ -362,9 +322,7 @@ DeleteTransitionCommand::DeleteTransitionCommand(Sequence* s, int transition_ind
|
||||
ctc = nullptr;
|
||||
}
|
||||
|
||||
DeleteTransitionCommand::~DeleteTransitionCommand() {
|
||||
if (transition != nullptr) delete transition;
|
||||
}
|
||||
DeleteTransitionCommand::~DeleteTransitionCommand() {}
|
||||
|
||||
void DeleteTransitionCommand::doUndo() {
|
||||
seq->transitions[index] = transition;
|
||||
@@ -377,7 +335,7 @@ void DeleteTransitionCommand::doUndo() {
|
||||
|
||||
void DeleteTransitionCommand::doRedo() {
|
||||
for (int i=0;i<seq->clips.size();i++) {
|
||||
Clip* c = seq->clips.at(i);
|
||||
ClipPtr c = seq->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
if (c->opening_transition == index) {
|
||||
otc = c;
|
||||
@@ -466,24 +424,17 @@ void DeleteMediaCommand::doRedo() {
|
||||
done = true;
|
||||
}
|
||||
|
||||
AddClipCommand::AddClipCommand(Sequence* s, QVector<Clip*>& add) {
|
||||
AddClipCommand::AddClipCommand(SequencePtr s, QVector<ClipPtr>& add) {
|
||||
seq = s;
|
||||
clips = add;
|
||||
}
|
||||
|
||||
AddClipCommand::~AddClipCommand() {
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
delete clips.at(i);
|
||||
}
|
||||
for (int i=0;i<undone_clips.size();i++) {
|
||||
delete undone_clips.at(i);
|
||||
}
|
||||
}
|
||||
AddClipCommand::~AddClipCommand() {}
|
||||
|
||||
void AddClipCommand::doUndo() {
|
||||
panel_effect_controls->clear_effects(true);
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = seq->clips.last();
|
||||
ClipPtr c = seq->clips.last();
|
||||
panel_timeline->deselect_area(c->timeline_in, c->timeline_out, c->track);
|
||||
undone_clips.prepend(c);
|
||||
if (c->open) close_clip(c, true);
|
||||
@@ -501,9 +452,9 @@ void AddClipCommand::doRedo() {
|
||||
} else {
|
||||
int linkOffset = seq->clips.size();
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* original = clips.at(i);
|
||||
ClipPtr original = clips.at(i);
|
||||
if (original != nullptr) {
|
||||
Clip* copy = original->copy(seq);
|
||||
ClipPtr copy = original->copy(seq);
|
||||
copy->linked.resize(original->linked.size());
|
||||
for (int j=0;j<original->linked.size();j++) {
|
||||
copy->linked[j] = original->linked.at(j) + linkOffset;
|
||||
@@ -524,7 +475,7 @@ LinkCommand::LinkCommand() {
|
||||
|
||||
void LinkCommand::doUndo() {
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = s->clips.at(clips.at(i));
|
||||
ClipPtr c = s->clips.at(clips.at(i));
|
||||
if (link) {
|
||||
c->linked.clear();
|
||||
} else {
|
||||
@@ -538,7 +489,7 @@ void LinkCommand::doRedo() {
|
||||
old_links.clear();
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
dout << clips.at(i);
|
||||
Clip* c = s->clips.at(clips.at(i));
|
||||
ClipPtr c = s->clips.at(clips.at(i));
|
||||
if (link) {
|
||||
for (int j=0;j<clips.size();j++) {
|
||||
if (i != j) {
|
||||
@@ -580,11 +531,11 @@ ReplaceMediaCommand::ReplaceMediaCommand(Media* i, QString s) {
|
||||
|
||||
void ReplaceMediaCommand::replace(QString& filename) {
|
||||
// close any clips currently using this media
|
||||
QVector<Media*> all_sequences = panel_project->list_all_project_sequences();
|
||||
QVector<Media*> all_sequences = panel_project->list_all_project_sequences();
|
||||
for (int i=0;i<all_sequences.size();i++) {
|
||||
Sequence* s = all_sequences.at(i)->to_sequence();
|
||||
SequencePtr s = all_sequences.at(i)->to_sequence();
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
Clip* c = s->clips.at(j);
|
||||
ClipPtr c = s->clips.at(j);
|
||||
if (c != nullptr && c->media == item && c->open) {
|
||||
close_clip(c, true);
|
||||
c->replaced = true;
|
||||
@@ -621,7 +572,7 @@ void ReplaceClipMediaCommand::replace(bool undo) {
|
||||
}
|
||||
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
if (c->open) {
|
||||
close_clip(c, true);
|
||||
}
|
||||
@@ -660,17 +611,11 @@ EffectDeleteCommand::EffectDeleteCommand() {
|
||||
done = false;
|
||||
}
|
||||
|
||||
EffectDeleteCommand::~EffectDeleteCommand() {
|
||||
if (done) {
|
||||
for (int i=0;i<deleted_objects.size();i++) {
|
||||
delete deleted_objects.at(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
EffectDeleteCommand::~EffectDeleteCommand() {}
|
||||
|
||||
void EffectDeleteCommand::doUndo() {
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
c->effects.insert(fx.at(i), deleted_objects.at(i));
|
||||
}
|
||||
panel_effect_controls->reload_clips();
|
||||
@@ -681,9 +626,9 @@ void EffectDeleteCommand::doUndo() {
|
||||
void EffectDeleteCommand::doRedo() {
|
||||
deleted_objects.clear();
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
int fx_id = fx.at(i) - i;
|
||||
Effect* e = c->effects.at(fx_id);
|
||||
EffectPtr e = c->effects.at(fx_id);
|
||||
e->close();
|
||||
deleted_objects.append(e);
|
||||
c->effects.removeAt(fx_id);
|
||||
@@ -705,7 +650,7 @@ void MediaMove::doRedo() {
|
||||
if (to == nullptr) to = project_model.get_root();
|
||||
froms.resize(items.size());
|
||||
for (int i=0;i<items.size();i++) {
|
||||
Media* parent = items.at(i)->parentItem();
|
||||
Media* parent = items.at(i)->parentItem();
|
||||
froms[i] = parent;
|
||||
project_model.moveChild(items.at(i), to);
|
||||
}
|
||||
@@ -855,7 +800,7 @@ void DeleteMarkerAction::doRedo() {
|
||||
sorted = true;
|
||||
}
|
||||
|
||||
SetSpeedAction::SetSpeedAction(Clip* c, double speed) {
|
||||
SetSpeedAction::SetSpeedAction(ClipPtr c, double speed) {
|
||||
clip = c;
|
||||
old_speed = c->speed;
|
||||
new_speed = speed;
|
||||
@@ -886,7 +831,7 @@ void SetBool::doRedo() {
|
||||
*boolean = new_setting;
|
||||
}
|
||||
|
||||
SetSelectionsCommand::SetSelectionsCommand(Sequence* s) {
|
||||
SetSelectionsCommand::SetSelectionsCommand(SequencePtr s) {
|
||||
seq = s;
|
||||
done = true;
|
||||
}
|
||||
@@ -903,7 +848,7 @@ void SetSelectionsCommand::doRedo() {
|
||||
}
|
||||
}
|
||||
|
||||
EditSequenceCommand::EditSequenceCommand(Media* i, Sequence *s) {
|
||||
EditSequenceCommand::EditSequenceCommand(Media* i, SequencePtr s) {
|
||||
item = i;
|
||||
seq = s;
|
||||
old_name = s->name;
|
||||
@@ -1013,11 +958,7 @@ RemoveClipsFromClipboard::RemoveClipsFromClipboard(int index) {
|
||||
done = false;
|
||||
}
|
||||
|
||||
RemoveClipsFromClipboard::~RemoveClipsFromClipboard() {
|
||||
if (done) {
|
||||
delete clip;
|
||||
}
|
||||
}
|
||||
RemoveClipsFromClipboard::~RemoveClipsFromClipboard() {}
|
||||
|
||||
void RemoveClipsFromClipboard::doUndo() {
|
||||
clipboard.insert(pos, clip);
|
||||
@@ -1025,7 +966,7 @@ void RemoveClipsFromClipboard::doUndo() {
|
||||
}
|
||||
|
||||
void RemoveClipsFromClipboard::doRedo() {
|
||||
clip = static_cast<Clip*>(clipboard.at(pos));
|
||||
clip = std::static_pointer_cast<Clip>(clipboard.at(pos));
|
||||
clipboard.removeAt(pos);
|
||||
done = true;
|
||||
}
|
||||
@@ -1068,7 +1009,7 @@ void ReloadEffectsCommand::doRedo() {
|
||||
panel_effect_controls->reload_clips();
|
||||
}
|
||||
|
||||
RippleAction::RippleAction(Sequence *is, long ipoint, long ilength, const QVector<int> &iignore) {
|
||||
RippleAction::RippleAction(SequencePtr is, long ipoint, long ilength, const QVector<int> &iignore) {
|
||||
s = is;
|
||||
point = ipoint;
|
||||
length = ilength;
|
||||
@@ -1084,7 +1025,7 @@ void RippleAction::doRedo() {
|
||||
ca = new ComboAction();
|
||||
for (int i=0;i<s->clips.size();i++) {
|
||||
if (!ignore.contains(i)) {
|
||||
Clip* c = s->clips.at(i);
|
||||
ClipPtr c = s->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
if (c->timeline_in >= point) {
|
||||
move_clip(ca, c, length, length, 0, 0, true, true);
|
||||
@@ -1182,11 +1123,11 @@ void RefreshClips::doUndo() {
|
||||
|
||||
void RefreshClips::doRedo() {
|
||||
// close any clips currently using this media
|
||||
QVector<Media*> all_sequences = panel_project->list_all_project_sequences();
|
||||
QVector<Media*> all_sequences = panel_project->list_all_project_sequences();
|
||||
for (int i=0;i<all_sequences.size();i++) {
|
||||
Sequence* s = all_sequences.at(i)->to_sequence();
|
||||
SequencePtr s = all_sequences.at(i)->to_sequence();
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
Clip* c = s->clips.at(j);
|
||||
ClipPtr c = s->clips.at(j);
|
||||
if (c != nullptr && c->media == media) {
|
||||
c->replaced = true;
|
||||
c->refresh();
|
||||
@@ -1203,7 +1144,7 @@ void UpdateViewer::doRedo() {
|
||||
panel_sequence_viewer->viewer_widget->frame_update();
|
||||
}
|
||||
|
||||
SetEffectData::SetEffectData(Effect *e, const QByteArray &s) {
|
||||
SetEffectData::SetEffectData(EffectPtr e, const QByteArray &s) {
|
||||
effect = e;
|
||||
data = s;
|
||||
}
|
||||
|
||||
+70
-94
@@ -21,24 +21,14 @@
|
||||
#ifndef UNDO_H
|
||||
#define UNDO_H
|
||||
|
||||
class Media;
|
||||
class QCheckBox;
|
||||
class LabelSlider;
|
||||
class Effect;
|
||||
class SourceTable;
|
||||
class EffectRow;
|
||||
class EffectField;
|
||||
class Transition;
|
||||
class EffectGizmo;
|
||||
class Clip;
|
||||
struct Sequence;
|
||||
struct Footage;
|
||||
struct EffectMeta;
|
||||
|
||||
#include "project/marker.h"
|
||||
#include "project/projectelements.h"
|
||||
#include "project/selection.h"
|
||||
#include "project/effectfield.h"
|
||||
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/sourcetable.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QUndoStack>
|
||||
#include <QUndoCommand>
|
||||
#include <QVector>
|
||||
@@ -49,19 +39,6 @@ namespace olive {
|
||||
extern QUndoStack UndoStack;
|
||||
}
|
||||
|
||||
class ComboAction : public QUndoCommand {
|
||||
public:
|
||||
ComboAction();
|
||||
virtual ~ComboAction() override;
|
||||
virtual void undo() override;
|
||||
virtual void redo() override;
|
||||
void append(QUndoCommand* u);
|
||||
void appendPost(QUndoCommand* u);
|
||||
private:
|
||||
QVector<QUndoCommand*> commands;
|
||||
QVector<QUndoCommand*> post_commands;
|
||||
};
|
||||
|
||||
class OliveAction : public QUndoCommand {
|
||||
public:
|
||||
OliveAction(bool iset_window_modified = true);
|
||||
@@ -86,11 +63,11 @@ private:
|
||||
|
||||
class MoveClipAction : public OliveAction {
|
||||
public:
|
||||
MoveClipAction(Clip* c, long iin, long iout, long iclip_in, int itrack, bool irelative);
|
||||
MoveClipAction(ClipPtr c, long iin, long iout, long iclip_in, int itrack, bool irelative);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Clip* clip;
|
||||
ClipPtr clip;
|
||||
|
||||
long old_in;
|
||||
long old_out;
|
||||
@@ -107,11 +84,11 @@ private:
|
||||
|
||||
class RippleAction : public OliveAction {
|
||||
public:
|
||||
RippleAction(Sequence *is, long ipoint, long ilength, const QVector<int>& iignore);
|
||||
RippleAction(SequencePtr is, long ipoint, long ilength, const QVector<int>& iignore);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Sequence *s;
|
||||
SequencePtr s;
|
||||
long point;
|
||||
long length;
|
||||
QVector<int> ignore;
|
||||
@@ -120,13 +97,13 @@ private:
|
||||
|
||||
class DeleteClipAction : public OliveAction {
|
||||
public:
|
||||
DeleteClipAction(Sequence* s, int clip);
|
||||
DeleteClipAction(SequencePtr s, int clip);
|
||||
virtual ~DeleteClipAction() override;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Sequence* seq;
|
||||
Clip* ref;
|
||||
SequencePtr seq;
|
||||
ClipPtr ref;
|
||||
int index;
|
||||
|
||||
int opening_transition;
|
||||
@@ -138,37 +115,36 @@ private:
|
||||
|
||||
class ChangeSequenceAction : public OliveAction {
|
||||
public:
|
||||
ChangeSequenceAction(Sequence* s);
|
||||
ChangeSequenceAction(SequencePtr s);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Sequence* old_sequence;
|
||||
Sequence* new_sequence;
|
||||
SequencePtr old_sequence;
|
||||
SequencePtr new_sequence;
|
||||
};
|
||||
|
||||
class AddEffectCommand : public OliveAction {
|
||||
public:
|
||||
AddEffectCommand(Clip* c, Effect *e, const EffectMeta* m, int insert_pos = -1);
|
||||
virtual ~AddEffectCommand() override;
|
||||
AddEffectCommand(ClipPtr c, EffectPtr e, const EffectMeta* m, int insert_pos = -1);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Clip* clip;
|
||||
ClipPtr clip;
|
||||
const EffectMeta* meta;
|
||||
Effect* ref;
|
||||
EffectPtr ref;
|
||||
int pos;
|
||||
bool done;
|
||||
};
|
||||
|
||||
class AddTransitionCommand : public OliveAction {
|
||||
public:
|
||||
AddTransitionCommand(Clip* c, Clip* s, Transition *copy, const EffectMeta* itransition, int itype, int ilength);
|
||||
AddTransitionCommand(ClipPtr c, ClipPtr s, TransitionPtr copy, const EffectMeta* itransition, int itype, int ilength);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Clip* clip;
|
||||
Clip* secondary;
|
||||
Transition* transition_to_copy;
|
||||
ClipPtr clip;
|
||||
ClipPtr secondary;
|
||||
TransitionPtr transition_to_copy;
|
||||
const EffectMeta* transition;
|
||||
int type;
|
||||
int length;
|
||||
@@ -178,11 +154,11 @@ private:
|
||||
|
||||
class ModifyTransitionCommand : public OliveAction {
|
||||
public:
|
||||
ModifyTransitionCommand(Clip* c, int itype, long ilength);
|
||||
ModifyTransitionCommand(ClipPtr c, int itype, long ilength);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Clip* clip;
|
||||
ClipPtr clip;
|
||||
int type;
|
||||
long new_length;
|
||||
long old_length;
|
||||
@@ -190,25 +166,25 @@ private:
|
||||
|
||||
class DeleteTransitionCommand : public OliveAction {
|
||||
public:
|
||||
DeleteTransitionCommand(Sequence* s, int transition_index);
|
||||
DeleteTransitionCommand(SequencePtr s, int transition_index);
|
||||
virtual ~DeleteTransitionCommand() override;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Sequence* seq;
|
||||
SequencePtr seq;
|
||||
int index;
|
||||
Transition* transition;
|
||||
Clip* otc;
|
||||
Clip* ctc;
|
||||
TransitionPtr transition;
|
||||
ClipPtr otc;
|
||||
ClipPtr ctc;
|
||||
};
|
||||
|
||||
class SetTimelineInOutCommand : public OliveAction {
|
||||
public:
|
||||
SetTimelineInOutCommand(Sequence* s, bool enabled, long in, long out);
|
||||
SetTimelineInOutCommand(SequencePtr s, bool enabled, long in, long out);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Sequence* seq;
|
||||
SequencePtr seq;
|
||||
|
||||
bool old_enabled;
|
||||
long old_in;
|
||||
@@ -221,25 +197,25 @@ private:
|
||||
|
||||
class NewSequenceCommand : public OliveAction {
|
||||
public:
|
||||
NewSequenceCommand(Media *s, Media* iparent);
|
||||
NewSequenceCommand(Media* s, Media* iparent);
|
||||
virtual ~NewSequenceCommand() override;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Media* seq;
|
||||
Media* parent;
|
||||
Media* seq;
|
||||
Media* parent;
|
||||
bool done;
|
||||
};
|
||||
|
||||
class AddMediaCommand : public OliveAction {
|
||||
public:
|
||||
AddMediaCommand(Media* iitem, Media* iparent);
|
||||
AddMediaCommand(Media* iitem, Media* iparent);
|
||||
virtual ~AddMediaCommand() override;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Media* item;
|
||||
Media* parent;
|
||||
Media* item;
|
||||
Media* parent;
|
||||
bool done;
|
||||
};
|
||||
|
||||
@@ -250,21 +226,21 @@ public:
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Media* item;
|
||||
Media* item;
|
||||
Media* parent;
|
||||
bool done;
|
||||
};
|
||||
|
||||
class AddClipCommand : public OliveAction {
|
||||
public:
|
||||
AddClipCommand(Sequence* s, QVector<Clip*>& add);
|
||||
AddClipCommand(SequencePtr s, QVector<ClipPtr>& add);
|
||||
virtual ~AddClipCommand() override;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Sequence* seq;
|
||||
QVector<Clip*> clips;
|
||||
QVector<Clip*> undone_clips;
|
||||
SequencePtr seq;
|
||||
QVector<ClipPtr> clips;
|
||||
QVector<ClipPtr> undone_clips;
|
||||
};
|
||||
|
||||
class LinkCommand : public OliveAction {
|
||||
@@ -272,7 +248,7 @@ public:
|
||||
LinkCommand();
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
Sequence* s;
|
||||
SequencePtr s;
|
||||
QVector<int> clips;
|
||||
bool link;
|
||||
private:
|
||||
@@ -293,7 +269,7 @@ private:
|
||||
|
||||
class ReplaceMediaCommand : public OliveAction {
|
||||
public:
|
||||
ReplaceMediaCommand(Media*, QString);
|
||||
ReplaceMediaCommand(Media*, QString);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
@@ -308,10 +284,10 @@ public:
|
||||
ReplaceClipMediaCommand(Media *, Media *, bool);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
QVector<Clip*> clips;
|
||||
QVector<ClipPtr> clips;
|
||||
private:
|
||||
Media* old_media;
|
||||
Media* new_media;
|
||||
Media* old_media;
|
||||
Media* new_media;
|
||||
bool preserve_clip_ins;
|
||||
QVector<int> old_clip_ins;
|
||||
void replace(bool undo);
|
||||
@@ -323,18 +299,18 @@ public:
|
||||
virtual ~EffectDeleteCommand() override;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
QVector<Clip*> clips;
|
||||
QVector<ClipPtr> clips;
|
||||
QVector<int> fx;
|
||||
private:
|
||||
bool done;
|
||||
QVector<Effect*> deleted_objects;
|
||||
QVector<EffectPtr> deleted_objects;
|
||||
};
|
||||
|
||||
class MediaMove : public OliveAction {
|
||||
public:
|
||||
MediaMove();
|
||||
QVector<Media*> items;
|
||||
Media* to;
|
||||
QVector<Media*> items;
|
||||
Media* to;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
@@ -343,11 +319,11 @@ private:
|
||||
|
||||
class MediaRename : public OliveAction {
|
||||
public:
|
||||
MediaRename(Media* iitem, QString to);
|
||||
MediaRename(Media* iitem, QString to);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Media* item;
|
||||
Media* item;
|
||||
QString from;
|
||||
QString to;
|
||||
};
|
||||
@@ -395,7 +371,7 @@ public:
|
||||
SetAutoscaleAction();
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
QVector<Clip*> clips;
|
||||
QVector<ClipPtr> clips;
|
||||
};
|
||||
|
||||
class AddMarkerAction : public OliveAction {
|
||||
@@ -436,11 +412,11 @@ private:
|
||||
|
||||
class SetSpeedAction : public OliveAction {
|
||||
public:
|
||||
SetSpeedAction(Clip* c, double speed);
|
||||
SetSpeedAction(ClipPtr c, double speed);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Clip* clip;
|
||||
ClipPtr clip;
|
||||
double old_speed;
|
||||
double new_speed;
|
||||
};
|
||||
@@ -458,19 +434,19 @@ private:
|
||||
|
||||
class SetSelectionsCommand : public OliveAction {
|
||||
public:
|
||||
SetSelectionsCommand(Sequence *s);
|
||||
SetSelectionsCommand(SequencePtr s);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
QVector<Selection> old_data;
|
||||
QVector<Selection> new_data;
|
||||
private:
|
||||
Sequence* seq;
|
||||
SequencePtr seq;
|
||||
bool done;
|
||||
};
|
||||
|
||||
class EditSequenceCommand : public OliveAction {
|
||||
public:
|
||||
EditSequenceCommand(Media *i, Sequence* s);
|
||||
EditSequenceCommand(Media *i, SequencePtr s);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
void update();
|
||||
@@ -482,8 +458,8 @@ public:
|
||||
int audio_frequency;
|
||||
int audio_layout;
|
||||
private:
|
||||
Media* item;
|
||||
Sequence* seq;
|
||||
Media* item;
|
||||
SequencePtr seq;
|
||||
|
||||
QString old_name;
|
||||
int old_width;
|
||||
@@ -545,11 +521,11 @@ public:
|
||||
|
||||
class UpdateFootageTooltip : public OliveAction {
|
||||
public:
|
||||
UpdateFootageTooltip(Media* i);
|
||||
UpdateFootageTooltip(Media* i);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Media* item;
|
||||
Media* item;
|
||||
};
|
||||
|
||||
class MoveEffectCommand : public OliveAction {
|
||||
@@ -557,7 +533,7 @@ public:
|
||||
MoveEffectCommand();
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
Clip* clip;
|
||||
ClipPtr clip;
|
||||
int from;
|
||||
int to;
|
||||
};
|
||||
@@ -570,14 +546,14 @@ public:
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
int pos;
|
||||
Clip* clip;
|
||||
ClipPtr clip;
|
||||
bool done;
|
||||
};
|
||||
|
||||
class RenameClipCommand : public OliveAction {
|
||||
public:
|
||||
RenameClipCommand();
|
||||
QVector<Clip*> clips;
|
||||
QVector<ClipPtr> clips;
|
||||
QString new_name;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
@@ -626,11 +602,11 @@ private:
|
||||
|
||||
class RefreshClips : public OliveAction {
|
||||
public:
|
||||
RefreshClips(Media* m);
|
||||
RefreshClips(Media* m);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Media* media;
|
||||
Media* media;
|
||||
};
|
||||
|
||||
class UpdateViewer : public OliveAction {
|
||||
@@ -641,11 +617,11 @@ public:
|
||||
|
||||
class SetEffectData : public OliveAction {
|
||||
public:
|
||||
SetEffectData(Effect* e, const QByteArray &s);
|
||||
SetEffectData(EffectPtr e, const QByteArray &s);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Effect* effect;
|
||||
EffectPtr effect;
|
||||
QByteArray data;
|
||||
QByteArray old_data;
|
||||
};
|
||||
|
||||
+4
-4
@@ -106,15 +106,15 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
||||
visible_out = 0;
|
||||
|
||||
for (int j=0;j<panel_effect_controls->selected_clips.size();j++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(panel_effect_controls->selected_clips.at(j));
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(panel_effect_controls->selected_clips.at(j));
|
||||
visible_in = qMin(visible_in, c->timeline_in);
|
||||
visible_out = qMax(visible_out, c->timeline_out);
|
||||
}
|
||||
|
||||
for (int j=0;j<panel_effect_controls->selected_clips.size();j++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(panel_effect_controls->selected_clips.at(j));
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(panel_effect_controls->selected_clips.at(j));
|
||||
for (int i=0;i<c->effects.size();i++) {
|
||||
Effect* e = c->effects.at(i);
|
||||
EffectPtr e = c->effects.at(i);
|
||||
if (e->container->is_expanded()) {
|
||||
for (int j=0;j<e->row_count();j++) {
|
||||
EffectRow* row = e->row(j);
|
||||
@@ -373,7 +373,7 @@ void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
|
||||
if (panel_timeline->snapping) {
|
||||
for (int i=0;i<selected_keyframes.size();i++) {
|
||||
EffectField* field = selected_fields.at(i);
|
||||
Clip* c = field->parent_row->parent_effect->parent_clip;
|
||||
ClipPtr c = field->parent_row->parent_effect->parent_clip;
|
||||
long key_time = old_key_vals.at(i) + frame_diff - c->clip_in + c->timeline_in;
|
||||
long key_eval = key_time;
|
||||
if (panel_timeline->snap_to_point(olive::ActiveSequence->playhead, &key_eval)) {
|
||||
|
||||
+12
-12
@@ -100,8 +100,8 @@ GLuint draw_clip(QOpenGLFramebufferObject* fbo, GLuint texture, bool clear) {
|
||||
return fbo->texture();
|
||||
}
|
||||
|
||||
void process_effect(Clip* c,
|
||||
Effect* e,
|
||||
void process_effect(ClipPtr c,
|
||||
EffectPtr e,
|
||||
double timecode,
|
||||
GLTextureCoords& coords,
|
||||
GLuint& composite_texture,
|
||||
@@ -151,7 +151,7 @@ void process_effect(Clip* c,
|
||||
GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
GLuint final_fbo = params.main_buffer;
|
||||
|
||||
Sequence* s = params.seq;
|
||||
SequencePtr s = params.seq;
|
||||
long playhead = s->playhead;
|
||||
|
||||
if (!params.nests.isEmpty()) {
|
||||
@@ -170,12 +170,12 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
|
||||
int audio_track_count = 0;
|
||||
|
||||
QVector<Clip*> current_clips;
|
||||
QVector<ClipPtr> current_clips;
|
||||
|
||||
// loop through clips, find currently active, and sort by track
|
||||
for (int i=0;i<s->clips.size();i++) {
|
||||
|
||||
Clip* c = s->clips.at(i);
|
||||
ClipPtr c = s->clips.at(i);
|
||||
|
||||
if (c != nullptr) {
|
||||
|
||||
@@ -186,7 +186,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
|
||||
// is the clip a "footage" clip?
|
||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* m = c->media->to_footage();
|
||||
FootagePtr m = c->media->to_footage();
|
||||
|
||||
// does the clip have a valid media source?
|
||||
if (!m->invalid && !(c->track >= 0 && !is_audio_device_set())) {
|
||||
@@ -273,7 +273,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
|
||||
// loop through current clips
|
||||
for (int i=0;i<current_clips.size();i++) {
|
||||
Clip* c = current_clips.at(i);
|
||||
ClipPtr c = current_clips.at(i);
|
||||
|
||||
// check if this clip was successfully opened by earlier function
|
||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE && !c->finished_opening) {
|
||||
@@ -395,12 +395,12 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
double timecode = get_timecode(c, playhead);
|
||||
|
||||
// set up variables for gizmos later
|
||||
Effect* first_gizmo_effect = nullptr;
|
||||
Effect* selected_effect = nullptr;
|
||||
EffectPtr first_gizmo_effect = nullptr;
|
||||
EffectPtr selected_effect = nullptr;
|
||||
|
||||
// run through all of the clip's effects
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
Effect* e = c->effects.at(j);
|
||||
EffectPtr e = c->effects.at(j);
|
||||
process_effect(c, e, timecode, coords, textureID, fbo_switcher, params.texture_failed, TA_NO_TRANSITION);
|
||||
|
||||
// retrieve gizmo data from effect
|
||||
@@ -601,7 +601,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
if (c->sequence == params.seq) { // only if you can currently see them
|
||||
double ts = (playhead - c->get_timeline_in_with_transition() + c->get_clip_in_with_transition())/s->frame_rate;
|
||||
for (int i=0;i<c->effects.size();i++) {
|
||||
Effect* e = c->effects.at(i);
|
||||
EffectPtr e = c->effects.at(i);
|
||||
for (int j=0;j<e->row_count();j++) {
|
||||
EffectRow* r = e->row(j);
|
||||
for (int k=0;k<r->fieldCount();k++) {
|
||||
@@ -630,7 +630,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void compose_audio(Viewer* viewer, Sequence* seq, int playback_speed) {
|
||||
void compose_audio(Viewer* viewer, SequencePtr seq, int playback_speed) {
|
||||
ComposeSequenceParams params;
|
||||
params.viewer = viewer;
|
||||
params.ctx = nullptr;
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
|
||||
#include <QOpenGLContext>
|
||||
#include <QVector>
|
||||
#include <QOpenGLShaderProgram>
|
||||
|
||||
class Effect;
|
||||
class Viewer;
|
||||
class QOpenGLShaderProgram;
|
||||
struct Sequence;
|
||||
class Clip;
|
||||
#include "project/sequence.h"
|
||||
#include "project/effect.h"
|
||||
|
||||
#include "panels/viewer.h"
|
||||
|
||||
/**
|
||||
* @brief The ComposeSequenceParams struct
|
||||
@@ -59,7 +59,7 @@ struct ComposeSequenceParams {
|
||||
* In addition to clips, sequences also contain the playhead position so compose_sequence() knows which frame
|
||||
* to render.
|
||||
*/
|
||||
Sequence* seq;
|
||||
SequencePtr seq;
|
||||
|
||||
/**
|
||||
* @brief Array to store the nested sequence hierarchy
|
||||
@@ -67,7 +67,7 @@ struct ComposeSequenceParams {
|
||||
* Should be left empty. This array gets passed around compose_sequence() as it calls itself recursively to
|
||||
* handle nested sequences.
|
||||
*/
|
||||
QVector<Clip*> nests;
|
||||
QVector<ClipPtr> nests;
|
||||
|
||||
/**
|
||||
* @brief Set compose mode to video or audio
|
||||
@@ -82,7 +82,7 @@ struct ComposeSequenceParams {
|
||||
* A pointer to a pointer that will be set to the Effect whose gizmos are being rendered and should therefore
|
||||
* be interacted with if the user uses them.
|
||||
*/
|
||||
Effect** gizmos;
|
||||
EffectPtr* gizmos;
|
||||
|
||||
/**
|
||||
* @brief A variable that compose_sequence() will set to **TRUE** if any of the clips couldn't be shown.
|
||||
@@ -260,6 +260,6 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms);
|
||||
*
|
||||
* The current playback speed (controlled by Shuttle Left/Right)
|
||||
*/
|
||||
void compose_audio(Viewer* viewer, Sequence* seq, int playback_speed);
|
||||
void compose_audio(Viewer* viewer, SequencePtr seq, int playback_speed);
|
||||
|
||||
#endif // RENDERFUNCTIONS_H
|
||||
|
||||
+1
-1
@@ -235,7 +235,7 @@ void RenderThread::paint() {
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void RenderThread::start_render(QOpenGLContext *share, Sequence *s, const QString& save, GLvoid* pixels, int pixel_linesize, int idivider) {
|
||||
void RenderThread::start_render(QOpenGLContext *share, SequencePtr s, const QString& save, GLvoid* pixels, int pixel_linesize, int idivider) {
|
||||
Q_UNUSED(idivider);
|
||||
|
||||
seq = s;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user