Check footage in use before deleteing

Initial very hacky implementation that checks if the footgae is in
use before deleting it and makes sure all refernences to it are
properly cleaned up.

Also added IsMedia() function to Node to simplify things a bit.
This commit is contained in:
Thomas Wilshaw
2020-09-28 14:33:53 +01:00
parent dac68cabc2
commit 7c7db5c933
9 changed files with 90 additions and 0 deletions
+5
View File
@@ -27,6 +27,11 @@ Node *AudioInput::copy() const
return new AudioInput();
}
Stream::Type AudioInput::type() const
{
return Stream::kAudio;
}
QString AudioInput::Name() const
{
return tr("Audio Input");
+2
View File
@@ -32,6 +32,8 @@ public:
virtual Node* copy() const override;
virtual Stream::Type type() const override;
virtual QString Name() const override;
virtual QString ShortName() const override;
virtual QString id() const override;
+5
View File
@@ -50,6 +50,11 @@ void MediaInput::SetFootage(StreamPtr f)
footage_input_->set_standard_value(QVariant::fromValue(f));
}
bool MediaInput::IsMedia() const
{
return true;
}
void MediaInput::Retranslate()
{
footage_input_->set_name(tr("Footage"));
+6
View File
@@ -23,6 +23,7 @@
#include "codec/decoder.h"
#include "node/node.h"
#include "project/item/footage/stream.h"
OLIVE_NAMESPACE_ENTER
@@ -35,11 +36,16 @@ class MediaInput : public Node
public:
MediaInput();
virtual Stream::Type type() const = 0;
virtual QList<CategoryID> Category() const override;
StreamPtr footage();
void SetFootage(StreamPtr f);
virtual bool IsMedia() const override;
virtual void Retranslate() override;
virtual NodeValueTable Value(NodeValueDatabase& value) const override;
+5
View File
@@ -36,6 +36,11 @@ Node *VideoInput::copy() const
return new VideoInput();
}
Stream::Type VideoInput::type() const
{
return Stream::kVideo;
}
QString VideoInput::Name() const
{
return tr("Video Input");
+2
View File
@@ -35,6 +35,8 @@ public:
virtual Node* copy() const override;
virtual Stream::Type type() const override;
virtual QString Name() const override;
virtual QString ShortName() const override;
virtual QString id() const override;
+5
View File
@@ -440,6 +440,11 @@ bool Node::IsTrack() const
return false;
}
bool Node::IsMedia() const
{
return false;
}
const QList<NodeParam *>& Node::parameters() const
{
return params_;
+9
View File
@@ -363,6 +363,15 @@ public:
*/
virtual bool IsTrack() const;
/**
* @brief Returns whether this Node is a "Media" type or not
*
* You shouldn't ever need to override this since all derivatives of Media will automatically have this set to true.
* It's just a more convenient way of checking than dynamic_casting.
*/
virtual bool IsMedia() const;
/**
* @brief The main processing function
*