implemented a footage viewer
Essentially a minor derivation of a viewer type that can automatically view footage from the project (i.e. not in a sequence).
This commit is contained in:
@@ -50,15 +50,17 @@ void PanNode::ProcessSamples(const NodeValueDatabase *values, const AudioRenderi
|
||||
|
||||
float pan_val = (*values)[panning_input_].Get(NodeParam::kFloat).toFloat();
|
||||
|
||||
output[index] = input[index];
|
||||
|
||||
if (index%2 == 0) {
|
||||
// Sample is left channel
|
||||
if (pan_val > 0) {
|
||||
output[index] = input[index] * (1.0F - pan_val);
|
||||
output[index] *= (1.0F - pan_val);
|
||||
}
|
||||
} else {
|
||||
// Sample is right channel
|
||||
if (pan_val < 0) {
|
||||
output[index] = input[index] * (1.0F - qAbs(pan_val));
|
||||
output[index] *= (1.0F - qAbs(pan_val));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "media.h"
|
||||
|
||||
#include "common/timecodefunctions.h"
|
||||
|
||||
MediaInput::MediaInput() :
|
||||
connected_footage_(nullptr)
|
||||
{
|
||||
@@ -45,6 +47,20 @@ void MediaInput::Retranslate()
|
||||
footage_input_->set_name(tr("Footage"));
|
||||
}
|
||||
|
||||
NodeValueTable MediaInput::Value(const NodeValueDatabase &value) const
|
||||
{
|
||||
NodeValueTable table = value.Merge();
|
||||
|
||||
if (connected_footage_) {
|
||||
rational media_duration = Timecode::timestamp_to_time(connected_footage_->duration(),
|
||||
connected_footage_->timebase());
|
||||
|
||||
table.Push(NodeInput::kRational, QVariant::fromValue(media_duration), "length");
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
void MediaInput::FootageChanged()
|
||||
{
|
||||
StreamPtr new_footage = footage_input_->get_standard_value().value<StreamPtr>();
|
||||
|
||||
@@ -38,6 +38,8 @@ public:
|
||||
|
||||
virtual void Retranslate() override;
|
||||
|
||||
virtual NodeValueTable Value(const NodeValueDatabase& value) const override;
|
||||
|
||||
protected:
|
||||
NodeInput* footage_input_;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ const rational &TimelineOutput::timebase() const
|
||||
NodeValueTable TimelineOutput::Value(const NodeValueDatabase &value) const
|
||||
{
|
||||
NodeValueTable table = value.Merge();
|
||||
table.Push(NodeParam::kRational, QVariant::fromValue(length()));
|
||||
table.Push(NodeParam::kRational, QVariant::fromValue(length()), "length");
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ rational ViewerOutput::Length()
|
||||
Node* connected_node = length_input_->get_connected_node();
|
||||
|
||||
if (connected_node) {
|
||||
return connected_node->Value(NodeValueDatabase()).Get(NodeParam::kNumber).value<rational>();
|
||||
return connected_node->Value(NodeValueDatabase()).Get(NodeParam::kNumber, "length").value<rational>();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ void NodeParam::set_name(const QString &name)
|
||||
name_ = name;
|
||||
}
|
||||
|
||||
Node *NodeParam::parentNode()
|
||||
Node *NodeParam::parentNode() const
|
||||
{
|
||||
QObject* p = parent();
|
||||
|
||||
@@ -87,7 +87,7 @@ int NodeParam::index()
|
||||
return parentNode()->IndexOfParameter(this);
|
||||
}
|
||||
|
||||
bool NodeParam::IsConnected()
|
||||
bool NodeParam::IsConnected() const
|
||||
{
|
||||
return !edges_.isEmpty();
|
||||
}
|
||||
|
||||
+2
-2
@@ -254,7 +254,7 @@ public:
|
||||
* Nodes and NodeParams use the QObject parent-child system. This function is a convenience function for
|
||||
* static_cast<Node*>(QObject::parent())
|
||||
*/
|
||||
Node* parentNode();
|
||||
Node* parentNode() const;
|
||||
|
||||
/**
|
||||
* @brief Return the row index of this parameter in the parent node (primarily used for UI drawing functions)
|
||||
@@ -264,7 +264,7 @@ public:
|
||||
/**
|
||||
* @brief Returns whether anything is connected to this parameter or not
|
||||
*/
|
||||
bool IsConnected();
|
||||
bool IsConnected() const;
|
||||
|
||||
bool IsConnectable() const;
|
||||
void SetConnectable(bool connectable);
|
||||
|
||||
Reference in New Issue
Block a user