Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 7761e619 authored by Nicolas Carion's avatar Nicolas Carion

detect speed when creating clipmodel

parent 3fc4464f
......@@ -35,12 +35,15 @@
#include "gentime.h"
#include <effects/effectsrepository.hpp>
ClipModel::ClipModel(std::shared_ptr<TimelineModel> parent, std::shared_ptr<Mlt::Producer> prod, const QString &binClipId, int id)
ClipModel::ClipModel(std::shared_ptr<TimelineModel> parent, std::shared_ptr<Mlt::Producer> prod, const QString &binClipId, int id, PlaylistState state,
double speed)
: MoveableItem<Mlt::Producer>(parent, id)
, m_producer(std::move(prod))
, m_effectStack(EffectStackModel::construct(m_producer, {ObjectType::TimelineClip, m_id}, parent->m_undoStack))
, m_binClipId(binClipId)
, forceThumbReload(false)
, m_currentState(state)
, m_speed(speed)
{
m_producer->set("kdenlive:id", binClipId.toUtf8().constData());
m_producer->set("_kdenlive_cid", m_id);
......@@ -65,7 +68,7 @@ int ClipModel::construct(const std::shared_ptr<TimelineModel> &parent, const QSt
std::shared_ptr<Mlt::Producer> cutProducer = binClip->getTimelineProducer(id, state, 1.);
std::shared_ptr<ClipModel> clip(new ClipModel(parent, cutProducer, binClipId, id));
std::shared_ptr<ClipModel> clip(new ClipModel(parent, cutProducer, binClipId, id, state));
clip->setClipState(state);
parent->registerClip(clip);
return id;
......@@ -87,8 +90,12 @@ int ClipModel::construct(const std::shared_ptr<TimelineModel> &parent, const QSt
videoAudio.second = videoAudio.second && binClip->hasAudio();
state = stateFromBool(videoAudio);
double speed = 1.0;
if (QString::fromUtf8(producer->get("mlt_service")) == QLatin1String("timewarp")) {
speed = producer->get_double("warp_speed");
}
auto result = binClip->giveMasterAndGetTimelineProducer(id, producer, state);
std::shared_ptr<ClipModel> clip(new ClipModel(parent, result.first, binClipId, id));
std::shared_ptr<ClipModel> clip(new ClipModel(parent, result.first, binClipId, id, state, speed));
clip->m_effectStack->importEffects(producer, result.second);
clip->setClipState(state);
parent->registerClip(clip);
......
......@@ -47,7 +47,8 @@ class ClipModel : public MoveableItem<Mlt::Producer>
protected:
/* This constructor is not meant to be called, call the static construct instead */
ClipModel(std::shared_ptr<TimelineModel> parent, std::shared_ptr<Mlt::Producer> prod, const QString &binClipId, int id = -1);
ClipModel(std::shared_ptr<TimelineModel> parent, std::shared_ptr<Mlt::Producer> prod, const QString &binClipId, int id, PlaylistState state,
double speed = 1.);
public:
~ClipModel();
......@@ -160,6 +161,8 @@ protected:
bool forceThumbReload; // Used to trigger a forced thumb reload, when producer changes
PlaylistState m_currentState;
double m_speed = -1; // Speed of the clip
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment