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:
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -440,6 +440,11 @@ bool Node::IsTrack() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Node::IsMedia() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const QList<NodeParam *>& Node::parameters() const
|
||||
{
|
||||
return params_;
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user