Revert "derive clips, tracks, and sequences from the same base"
This reverts commit 1b9a963eeb.
This commit is contained in:
+41
-76
@@ -297,7 +297,7 @@ void Clip::Save(QXmlStreamWriter &stream)
|
||||
if (this == transition->secondary_clip) {
|
||||
// if so, just save a reference to the other clip
|
||||
stream.writeAttribute("shared",
|
||||
QString::number(transition->GetParentClip()->load_id));
|
||||
QString::number(transition->parent_clip->load_id));
|
||||
} else {
|
||||
// otherwise save the whole transition
|
||||
transition->save(stream);
|
||||
@@ -426,89 +426,16 @@ long Clip::length() {
|
||||
return timeline_out_ - timeline_in_;
|
||||
}
|
||||
|
||||
int Clip::MediaWidth() {
|
||||
if (media_ != nullptr) {
|
||||
switch (media_->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
const FootageStream* ms = media_stream();
|
||||
if (ms != nullptr) return ms->video_width;
|
||||
break;
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media_->to_sequence().get();
|
||||
return s->width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (track() != nullptr) {
|
||||
return SequenceWidth();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Clip::MediaHeight() {
|
||||
if (media_ != nullptr) {
|
||||
switch (media_->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
const FootageStream* ms = media_stream();
|
||||
if (ms != nullptr) return ms->video_height;
|
||||
}
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media_->to_sequence().get();
|
||||
return s->height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (track() != nullptr) {
|
||||
return SequenceHeight();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
double Clip::MediaFrameRate() {
|
||||
double Clip::media_frame_rate() {
|
||||
Q_ASSERT(type() == olive::kTypeVideo);
|
||||
|
||||
if (media_ != nullptr) {
|
||||
double rate = media_->get_frame_rate(media_stream_index());
|
||||
if (!qIsNaN(rate)) return rate;
|
||||
}
|
||||
|
||||
if (track() != nullptr) {
|
||||
return SequenceFrameRate();
|
||||
}
|
||||
|
||||
if (track() != nullptr) return track()->sequence()->frame_rate;
|
||||
return qSNaN();
|
||||
}
|
||||
|
||||
int Clip::SequenceWidth()
|
||||
{
|
||||
return track()->sequence()->width;
|
||||
}
|
||||
|
||||
int Clip::SequenceHeight()
|
||||
{
|
||||
return track()->sequence()->height;
|
||||
}
|
||||
|
||||
double Clip::SequenceFrameRate()
|
||||
{
|
||||
return track()->sequence()->frame_rate;
|
||||
}
|
||||
|
||||
long Clip::SequencePlayhead()
|
||||
{
|
||||
return track()->sequence()->playhead;
|
||||
}
|
||||
|
||||
long Clip::media_length() {
|
||||
if (this->track() != nullptr) {
|
||||
double fr = this->track()->sequence()->frame_rate;
|
||||
@@ -540,6 +467,44 @@ long Clip::media_length() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Clip::media_width() {
|
||||
if (media_ == nullptr && track() != nullptr) return track()->sequence()->width;
|
||||
switch (media_->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
const FootageStream* ms = media_stream();
|
||||
if (ms != nullptr) return ms->video_width;
|
||||
if (track() != nullptr) return track()->sequence()->width;
|
||||
break;
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media_->to_sequence().get();
|
||||
return s->width;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Clip::media_height() {
|
||||
if (media_ == nullptr && track() != nullptr) return track()->sequence()->height;
|
||||
switch (media_->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
const FootageStream* ms = media_stream();
|
||||
if (ms != nullptr) return ms->video_height;
|
||||
if (track() != nullptr) return track()->sequence()->height;
|
||||
}
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media_->to_sequence().get();
|
||||
return s->height;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points) {
|
||||
if (change_timeline_points) {
|
||||
track()->sequence()->MoveClip(this,
|
||||
|
||||
+7
-17
@@ -39,7 +39,6 @@
|
||||
#include "marker.h"
|
||||
#include "nodes/nodegraph.h"
|
||||
#include "selection.h"
|
||||
#include "timelineobject.h"
|
||||
|
||||
class Track;
|
||||
|
||||
@@ -49,13 +48,10 @@ struct ClipSpeed {
|
||||
bool maintain_audio_pitch;
|
||||
};
|
||||
|
||||
class Clip;
|
||||
using ClipPtr = std::shared_ptr<Clip>;
|
||||
|
||||
class Clip : public TimelineObject {
|
||||
class Clip {
|
||||
public:
|
||||
Clip(Track *s);
|
||||
virtual ~Clip() override;
|
||||
~Clip();
|
||||
ClipPtr copy(Track *s);
|
||||
|
||||
void Save(QXmlStreamWriter& stream);
|
||||
@@ -75,17 +71,9 @@ public:
|
||||
Media* media();
|
||||
FootageStream* media_stream();
|
||||
int media_stream_index();
|
||||
|
||||
virtual int MediaWidth() override;
|
||||
virtual int MediaHeight() override;
|
||||
virtual double MediaFrameRate() override;
|
||||
|
||||
virtual int SequenceWidth() override;
|
||||
virtual int SequenceHeight() override;
|
||||
virtual double SequenceFrameRate() override;
|
||||
|
||||
virtual long SequencePlayhead() override;
|
||||
|
||||
int media_width();
|
||||
int media_height();
|
||||
double media_frame_rate();
|
||||
long media_length();
|
||||
void set_media(Media* m, int s);
|
||||
|
||||
@@ -193,6 +181,8 @@ private:
|
||||
Cacher cacher;
|
||||
long cacher_frame;
|
||||
|
||||
NodeGraph pipeline_;
|
||||
|
||||
QVector<Marker> markers;
|
||||
QColor color_;
|
||||
bool open_;
|
||||
|
||||
+1
-21
@@ -100,26 +100,6 @@ void Sequence::Save(QXmlStreamWriter &stream)
|
||||
stream.writeEndElement();
|
||||
}
|
||||
|
||||
int Sequence::SequenceWidth()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
int Sequence::SequenceHeight()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
double Sequence::SequenceFrameRate()
|
||||
{
|
||||
return frame_rate;
|
||||
}
|
||||
|
||||
long Sequence::SequencePlayhead()
|
||||
{
|
||||
return playhead;
|
||||
}
|
||||
|
||||
long Sequence::GetEndFrame() {
|
||||
long end_frame = 0;
|
||||
|
||||
@@ -291,7 +271,7 @@ void Sequence::MoveClip(Clip *c, ComboAction *ca, long iin, long iout, long icli
|
||||
|
||||
if (c->closing_transition != nullptr
|
||||
&& c->closing_transition->secondary_clip != nullptr
|
||||
&& c->closing_transition->GetParentClip()->timeline_in() != iout) {
|
||||
&& c->closing_transition->parent_clip->timeline_in() != iout) {
|
||||
// separate transition
|
||||
ca->append(new SetPointer(reinterpret_cast<void**>(&c->closing_transition->secondary_clip), nullptr));
|
||||
ca->append(new AddTransitionCommand(nullptr,
|
||||
|
||||
+1
-8
@@ -29,9 +29,8 @@
|
||||
#include "selection.h"
|
||||
#include "tracklist.h"
|
||||
#include "ghost.h"
|
||||
#include "timelineobject.h"
|
||||
|
||||
class Sequence : public TimelineObject {
|
||||
class Sequence : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Sequence();
|
||||
@@ -46,12 +45,6 @@ public:
|
||||
int audio_frequency;
|
||||
int audio_layout;
|
||||
|
||||
virtual int SequenceWidth() override;
|
||||
virtual int SequenceHeight() override;
|
||||
virtual double SequenceFrameRate() override;
|
||||
|
||||
virtual long SequencePlayhead() override;
|
||||
|
||||
long GetEndFrame();
|
||||
QVector<Clip*> GetAllClips();
|
||||
TrackList* GetTrackList(olive::TrackType type);
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#include "timelineobject.h"
|
||||
|
||||
TimelineObject::TimelineObject()
|
||||
{
|
||||
}
|
||||
|
||||
TimelineObject::~TimelineObject()
|
||||
{
|
||||
}
|
||||
|
||||
int TimelineObject::MediaWidth()
|
||||
{
|
||||
return SequenceWidth();
|
||||
}
|
||||
|
||||
int TimelineObject::MediaHeight()
|
||||
{
|
||||
return SequenceHeight();
|
||||
}
|
||||
|
||||
double TimelineObject::MediaFrameRate()
|
||||
{
|
||||
return SequenceFrameRate();
|
||||
}
|
||||
|
||||
NodeGraph *TimelineObject::pipeline()
|
||||
{
|
||||
return &pipeline_;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef TIMELINEOBJECT_H
|
||||
#define TIMELINEOBJECT_H
|
||||
|
||||
#include "nodes/nodegraph.h"
|
||||
|
||||
/**
|
||||
* @brief The TimelineObject class
|
||||
*
|
||||
* A base class for Clip, Sequence, and Track to allow compatibility between each of them and any effects nodes.
|
||||
*/
|
||||
class TimelineObject : public QObject
|
||||
{
|
||||
public:
|
||||
TimelineObject();
|
||||
virtual ~TimelineObject();
|
||||
|
||||
virtual int MediaWidth();
|
||||
virtual int MediaHeight();
|
||||
virtual double MediaFrameRate();
|
||||
|
||||
virtual int SequenceWidth() = 0;
|
||||
virtual int SequenceHeight() = 0;
|
||||
virtual double SequenceFrameRate() = 0;
|
||||
|
||||
virtual long SequencePlayhead() = 0;
|
||||
|
||||
NodeGraph* pipeline();
|
||||
private:
|
||||
NodeGraph pipeline_;
|
||||
};
|
||||
|
||||
#endif // TIMELINEOBJECT_H
|
||||
@@ -1,8 +1,5 @@
|
||||
#include "track.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include "timeline/clip.h"
|
||||
#include "timeline/tracklist.h"
|
||||
#include "timeline/sequence.h"
|
||||
@@ -12,8 +9,6 @@ int olive::timeline::kTrackDefaultHeight = 40;
|
||||
int olive::timeline::kTrackMinHeight = 30;
|
||||
int olive::timeline::kTrackHeightIncrement = 10;
|
||||
|
||||
int olive::timeline::kTimelineLabelFixedWidth = 200;
|
||||
|
||||
Track::Track(TrackList* parent, olive::TrackType type) :
|
||||
parent_(parent),
|
||||
type_(type),
|
||||
@@ -211,26 +206,6 @@ bool Track::ContainsClip(Clip *c)
|
||||
return false;
|
||||
}
|
||||
|
||||
int Track::SequenceWidth()
|
||||
{
|
||||
return sequence()->width;
|
||||
}
|
||||
|
||||
int Track::SequenceHeight()
|
||||
{
|
||||
return sequence()->height;
|
||||
}
|
||||
|
||||
double Track::SequenceFrameRate()
|
||||
{
|
||||
return sequence()->frame_rate;
|
||||
}
|
||||
|
||||
long Track::SequencePlayhead()
|
||||
{
|
||||
return sequence()->playhead;
|
||||
}
|
||||
|
||||
Track *Track::Previous()
|
||||
{
|
||||
int index = Index();
|
||||
@@ -458,12 +433,3 @@ void Track::SetLocked(bool locked)
|
||||
{
|
||||
locked_ = locked;
|
||||
}
|
||||
|
||||
void olive::timeline::MultiplyTrackSizesByDPI()
|
||||
{
|
||||
kTrackDefaultHeight *= qApp->fontMetrics().height() * 3;
|
||||
kTrackMinHeight *= qApp->fontMetrics().height();
|
||||
kTrackHeightIncrement *= qApp->fontMetrics().height() / 2;
|
||||
kTimelineLabelFixedWidth *= QApplication::desktop()->devicePixelRatio();
|
||||
}
|
||||
|
||||
|
||||
+1
-9
@@ -8,8 +8,6 @@
|
||||
#include "tracktypes.h"
|
||||
#include "undo/comboaction.h"
|
||||
#include "timeline/selection.h"
|
||||
#include "timelineobject.h"
|
||||
#include "clip.h"
|
||||
|
||||
class Sequence;
|
||||
class Transition;
|
||||
@@ -39,7 +37,7 @@ namespace olive {
|
||||
|
||||
class TrackList;
|
||||
|
||||
class Track : public TimelineObject
|
||||
class Track : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -70,12 +68,6 @@ public:
|
||||
Clip* GetClipFromPoint(long point);
|
||||
bool ContainsClip(Clip* c);
|
||||
|
||||
virtual int SequenceWidth() override;
|
||||
virtual int SequenceHeight() override;
|
||||
virtual double SequenceFrameRate() override;
|
||||
|
||||
virtual long SequencePlayhead() override;
|
||||
|
||||
Track* Previous();
|
||||
Track* Next();
|
||||
Track* Sibling(int diff);
|
||||
|
||||
Reference in New Issue
Block a user