Merge branch 'master' into cache-update

This commit is contained in:
itsmattkc
2022-07-01 22:32:49 -05:00
98 changed files with 1638 additions and 1480 deletions
+4 -7
View File
@@ -69,8 +69,6 @@ void PanNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeV
// Create a sample job
SampleBuffer samples = value[kSamplesInput].toSamples();
if (samples.is_allocated()) {
bool pushed_job = false;
// This node is only compatible with stereo audio
if (samples.audio_params().channel_count() == 2) {
// If the input is static, we can just do it now which will be faster
@@ -83,15 +81,14 @@ void PanNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeV
samples.transform_volume_for_channel(1, 1.0f + pan_volume);
}
}
table->Push(NodeValue(NodeValue::kSamples, samples, this));
} else {
// Requires job
pushed_job = true;
table->Push(NodeValue::kSamples, SampleJob(kSamplesInput, value), this);
}
}
if (!pushed_job) {
} else {
// Pass right through
table->Push(value[kSamplesInput]);
}
}
+11 -6
View File
@@ -289,17 +289,17 @@ void ClipBlock::InvalidateCache(const TimeRange& range, const QString& from, int
if (new_connected_viewer != connected_viewer_) {
if (connected_viewer_) {
disconnect(connected_viewer_->GetTimelinePoints()->markers(), &TimelineMarkerList::MarkerAdded, this, &ClipBlock::PreviewChanged);
disconnect(connected_viewer_->GetTimelinePoints()->markers(), &TimelineMarkerList::MarkerRemoved, this, &ClipBlock::PreviewChanged);
disconnect(connected_viewer_->GetTimelinePoints()->markers(), &TimelineMarkerList::MarkerModified, this, &ClipBlock::PreviewChanged);
disconnect(connected_viewer_->GetMarkers(), &TimelineMarkerList::MarkerAdded, this, &ClipBlock::PreviewChanged);
disconnect(connected_viewer_->GetMarkers(), &TimelineMarkerList::MarkerRemoved, this, &ClipBlock::PreviewChanged);
disconnect(connected_viewer_->GetMarkers(), &TimelineMarkerList::MarkerModified, this, &ClipBlock::PreviewChanged);
}
connected_viewer_ = new_connected_viewer;
if (connected_viewer_) {
connect(connected_viewer_->GetTimelinePoints()->markers(), &TimelineMarkerList::MarkerAdded, this, &ClipBlock::PreviewChanged);
connect(connected_viewer_->GetTimelinePoints()->markers(), &TimelineMarkerList::MarkerRemoved, this, &ClipBlock::PreviewChanged);
connect(connected_viewer_->GetTimelinePoints()->markers(), &TimelineMarkerList::MarkerModified, this, &ClipBlock::PreviewChanged);
connect(connected_viewer_->GetMarkers(), &TimelineMarkerList::MarkerAdded, this, &ClipBlock::PreviewChanged);
connect(connected_viewer_->GetMarkers(), &TimelineMarkerList::MarkerRemoved, this, &ClipBlock::PreviewChanged);
connect(connected_viewer_->GetMarkers(), &TimelineMarkerList::MarkerModified, this, &ClipBlock::PreviewChanged);
}
}
@@ -446,4 +446,9 @@ void ClipBlock::ConnectedToPreviewEvent()
RequestInvalidatedFromConnected();
}
TimeRange ClipBlock::media_range() const
{
return InputTimeAdjustment(kBufferIn, -1, range());
}
}
+2
View File
@@ -177,6 +177,8 @@ public:
virtual void ConnectedToPreviewEvent() override;
TimeRange media_range() const;
static const QString kBufferIn;
static const QString kMediaInInput;
static const QString kSpeedInput;
+7 -3
View File
@@ -99,7 +99,7 @@ const NodeKeyframe::Type &NodeKeyframe::type() const
void NodeKeyframe::set_type(const NodeKeyframe::Type &type)
{
if (type_ != type) {
type_ = type;
set_type_no_bezier_adj(type);
if (type_ == kBezier) {
// Set some sane defaults if this keyframe existed in the track and was just changed
@@ -120,11 +120,15 @@ void NodeKeyframe::set_type(const NodeKeyframe::Type &type)
}
}
}
emit TypeChanged(type_);
}
}
void NodeKeyframe::set_type_no_bezier_adj(const Type &type)
{
type_ = type;
emit TypeChanged(type_);
}
const QPointF &NodeKeyframe::bezier_control_in() const
{
return bezier_control_in_;
+1
View File
@@ -98,6 +98,7 @@ public:
*/
const Type& type() const;
void set_type(const Type& type);
void set_type_no_bezier_adj(const Type& type);
/**
* @brief For bezier interpolation, the control point leading into this keyframe
+3
View File
@@ -81,6 +81,9 @@ void TrackList::TrackConnected(Node *node, int element)
UpdateTrackIndexesFrom(cache_index);
connect(track, &Track::TrackLengthChanged, this, &TrackList::UpdateTotalLength);
connect(track, &Track::TrackHeightChangedInPixels, this, [this](int height){
emit TrackHeightChanged(static_cast<Track*>(sender()), height);
});
track->set_type(type_);
track->set_sequence(parent());
+2
View File
@@ -101,6 +101,8 @@ signals:
void TrackRemoved(Track* track);
void TrackHeightChanged(Track *track, int height);
private:
void UpdateTrackIndexesFrom(int index);
+4 -3
View File
@@ -60,7 +60,8 @@ ViewerOutput::ViewerOutput(bool create_buffer_inputs, bool create_default_stream
SetFlags(kDontShowInParamView);
timeline_points_ = new TimelinePoints(this);
workarea_ = new TimelineWorkArea(this);
markers_ = new TimelineMarkerList(this);
}
QString ViewerOutput::Name() const
@@ -342,7 +343,7 @@ rational ViewerOutput::VerifyLengthInternal(Track::Type type) const
case Track::kVideo:
if (IsInputConnected(kTextureInput)) {
NodeValueTable t = traverser.GenerateTable(GetConnectedOutput(kTextureInput), TimeRange(0, 0));
rational r = t.Get(NodeValue::kRational, QStringLiteral("length")).value<rational>();
rational r = t.Get(NodeValue::kRational, QStringLiteral("length")).toRational();
if (!r.isNaN()) {
return r;
}
@@ -351,7 +352,7 @@ rational ViewerOutput::VerifyLengthInternal(Track::Type type) const
case Track::kAudio:
if (IsInputConnected(kSamplesInput)) {
NodeValueTable t = traverser.GenerateTable(GetConnectedOutput(kSamplesInput), TimeRange(0, 0));
rational r = t.Get(NodeValue::kRational, QStringLiteral("length")).value<rational>();;
rational r = t.Get(NodeValue::kRational, QStringLiteral("length")).toRational();
if (!r.isNaN()) {
return r;
}
+6 -6
View File
@@ -29,7 +29,8 @@
#include "render/framehashcache.h"
#include "render/subtitleparams.h"
#include "render/videoparams.h"
#include "timeline/timelinepoints.h"
#include "timeline/timelinemarker.h"
#include "timeline/timelineworkarea.h"
namespace olive {
@@ -151,10 +152,8 @@ public:
const rational &GetVideoLength() const { return video_length_; }
const rational &GetAudioLength() const { return audio_length_; }
TimelinePoints* GetTimelinePoints()
{
return timeline_points_;
}
TimelineWorkArea *GetWorkArea() const { return workarea_; }
TimelineMarkerList *GetMarkers() const { return markers_; }
virtual TimeRange GetVideoCacheRange() const override
{
@@ -238,7 +237,8 @@ private:
AudioParams cached_audio_params_;
TimelinePoints *timeline_points_;
TimelineWorkArea *workarea_;
TimelineMarkerList *markers_;
bool autocache_input_video_;
bool autocache_input_audio_;
-1
View File
@@ -29,7 +29,6 @@
#include "node/output/viewer/viewer.h"
#include "render/audioparams.h"
#include "render/videoparams.h"
#include "timeline/timelinepoints.h"
namespace olive {
-1
View File
@@ -23,7 +23,6 @@
#include "node/output/track/tracklist.h"
#include "node/output/viewer/viewer.h"
#include "timeline/timelinepoints.h"
namespace olive {
@@ -496,7 +496,7 @@ void ProjectSerializer210528::LoadNodeCustom(QXmlStreamReader *reader, Node *nod
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("points")) {
LoadTimelinePoints(reader, viewer->GetTimelinePoints());
LoadTimelinePoints(reader, viewer);
} else if (reader->name() == QStringLiteral("timestamp") && footage) {
footage->set_timestamp(reader->readElementText().toLongLong());
} else {
@@ -553,13 +553,13 @@ void ProjectSerializer210528::LoadNodeCustom(QXmlStreamReader *reader, Node *nod
}
}
void ProjectSerializer210528::LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const
void ProjectSerializer210528::LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const
{
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("markers")) {
LoadMarkerList(reader, points->markers());
LoadMarkerList(reader, points->GetMarkers());
} else if (reader->name() == QStringLiteral("workarea")) {
LoadWorkArea(reader, points->workarea());
LoadWorkArea(reader, points->GetWorkArea());
} else {
reader->skipCurrentElement();
}
@@ -78,7 +78,7 @@ private:
void LoadNodeCustom(QXmlStreamReader *reader, Node *node, XMLNodeData &xml_node_data) const;
void LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const;
void LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const;
void LoadWorkArea(QXmlStreamReader *reader, TimelineWorkArea *workarea) const;
@@ -488,7 +488,7 @@ void ProjectSerializer210907::LoadNodeCustom(QXmlStreamReader *reader, Node *nod
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("points")) {
LoadTimelinePoints(reader, viewer->GetTimelinePoints());
LoadTimelinePoints(reader, viewer);
} else if (reader->name() == QStringLiteral("timestamp") && footage) {
footage->set_timestamp(reader->readElementText().toLongLong());
} else {
@@ -545,13 +545,13 @@ void ProjectSerializer210907::LoadNodeCustom(QXmlStreamReader *reader, Node *nod
}
}
void ProjectSerializer210907::LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const
void ProjectSerializer210907::LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const
{
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("markers")) {
LoadMarkerList(reader, points->markers());
LoadMarkerList(reader, points->GetMarkers());
} else if (reader->name() == QStringLiteral("workarea")) {
LoadWorkArea(reader, points->workarea());
LoadWorkArea(reader, points->GetWorkArea());
} else {
reader->skipCurrentElement();
}
@@ -77,7 +77,7 @@ private:
void LoadNodeCustom(QXmlStreamReader *reader, Node *node, XMLNodeData &xml_node_data) const;
void LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const;
void LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const;
void LoadWorkArea(QXmlStreamReader *reader, TimelineWorkArea *workarea) const;
@@ -538,7 +538,7 @@ void ProjectSerializer211228::LoadNodeCustom(QXmlStreamReader *reader, Node *nod
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("points")) {
LoadTimelinePoints(reader, viewer->GetTimelinePoints());
LoadTimelinePoints(reader, viewer);
} else if (reader->name() == QStringLiteral("timestamp") && footage) {
footage->set_timestamp(reader->readElementText().toLongLong());
} else {
@@ -595,13 +595,13 @@ void ProjectSerializer211228::LoadNodeCustom(QXmlStreamReader *reader, Node *nod
}
}
void ProjectSerializer211228::LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const
void ProjectSerializer211228::LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const
{
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("markers")) {
LoadMarkerList(reader, points->markers());
LoadMarkerList(reader, points->GetMarkers());
} else if (reader->name() == QStringLiteral("workarea")) {
LoadWorkArea(reader, points->workarea());
LoadWorkArea(reader, points->GetWorkArea());
} else {
reader->skipCurrentElement();
}
@@ -78,7 +78,7 @@ private:
void LoadNodeCustom(QXmlStreamReader *reader, Node *node, XMLNodeData &xml_node_data) const;
void LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const;
void LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const;
void LoadWorkArea(QXmlStreamReader *reader, TimelineWorkArea *workarea) const;
@@ -897,7 +897,7 @@ void ProjectSerializer220403::LoadKeyframe(QXmlStreamReader *reader, NodeKeyfram
} else if (attr.name() == QStringLiteral("time")) {
key->set_time(rational::fromString(attr.value().toString()));
} else if (attr.name() == QStringLiteral("type")) {
key->set_type(static_cast<NodeKeyframe::Type>(attr.value().toInt()));
key->set_type_no_bezier_adj(static_cast<NodeKeyframe::Type>(attr.value().toInt()));
} else if (attr.name() == QStringLiteral("inhandlex")) {
key_in_handle.setX(attr.value().toDouble());
} else if (attr.name() == QStringLiteral("inhandley")) {
@@ -1021,7 +1021,7 @@ void ProjectSerializer220403::LoadNodeCustom(QXmlStreamReader *reader, Node *nod
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("points")) {
LoadTimelinePoints(reader, viewer->GetTimelinePoints());
LoadTimelinePoints(reader, viewer);
} else if (reader->name() == QStringLiteral("timestamp") && footage) {
footage->set_timestamp(reader->readElementText().toLongLong());
} else {
@@ -1116,7 +1116,7 @@ void ProjectSerializer220403::SaveNodeCustom(QXmlStreamWriter *writer, Node *nod
if (ViewerOutput *viewer = dynamic_cast<ViewerOutput*>(node)) {
// Write TimelinePoints
writer->writeStartElement(QStringLiteral("points"));
SaveTimelinePoints(writer, viewer->GetTimelinePoints());
SaveTimelinePoints(writer, viewer);
writer->writeEndElement(); // points
if (Footage *footage = dynamic_cast<Footage*>(node)) {
@@ -1168,27 +1168,27 @@ void ProjectSerializer220403::SaveNodeCustom(QXmlStreamWriter *writer, Node *nod
}
}
void ProjectSerializer220403::LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const
void ProjectSerializer220403::LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *viewer) const
{
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("markers")) {
LoadMarkerList(reader, points->markers());
LoadMarkerList(reader, viewer->GetMarkers());
} else if (reader->name() == QStringLiteral("workarea")) {
LoadWorkArea(reader, points->workarea());
LoadWorkArea(reader, viewer->GetWorkArea());
} else {
reader->skipCurrentElement();
}
}
}
void ProjectSerializer220403::SaveTimelinePoints(QXmlStreamWriter *writer, TimelinePoints *points) const
void ProjectSerializer220403::SaveTimelinePoints(QXmlStreamWriter *writer, ViewerOutput *viewer) const
{
writer->writeStartElement(QStringLiteral("workarea"));
SaveWorkArea(writer, points->workarea());
SaveWorkArea(writer, viewer->GetWorkArea());
writer->writeEndElement(); // workarea
writer->writeStartElement(QStringLiteral("markers"));
SaveMarkerList(writer, points->markers());
SaveMarkerList(writer, viewer->GetMarkers());
writer->writeEndElement(); // markers
}
@@ -100,9 +100,9 @@ private:
void SaveNodeCustom(QXmlStreamWriter *writer, Node *node) const;
void LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const;
void LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *viewer) const;
void SaveTimelinePoints(QXmlStreamWriter *writer, TimelinePoints *points) const;
void SaveTimelinePoints(QXmlStreamWriter *writer, ViewerOutput *viewer) const;
void LoadMarker(QXmlStreamReader *reader, TimelineMarker *marker) const;