began merging footage and viewer
This commit is contained in:
@@ -38,7 +38,7 @@ namespace olive {
|
||||
const QString Footage::kFilenameInput = QStringLiteral("file_in");
|
||||
const QString Footage::kStreamPropertiesFormat = QStringLiteral("stream_properties:%1");
|
||||
|
||||
#define super Node
|
||||
#define super ViewerOutput
|
||||
|
||||
Footage::Footage(const QString &filename) :
|
||||
cancelled_(nullptr)
|
||||
@@ -63,33 +63,21 @@ void Footage::Retranslate()
|
||||
}
|
||||
}
|
||||
|
||||
void Footage::LoadInternal(QXmlStreamReader *reader, XMLNodeData &xml_node_data, uint version, const QAtomicInt* cancelled)
|
||||
bool Footage::LoadCustom(QXmlStreamReader *reader, XMLNodeData &xml_node_data, uint version, const QAtomicInt* cancelled)
|
||||
{
|
||||
Q_UNUSED(xml_node_data)
|
||||
Q_UNUSED(version)
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (cancelled && *cancelled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("timestamp")) {
|
||||
set_timestamp(reader->readElementText().toLongLong());
|
||||
} else if (reader->name() == QStringLiteral("points")) {
|
||||
TimelinePoints::Load(reader);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
if (reader->name() == QStringLiteral("timestamp")) {
|
||||
set_timestamp(reader->readElementText().toLongLong());
|
||||
return true;
|
||||
} else {
|
||||
return super::LoadCustom(reader, xml_node_data, version, cancelled);
|
||||
}
|
||||
}
|
||||
|
||||
void Footage::SaveInternal(QXmlStreamWriter *writer) const
|
||||
void Footage::SaveCustom(QXmlStreamWriter *writer) const
|
||||
{
|
||||
writer->writeTextElement(QStringLiteral("timestamp"), QString::number(timestamp_));
|
||||
super::SaveCustom(writer);
|
||||
|
||||
writer->writeStartElement(QStringLiteral("points"));
|
||||
TimelinePoints::Save(writer);
|
||||
writer->writeEndElement(); // points
|
||||
writer->writeTextElement(QStringLiteral("timestamp"), QString::number(timestamp_));
|
||||
}
|
||||
|
||||
void Footage::InputValueChangedEvent(const QString &input, int element)
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "common/rational.h"
|
||||
#include "footagedescription.h"
|
||||
#include "node/node.h"
|
||||
#include "node/output/viewer/viewer.h"
|
||||
#include "render/audioparams.h"
|
||||
#include "render/videoparams.h"
|
||||
#include "stream.h"
|
||||
@@ -41,7 +41,7 @@ namespace olive {
|
||||
* Footage objects store a list of Stream objects which store the majority of video/audio metadata. These streams
|
||||
* are identical to the stream data in the files.
|
||||
*/
|
||||
class Footage : public Node, public TimelinePoints
|
||||
class Footage : public ViewerOutput
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -140,61 +140,6 @@ public:
|
||||
cancelled_ = c;
|
||||
}
|
||||
|
||||
class StreamReference
|
||||
{
|
||||
public:
|
||||
StreamReference()
|
||||
{
|
||||
type_ = Stream::kUnknown;
|
||||
index_ = -1;
|
||||
}
|
||||
|
||||
StreamReference(Stream::Type type, int index)
|
||||
{
|
||||
type_ = type;
|
||||
index_ = index;
|
||||
}
|
||||
|
||||
bool operator==(const StreamReference& rhs) const
|
||||
{
|
||||
return type_ == rhs.type_ && index_ == rhs.index_;
|
||||
}
|
||||
|
||||
bool operator<(const StreamReference& rhs) const
|
||||
{
|
||||
if (type_ != rhs.type_) {
|
||||
return type_ < rhs.type_;
|
||||
}
|
||||
|
||||
return index_ < rhs.index_;
|
||||
}
|
||||
|
||||
bool IsValid() const
|
||||
{
|
||||
return type_ != Stream::kUnknown && index_ >= 0;
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
*this = StreamReference();
|
||||
}
|
||||
|
||||
Stream::Type type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
int index() const
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
|
||||
private:
|
||||
Stream::Type type_;
|
||||
int index_;
|
||||
|
||||
};
|
||||
|
||||
static QString GetStringFromReference(Stream::Type type, int index);
|
||||
static QString GetStringFromReference(const StreamReference& ref)
|
||||
{
|
||||
@@ -293,12 +238,12 @@ protected:
|
||||
/**
|
||||
* @brief Load function
|
||||
*/
|
||||
virtual void LoadInternal(QXmlStreamReader* reader, XMLNodeData &xml_node_data, uint version, const QAtomicInt *cancelled) override;
|
||||
virtual bool LoadCustom(QXmlStreamReader* reader, XMLNodeData &xml_node_data, uint version, const QAtomicInt *cancelled) override;
|
||||
|
||||
/**
|
||||
* @brief Save function
|
||||
*/
|
||||
virtual void SaveInternal(QXmlStreamWriter *writer) const override;
|
||||
virtual void SaveCustom(QXmlStreamWriter *writer) const override;
|
||||
|
||||
virtual void InputValueChangedEvent(const QString &input, int element) override;
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef STREAM_H
|
||||
#define STREAM_H
|
||||
|
||||
namespace olive {
|
||||
|
||||
class Stream
|
||||
{
|
||||
public:
|
||||
enum Type {
|
||||
kUnknown = -1,
|
||||
kVideo,
|
||||
kAudio,
|
||||
kData,
|
||||
kSubtitle,
|
||||
kAttachment
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // STREAM_H
|
||||
@@ -178,27 +178,4 @@ void Sequence::UpdateTrackCache()
|
||||
}
|
||||
}
|
||||
|
||||
void Sequence::LoadInternal(QXmlStreamReader *reader, XMLNodeData &xml_node_data, uint version, const QAtomicInt *cancelled)
|
||||
{
|
||||
Q_UNUSED(xml_node_data)
|
||||
Q_UNUSED(version)
|
||||
Q_UNUSED(cancelled)
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("points")) {
|
||||
timeline_points_.Load(reader);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Sequence::SaveInternal(QXmlStreamWriter *writer) const
|
||||
{
|
||||
// Write TimelinePoints
|
||||
writer->writeStartElement(QStringLiteral("points"));
|
||||
timeline_points_.Save(writer);
|
||||
writer->writeEndElement(); // points
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -91,21 +91,12 @@ public:
|
||||
|
||||
static const QString kTrackInputFormat;
|
||||
|
||||
TimelinePoints* timeline_points()
|
||||
{
|
||||
return &timeline_points_;
|
||||
}
|
||||
|
||||
virtual bool IsItem() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void LoadInternal(QXmlStreamReader* reader, XMLNodeData &xml_node_data, uint version, const QAtomicInt* cancelled) override;
|
||||
|
||||
virtual void SaveInternal(QXmlStreamWriter *writer) const override;
|
||||
|
||||
virtual void ShiftAudioEvent(const rational &from, const rational &to) override;
|
||||
|
||||
virtual void InputConnectedEvent(const QString &input, int element, const NodeOutput &output) override;
|
||||
@@ -123,8 +114,6 @@ private:
|
||||
|
||||
QVector<Track*> track_cache_;
|
||||
|
||||
TimelinePoints timeline_points_;
|
||||
|
||||
private slots:
|
||||
void UpdateTrackCache();
|
||||
|
||||
|
||||
@@ -51,13 +51,6 @@ Project::Project() :
|
||||
settings_->SetPosition(QPointF(2, 0));
|
||||
AddDefaultNode(settings_);
|
||||
|
||||
// Viewer node for connecting with the footage viewer
|
||||
footage_viewer_ = new ViewerOutput();
|
||||
footage_viewer_->setParent(this);
|
||||
footage_viewer_->SetLabel(tr("Footage Viewer"));
|
||||
footage_viewer_->SetPosition(QPointF(3, 0));
|
||||
AddDefaultNode(footage_viewer_);
|
||||
|
||||
// Folder root for project
|
||||
root_ = new Folder();
|
||||
root_->setParent(this);
|
||||
@@ -295,6 +288,7 @@ void Project::RegenerateUuid()
|
||||
|
||||
void Project::ColorManagerValueChanged(const NodeInput &input, const TimeRange &range)
|
||||
{
|
||||
Q_UNUSED(input)
|
||||
Q_UNUSED(range)
|
||||
|
||||
QVector<Footage*> footage = root()->ListChildrenOfType<Footage>();
|
||||
|
||||
@@ -74,11 +74,6 @@ public:
|
||||
|
||||
QString cache_path() const;
|
||||
|
||||
ViewerOutput* footage_viewer()
|
||||
{
|
||||
return footage_viewer_;
|
||||
}
|
||||
|
||||
const QUuid& GetUuid() const
|
||||
{
|
||||
return uuid_;
|
||||
@@ -102,8 +97,6 @@ private:
|
||||
|
||||
ProjectSettingsNode* settings_;
|
||||
|
||||
ViewerOutput* footage_viewer_;
|
||||
|
||||
bool is_modified_;
|
||||
|
||||
bool autorecovery_saved_;
|
||||
|
||||
Reference in New Issue
Block a user