don't use shared ptrs on streams
This commit is contained in:
+1
-1
@@ -371,7 +371,7 @@ QString NodeInput::ValueToString(const DataType& data_type, const QVariant &valu
|
||||
} else if (data_type == kRational) {
|
||||
return value.value<rational>().toString();
|
||||
} else if (data_type == kFootage) {
|
||||
return QString::number(reinterpret_cast<quintptr>(value.value<StreamPtr>().get()));
|
||||
return QString::number(value.value<quintptr>());
|
||||
} else if (data_type == kTexture
|
||||
|| data_type == kSamples
|
||||
|| data_type == kBuffer) {
|
||||
|
||||
@@ -40,14 +40,14 @@ QVector<Node::CategoryID> MediaInput::Category() const
|
||||
return {kCategoryInput};
|
||||
}
|
||||
|
||||
StreamPtr MediaInput::stream()
|
||||
Stream *MediaInput::stream() const
|
||||
{
|
||||
return footage_input_->get_standard_value().value<StreamPtr>();
|
||||
return Node::ValueToPtr<Stream>(footage_input_->get_standard_value());
|
||||
}
|
||||
|
||||
void MediaInput::SetStream(StreamPtr s)
|
||||
void MediaInput::SetStream(Stream* s)
|
||||
{
|
||||
footage_input_->set_standard_value(QVariant::fromValue(s));
|
||||
footage_input_->set_standard_value(Node::PtrToValue(s));
|
||||
}
|
||||
|
||||
bool MediaInput::IsMedia() const
|
||||
@@ -76,20 +76,20 @@ NodeValueTable MediaInput::Value(NodeValueDatabase &value) const
|
||||
|
||||
void MediaInput::FootageChanged()
|
||||
{
|
||||
StreamPtr new_footage = footage_input_->get_standard_value().value<StreamPtr>();
|
||||
Stream* new_footage = footage_input_->get_standard_value().value<Stream*>();
|
||||
|
||||
if (new_footage == connected_footage_) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (connected_footage_) {
|
||||
disconnect(connected_footage_.get(), &Stream::ParametersChanged, this, &MediaInput::FootageParametersChanged);
|
||||
disconnect(connected_footage_, &Stream::ParametersChanged, this, &MediaInput::FootageParametersChanged);
|
||||
}
|
||||
|
||||
connected_footage_ = new_footage;
|
||||
|
||||
if (connected_footage_) {
|
||||
connect(connected_footage_.get(), &Stream::ParametersChanged, this, &MediaInput::FootageParametersChanged);
|
||||
connect(connected_footage_, &Stream::ParametersChanged, this, &MediaInput::FootageParametersChanged);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,8 +58,8 @@ public:
|
||||
|
||||
virtual QVector<CategoryID> Category() const override;
|
||||
|
||||
StreamPtr stream();
|
||||
void SetStream(StreamPtr s);
|
||||
Stream* stream() const;
|
||||
void SetStream(Stream *s);
|
||||
|
||||
virtual bool IsMedia() const override;
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
protected:
|
||||
NodeInput* footage_input_;
|
||||
|
||||
StreamPtr connected_footage_;
|
||||
Stream* connected_footage_;
|
||||
|
||||
private slots:
|
||||
void FootageChanged();
|
||||
|
||||
+3
-3
@@ -430,7 +430,7 @@ void Node::Hash(QCryptographicHash &hash, const rational& time) const
|
||||
|
||||
// We have one exception for FOOTAGE types, since we resolve the footage into a frame in the renderer
|
||||
if (input->data_type() == NodeParam::kFootage) {
|
||||
StreamPtr stream = input->get_standard_value().value<StreamPtr>();
|
||||
Stream* stream = Node::ValueToPtr<Stream>(input->get_standard_value());
|
||||
|
||||
if (stream) {
|
||||
// Add footage details to hash
|
||||
@@ -445,7 +445,7 @@ void Node::Hash(QCryptographicHash &hash, const rational& time) const
|
||||
hash.addData(QString::number(stream->index()).toUtf8());
|
||||
|
||||
if (stream->type() == Stream::kVideo) {
|
||||
VideoStreamPtr image_stream = std::static_pointer_cast<VideoStream>(stream);
|
||||
VideoStream* image_stream = static_cast<VideoStream*>(stream);
|
||||
|
||||
// Current color config and space
|
||||
hash.addData(image_stream->footage()->project()->color_manager()->GetConfigFilename().toUtf8());
|
||||
@@ -460,7 +460,7 @@ void Node::Hash(QCryptographicHash &hash, const rational& time) const
|
||||
|
||||
// Footage timestamp
|
||||
if (stream->type() == Stream::kVideo) {
|
||||
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(stream);
|
||||
VideoStream* video_stream = static_cast<VideoStream*>(stream);
|
||||
|
||||
int64_t video_ts = Timecode::time_to_timestamp(input_time, video_stream->timebase());
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ NodeValueTable NodeTraverser::GenerateBlockTable(const TrackOutput *track, const
|
||||
return table;
|
||||
}
|
||||
|
||||
QVariant NodeTraverser::ProcessVideoFootage(StreamPtr stream, const rational &input_time)
|
||||
QVariant NodeTraverser::ProcessVideoFootage(VideoStream *stream, const rational &input_time)
|
||||
{
|
||||
Q_UNUSED(stream)
|
||||
Q_UNUSED(input_time)
|
||||
@@ -110,7 +110,7 @@ QVariant NodeTraverser::ProcessVideoFootage(StreamPtr stream, const rational &in
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant NodeTraverser::ProcessAudioFootage(StreamPtr stream, const TimeRange &input_time)
|
||||
QVariant NodeTraverser::ProcessAudioFootage(AudioStream *stream, const TimeRange &input_time)
|
||||
{
|
||||
Q_UNUSED(stream)
|
||||
Q_UNUSED(input_time)
|
||||
@@ -188,7 +188,7 @@ void NodeTraverser::PostProcessTable(const Node *node, const TimeRange &range, N
|
||||
QList<NodeValue>* take_this_value_list = nullptr;
|
||||
|
||||
if (v.type() == NodeParam::kFootage) {
|
||||
StreamPtr s = v.data().value<StreamPtr>();
|
||||
Stream* s = Node::ValueToPtr<Stream>(v.data());
|
||||
|
||||
if (s) {
|
||||
if (s->type() == Stream::kVideo) {
|
||||
@@ -214,7 +214,8 @@ void NodeTraverser::PostProcessTable(const Node *node, const TimeRange &range, N
|
||||
if (!got_cached_frame) {
|
||||
// Retrieve video frames
|
||||
foreach (const NodeValue& v, video_footage_to_retrieve) {
|
||||
StreamPtr stream = v.data().value<StreamPtr>();
|
||||
// Assume this is a VideoStream, we did a type check earlier in the function
|
||||
VideoStream* stream = Node::ValueToPtr<VideoStream>(v.data());
|
||||
|
||||
if (stream->footage()->IsValid()) {
|
||||
QVariant value = ProcessVideoFootage(stream, range.in());
|
||||
@@ -246,10 +247,11 @@ void NodeTraverser::PostProcessTable(const Node *node, const TimeRange &range, N
|
||||
|
||||
// Retrieve audio samples
|
||||
foreach (const NodeValue& v, audio_footage_to_retrieve) {
|
||||
StreamPtr stream = v.data().value<StreamPtr>();
|
||||
// Assume this is an AudioStream, we did a type check earlier in the function
|
||||
AudioStream* stream = Node::ValueToPtr<AudioStream>(v.data());
|
||||
|
||||
if (stream->footage()->IsValid()) {
|
||||
QVariant value = ProcessAudioFootage(v.data().value<StreamPtr>(), range);
|
||||
QVariant value = ProcessAudioFootage(stream, range);
|
||||
|
||||
if (!value.isNull()) {
|
||||
output_params.Push(NodeParam::kSamples, value, node);
|
||||
|
||||
@@ -46,9 +46,9 @@ protected:
|
||||
|
||||
virtual NodeValueTable GenerateBlockTable(const TrackOutput *track, const TimeRange& range);
|
||||
|
||||
virtual QVariant ProcessVideoFootage(StreamPtr stream, const rational &input_time);
|
||||
virtual QVariant ProcessVideoFootage(VideoStream* stream, const rational &input_time);
|
||||
|
||||
virtual QVariant ProcessAudioFootage(StreamPtr stream, const TimeRange &input_time);
|
||||
virtual QVariant ProcessAudioFootage(AudioStream* stream, const TimeRange &input_time);
|
||||
|
||||
virtual QVariant ProcessShader(const Node *node, const TimeRange &range, const ShaderJob& job);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user