start moving core frameworks to external libraries

This commit is contained in:
itsmattkc
2023-01-19 09:51:47 -08:00
parent e7982239b8
commit dd9c52ab59
158 changed files with 478 additions and 2484 deletions
-1
View File
@@ -20,7 +20,6 @@
#include "stroke.h"
#include "render/color.h"
#include "widget/slider/floatslider.h"
namespace olive {
+1 -1
View File
@@ -90,7 +90,7 @@ void PolygonGenerator::Retranslate()
ShaderJob PolygonGenerator::GetGenerateJob(const NodeValueRow &value, const VideoParams &params) const
{
VideoParams p = params;
p.set_format(VideoParams::kFormatUnsigned8);
p.set_format(PixelFormat::U8);
auto job = Texture::Job(p, GenerateJob(value));
// Conversion to RGB
-2
View File
@@ -20,8 +20,6 @@
#include "solid.h"
#include "render/color.h"
namespace olive {
const QString SolidGenerator::kColorInput = QStringLiteral("color_in");
+1 -1
View File
@@ -97,7 +97,7 @@ void TextGeneratorV2::Value(const NodeValueRow &value, const NodeGlobals &global
if (!value[kTextInput].toString().isEmpty()) {
GenerateJob job(value);
auto text_params = globals.vparams();
text_params.set_format(VideoParams::kFormatFloat32);
text_params.set_format(PixelFormat::F32);
table->Push(NodeValue::kTexture, Texture::Job(text_params, job), this);
}
}
+1 -1
View File
@@ -117,7 +117,7 @@ void TextGeneratorV3::Value(const NodeValueRow &value, const NodeGlobals &global
TexturePtr base = value[kTextInput].toTexture();
VideoParams text_params = base ? base->params() : globals.vparams();
text_params.set_format(VideoParams::kFormatUnsigned8);
text_params.set_format(PixelFormat::U8);
text_params.set_colorspace(project()->color_manager()->GetDefaultInputColorSpace());
GenerateJob job(value);
+2 -3
View File
@@ -21,7 +21,6 @@
#ifndef DRAGGABLEGIZMO_H
#define DRAGGABLEGIZMO_H
#include "common/rational.h"
#include "gizmo.h"
#include "node/inputdragger.h"
#include "undo/undocommand.h"
@@ -46,7 +45,7 @@ public:
explicit DraggableGizmo(QObject *parent = nullptr);
void DragStart(const NodeValueRow &row, double abs_x, double abs_y, const olive::rational &time);
void DragStart(const NodeValueRow &row, double abs_x, double abs_y, const olive::core::rational &time);
void DragMove(double x, double y, const Qt::KeyboardModifiers &modifiers);
@@ -67,7 +66,7 @@ public:
void SetDragValueBehavior(DragValueBehavior d) { drag_value_behavior_ = d; }
signals:
void HandleStart(const olive::NodeValueRow &row, double x, double y, const olive::rational &time);
void HandleStart(const olive::NodeValueRow &row, double x, double y, const olive::core::rational &time);
void HandleMovement(double x, double y, const Qt::KeyboardModifiers &modifiers);
-1
View File
@@ -23,7 +23,6 @@
#include <QVector2D>
#include "common/timerange.h"
#include "render/audioparams.h"
#include "render/loopmode.h"
#include "render/videoparams.h"
-1
View File
@@ -21,7 +21,6 @@
#ifndef NODEINPUTDRAGGER_H
#define NODEINPUTDRAGGER_H
#include "common/rational.h"
#include "node/keyframe.h"
#include "node/param.h"
#include "undo/undocommand.h"
-1
View File
@@ -21,7 +21,6 @@
#ifndef NODEINPUTIMMEDIATE_H
#define NODEINPUTIMMEDIATE_H
#include "common/timerange.h"
#include "common/xmlutils.h"
#include "node/keyframe.h"
#include "node/value.h"
-2
View File
@@ -25,8 +25,6 @@
#include <QPointF>
#include <QVariant>
#include "common/rational.h"
#include "common/timerange.h"
#include "node/param.h"
namespace olive {
-1
View File
@@ -26,7 +26,6 @@
#include "common/cpuoptimize.h"
#include "common/tohex.h"
#include "node/distort/transform/transformdistortnode.h"
#include "render/color.h"
namespace olive {
+2 -2
View File
@@ -163,7 +163,7 @@ QLinearGradient Node::gradient_color(qreal top, qreal bottom) const
grad.setStart(0, top);
grad.setFinalStop(0, bottom);
QColor c = color().toQColor();
QColor c = QtUtils::toQColor(color());
grad.setColorAt(0.0, c.lighter());
grad.setColorAt(1.0, c);
@@ -176,7 +176,7 @@ QBrush Node::brush(qreal top, qreal bottom) const
if (OLIVE_CONFIG("UseGradients").toBool()) {
return gradient_color(top, bottom);
} else {
return color().toQColor();
return QtUtils::toQColor(color());
}
}
+3 -5
View File
@@ -30,8 +30,6 @@
#include "codec/frame.h"
#include "codec/samplebuffer.h"
#include "common/rational.h"
#include "common/timerange.h"
#include "common/xmlutils.h"
#include "node/gizmo/draggable.h"
#include "node/globals.h"
@@ -1229,7 +1227,7 @@ protected:
}
protected slots:
virtual void GizmoDragStart(const olive::NodeValueRow &row, double x, double y, const olive::rational &time){}
virtual void GizmoDragStart(const olive::NodeValueRow &row, double x, double y, const olive::core::rational &time){}
virtual void GizmoDragMove(double x, double y, const Qt::KeyboardModifiers &modifiers){}
@@ -1379,8 +1377,8 @@ private:
QVector<Node*> GetDependenciesInternal(bool traverse, bool exclusive_only) const;
void ParameterValueChanged(const QString &input, int element, const olive::TimeRange &range);
void ParameterValueChanged(const NodeInput& input, const olive::TimeRange &range)
void ParameterValueChanged(const QString &input, int element, const olive::core::TimeRange &range);
void ParameterValueChanged(const NodeInput& input, const olive::core::TimeRange &range)
{
ParameterValueChanged(input.input(), input.element(), range);
}
+3 -3
View File
@@ -116,7 +116,7 @@ QString ViewerOutput::duration() const
return QString();
} else {
// Return time transformed to timecode
return Timecode::time_to_timecode(GetLength(), using_timebase, using_display);
return QString::fromStdString(Timecode::time_to_timecode(GetLength(), using_timebase, using_display));
}
}
@@ -206,7 +206,7 @@ void ViewerOutput::set_default_parameters()
width,
height,
OLIVE_CONFIG("DefaultSequenceFrameRate").value<rational>(),
static_cast<VideoParams::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt()),
static_cast<PixelFormat::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt()),
VideoParams::kInternalChannelCount,
OLIVE_CONFIG("DefaultSequencePixelAspect").value<rational>(),
OLIVE_CONFIG("DefaultSequenceInterlacing").value<VideoParams::Interlacing>(),
@@ -505,7 +505,7 @@ void ViewerOutput::set_parameters_from_footage(const QVector<ViewerOutput *> foo
SetVideoParams(VideoParams(s.width(),
s.height(),
using_timebase,
static_cast<VideoParams::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt()),
static_cast<PixelFormat::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt()),
VideoParams::kInternalChannelCount,
s.pixel_aspect_ratio(),
s.interlacing(),
-1
View File
@@ -22,7 +22,6 @@
#define VIEWER_H
#include "codec/encoder.h"
#include "common/rational.h"
#include "node/node.h"
#include "node/output/track/track.h"
#include "render/audioparams.h"
+2 -2
View File
@@ -170,12 +170,12 @@ int NodeInput::GetArraySize() const
uint qHash(const NodeInput &i)
{
return qHash(i.node()) ^ qHash(i.input()) ^ qHash(i.element());
return qHash(i.node()) ^ qHash(i.input()) ^ ::qHash(i.element());
}
uint qHash(const NodeKeyframeTrackReference &i)
{
return qHash(i.input()) & qHash(i.track());
return qHash(i.input()) & ::qHash(i.track());
}
uint qHash(const NodeInputPair &i)
-1
View File
@@ -23,7 +23,6 @@
#include <QString>
#include "common/rational.h"
#include "value.h"
namespace olive {
+1 -1
View File
@@ -21,11 +21,11 @@
#ifndef FOOTAGE_H
#define FOOTAGE_H
#include <olive/core/core.h>
#include <QList>
#include <QDateTime>
#include "codec/decoder.h"
#include "common/rational.h"
#include "footagedescription.h"
#include "node/output/viewer/viewer.h"
#include "render/audioparams.h"
@@ -378,7 +378,7 @@ void ProjectSerializer210528::LoadImmediate(QXmlStreamReader *reader, Node *node
if (attr.name() == QStringLiteral("input")) {
key_input = attr.value().toString();
} else if (attr.name() == QStringLiteral("time")) {
key_time = rational::fromString(attr.value().toString());
key_time = rational::fromString(attr.value().toString().toStdString());
} else if (attr.name() == QStringLiteral("type")) {
key_type = static_cast<NodeKeyframe::Type>(attr.value().toInt());
} else if (attr.name() == QStringLiteral("inhandlex")) {
@@ -575,9 +575,9 @@ void ProjectSerializer210528::LoadWorkArea(QXmlStreamReader *reader, TimelineWor
if (attr.name() == QStringLiteral("enabled")) {
workarea->set_enabled(attr.value() != QStringLiteral("0"));
} else if (attr.name() == QStringLiteral("in")) {
range_in = rational::fromString(attr.value().toString());
range_in = rational::fromString(attr.value().toString().toStdString());
} else if (attr.name() == QStringLiteral("out")) {
range_out = rational::fromString(attr.value().toString());
range_out = rational::fromString(attr.value().toString().toStdString());
}
}
@@ -601,9 +601,9 @@ void ProjectSerializer210528::LoadMarkerList(QXmlStreamReader *reader, TimelineM
if (attr.name() == QStringLiteral("name")) {
name = attr.value().toString();
} else if (attr.name() == QStringLiteral("in")) {
in = rational::fromString(attr.value().toString());
in = rational::fromString(attr.value().toString().toStdString());
} else if (attr.name() == QStringLiteral("out")) {
out = rational::fromString(attr.value().toString());
out = rational::fromString(attr.value().toString().toStdString());
}
}
@@ -375,7 +375,7 @@ void ProjectSerializer210907::LoadImmediate(QXmlStreamReader *reader, Node *node
if (attr.name() == QStringLiteral("input")) {
key_input = attr.value().toString();
} else if (attr.name() == QStringLiteral("time")) {
key_time = rational::fromString(attr.value().toString());
key_time = rational::fromString(attr.value().toString().toStdString());
} else if (attr.name() == QStringLiteral("type")) {
key_type = static_cast<NodeKeyframe::Type>(attr.value().toInt());
} else if (attr.name() == QStringLiteral("inhandlex")) {
@@ -567,9 +567,9 @@ void ProjectSerializer210907::LoadWorkArea(QXmlStreamReader *reader, TimelineWor
if (attr.name() == QStringLiteral("enabled")) {
workarea->set_enabled(attr.value() != QStringLiteral("0"));
} else if (attr.name() == QStringLiteral("in")) {
range_in = rational::fromString(attr.value().toString());
range_in = rational::fromString(attr.value().toString().toStdString());
} else if (attr.name() == QStringLiteral("out")) {
range_out = rational::fromString(attr.value().toString());
range_out = rational::fromString(attr.value().toString().toStdString());
}
}
@@ -593,9 +593,9 @@ void ProjectSerializer210907::LoadMarkerList(QXmlStreamReader *reader, TimelineM
if (attr.name() == QStringLiteral("name")) {
name = attr.value().toString();
} else if (attr.name() == QStringLiteral("in")) {
in = rational::fromString(attr.value().toString());
in = rational::fromString(attr.value().toString().toStdString());
} else if (attr.name() == QStringLiteral("out")) {
out = rational::fromString(attr.value().toString());
out = rational::fromString(attr.value().toString().toStdString());
}
}
@@ -425,7 +425,7 @@ void ProjectSerializer211228::LoadImmediate(QXmlStreamReader *reader, Node *node
if (attr.name() == QStringLiteral("input")) {
key_input = attr.value().toString();
} else if (attr.name() == QStringLiteral("time")) {
key_time = rational::fromString(attr.value().toString());
key_time = rational::fromString(attr.value().toString().toStdString());
} else if (attr.name() == QStringLiteral("type")) {
key_type = static_cast<NodeKeyframe::Type>(attr.value().toInt());
} else if (attr.name() == QStringLiteral("inhandlex")) {
@@ -617,9 +617,9 @@ void ProjectSerializer211228::LoadWorkArea(QXmlStreamReader *reader, TimelineWor
if (attr.name() == QStringLiteral("enabled")) {
workarea->set_enabled(attr.value() != QStringLiteral("0"));
} else if (attr.name() == QStringLiteral("in")) {
range_in = rational::fromString(attr.value().toString());
range_in = rational::fromString(attr.value().toString().toStdString());
} else if (attr.name() == QStringLiteral("out")) {
range_out = rational::fromString(attr.value().toString());
range_out = rational::fromString(attr.value().toString().toStdString());
}
}
@@ -643,9 +643,9 @@ void ProjectSerializer211228::LoadMarkerList(QXmlStreamReader *reader, TimelineM
if (attr.name() == QStringLiteral("name")) {
name = attr.value().toString();
} else if (attr.name() == QStringLiteral("in")) {
in = rational::fromString(attr.value().toString());
in = rational::fromString(attr.value().toString().toStdString());
} else if (attr.name() == QStringLiteral("out")) {
out = rational::fromString(attr.value().toString());
out = rational::fromString(attr.value().toString().toStdString());
}
}
@@ -909,7 +909,7 @@ void ProjectSerializer220403::LoadKeyframe(QXmlStreamReader *reader, NodeKeyfram
if (attr.name() == QStringLiteral("input")) {
key_input = attr.value().toString();
} else if (attr.name() == QStringLiteral("time")) {
key->set_time(rational::fromString(attr.value().toString()));
key->set_time(rational::fromString(attr.value().toString().toStdString()));
} else if (attr.name() == QStringLiteral("type")) {
key->set_type_no_bezier_adj(static_cast<NodeKeyframe::Type>(attr.value().toInt()));
} else if (attr.name() == QStringLiteral("inhandlex")) {
@@ -932,7 +932,7 @@ void ProjectSerializer220403::LoadKeyframe(QXmlStreamReader *reader, NodeKeyfram
void ProjectSerializer220403::SaveKeyframe(QXmlStreamWriter *writer, NodeKeyframe *key, NodeValue::Type data_type) const
{
writer->writeAttribute(QStringLiteral("input"), key->input());
writer->writeAttribute(QStringLiteral("time"), key->time().toString());
writer->writeAttribute(QStringLiteral("time"), QString::fromStdString(key->time().toString()));
writer->writeAttribute(QStringLiteral("type"), QString::number(key->type()));
writer->writeAttribute(QStringLiteral("inhandlex"), QString::number(key->bezier_control_in().x()));
writer->writeAttribute(QStringLiteral("inhandley"), QString::number(key->bezier_control_in().y()));
@@ -1214,9 +1214,9 @@ void ProjectSerializer220403::LoadMarker(QXmlStreamReader *reader, TimelineMarke
if (attr.name() == QStringLiteral("name")) {
marker->set_name(attr.value().toString());
} else if (attr.name() == QStringLiteral("in")) {
in = rational::fromString(attr.value().toString());
in = rational::fromString(attr.value().toString().toStdString());
} else if (attr.name() == QStringLiteral("out")) {
out = rational::fromString(attr.value().toString());
out = rational::fromString(attr.value().toString().toStdString());
} else if (attr.name() == QStringLiteral("color")) {
marker->set_color(attr.value().toInt());
}
@@ -1231,8 +1231,8 @@ void ProjectSerializer220403::LoadMarker(QXmlStreamReader *reader, TimelineMarke
void ProjectSerializer220403::SaveMarker(QXmlStreamWriter *writer, TimelineMarker *marker) const
{
writer->writeAttribute(QStringLiteral("name"), marker->name());
writer->writeAttribute(QStringLiteral("in"), marker->time().in().toString());
writer->writeAttribute(QStringLiteral("out"), marker->time().out().toString());
writer->writeAttribute(QStringLiteral("in"), QString::fromStdString(marker->time().in().toString()));
writer->writeAttribute(QStringLiteral("out"), QString::fromStdString(marker->time().out().toString()));
writer->writeAttribute(QStringLiteral("color"), QString::number(marker->color()));
}
@@ -1245,9 +1245,9 @@ void ProjectSerializer220403::LoadWorkArea(QXmlStreamReader *reader, TimelineWor
if (attr.name() == QStringLiteral("enabled")) {
workarea->set_enabled(attr.value() != QStringLiteral("0"));
} else if (attr.name() == QStringLiteral("in")) {
range_in = rational::fromString(attr.value().toString());
range_in = rational::fromString(attr.value().toString().toStdString());
} else if (attr.name() == QStringLiteral("out")) {
range_out = rational::fromString(attr.value().toString());
range_out = rational::fromString(attr.value().toString().toStdString());
}
}
@@ -1263,8 +1263,8 @@ void ProjectSerializer220403::LoadWorkArea(QXmlStreamReader *reader, TimelineWor
void ProjectSerializer220403::SaveWorkArea(QXmlStreamWriter *writer, TimelineWorkArea *workarea) const
{
writer->writeAttribute(QStringLiteral("enabled"), QString::number(workarea->enabled()));
writer->writeAttribute(QStringLiteral("in"), workarea->in().toString());
writer->writeAttribute(QStringLiteral("out"), workarea->out().toString());
writer->writeAttribute(QStringLiteral("in"), QString::fromStdString(workarea->in().toString()));
writer->writeAttribute(QStringLiteral("out"), QString::fromStdString(workarea->out().toString()));
}
void ProjectSerializer220403::LoadMarkerList(QXmlStreamReader *reader, TimelineMarkerList *markers) const
+2 -3
View File
@@ -31,7 +31,6 @@
#include "render/audioparams.h"
#include "render/subtitleparams.h"
#include "render/videoparams.h"
#include "render/color.h"
namespace olive {
@@ -72,7 +71,7 @@ QString NodeValue::ValueToString(Type data_type, const QVariant &value, bool val
QString::number(b.cp2_x()),
QString::number(b.cp2_y()));
} else if (data_type == kRational) {
return value.value<rational>().toString();
return QString::fromStdString(value.value<rational>().toString());
} else if (data_type == kTexture
|| data_type == kSamples
|| data_type == kNone) {
@@ -245,7 +244,7 @@ QVariant NodeValue::StringToValue(Type data_type, const QString &string, bool va
} else if (data_type == kInt) {
return QVariant::fromValue(string.toLongLong());
} else if (data_type == kRational) {
return QVariant::fromValue(rational::fromString(string));
return QVariant::fromValue(rational::fromString(string.toStdString()));
} else {
return string;
}
+3 -3
View File
@@ -28,8 +28,8 @@
#include "codec/samplebuffer.h"
#include "common/bezier.h"
#include "common/qtutils.h"
#include "node/splitvalue.h"
#include "render/color.h"
#include "render/texture.h"
namespace olive {
@@ -338,9 +338,9 @@ public:
bool toBool() const { return value<bool>(); }
double toDouble() const { return value<double>(); }
int64_t toInt() const { return value<int64_t>(); }
rational toRational() const { return value<rational>(); }
rational toRational() const { return value<olive::core::rational>(); }
QString toString() const { return value<QString>(); }
Color toColor() const { return value<Color>(); }
Color toColor() const { return value<olive::core::Color>(); }
QMatrix4x4 toMatrix() const { return value<QMatrix4x4>(); }
VideoParams toVideoParams() const { return value<VideoParams>(); }
AudioParams toAudioParams() const { return value<AudioParams>(); }