use speed value instead of media out value
This functions more or less identically to using a media out value, but the desired speed is preserved through block length changes, even if the block's length is reduced to zero (i.e. no rounding errors).
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "transition.h"
|
||||
|
||||
TransitionBlock::TransitionBlock()
|
||||
TransitionBlock::TransitionBlock() :
|
||||
connected_out_block_(nullptr),
|
||||
connected_in_block_(nullptr)
|
||||
{
|
||||
out_block_input_ = new NodeInput("out_block_in", NodeParam::kBuffer);
|
||||
out_block_input_->set_is_keyframable(false);
|
||||
@@ -9,9 +11,6 @@ TransitionBlock::TransitionBlock()
|
||||
in_block_input_ = new NodeInput("in_block_in", NodeParam::kBuffer);
|
||||
in_block_input_->set_is_keyframable(false);
|
||||
AddInput(in_block_input_);
|
||||
|
||||
// A block's length must be greater than 0
|
||||
set_in_and_out_offset(1, 1);
|
||||
}
|
||||
|
||||
Block::Type TransitionBlock::type() const
|
||||
@@ -35,38 +34,12 @@ void TransitionBlock::Retranslate()
|
||||
in_block_input_->set_name(tr("To"));
|
||||
}
|
||||
|
||||
void TransitionBlock::set_length_and_media_out(const rational &length)
|
||||
rational TransitionBlock::in_offset() const
|
||||
{
|
||||
Q_UNUSED(length)
|
||||
qCritical() << "Set length is not permitted on a transition";
|
||||
abort();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TransitionBlock::set_length_and_media_in(const rational &length)
|
||||
rational TransitionBlock::out_offset() const
|
||||
{
|
||||
Q_UNUSED(length)
|
||||
qCritical() << "Set length and media in is not permitted on a transition";
|
||||
abort();
|
||||
}
|
||||
|
||||
const rational &TransitionBlock::in_offset() const
|
||||
{
|
||||
return in_offset_;
|
||||
}
|
||||
|
||||
const rational &TransitionBlock::out_offset() const
|
||||
{
|
||||
return out_offset_;
|
||||
}
|
||||
|
||||
void TransitionBlock::set_in_and_out_offset(const rational &in_offset, const rational &out_offset)
|
||||
{
|
||||
in_offset_ = in_offset;
|
||||
out_offset_ = out_offset;
|
||||
RecalculateLength();
|
||||
}
|
||||
|
||||
void TransitionBlock::RecalculateLength()
|
||||
{
|
||||
Block::set_length_and_media_out(in_offset_ + out_offset_);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -15,23 +15,17 @@ public:
|
||||
|
||||
virtual void Retranslate() override;
|
||||
|
||||
virtual void set_length_and_media_out(const rational &length) override;
|
||||
virtual void set_length_and_media_in(const rational &length) override;
|
||||
|
||||
const rational& in_offset() const;
|
||||
const rational& out_offset() const;
|
||||
void set_in_and_out_offset(const rational& in_offset, const rational& out_offset);
|
||||
rational in_offset() const;
|
||||
rational out_offset() const;
|
||||
|
||||
private:
|
||||
void RecalculateLength();
|
||||
|
||||
NodeInput* out_block_input_;
|
||||
|
||||
NodeInput* in_block_input_;
|
||||
|
||||
rational in_offset_;
|
||||
Block* connected_out_block_;
|
||||
|
||||
rational out_offset_;
|
||||
Block* connected_in_block_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user