Commit 9afab23a authored by Nicolas Carion's avatar Nicolas Carion

fix project loading with bin effects

parent 81658caa
Pipeline #2365 passed with stage
in 17 minutes and 9 seconds
......@@ -27,10 +27,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "doc/kdenlivedoc.h"
#include "doc/kthumb.h"
#include "effects/effectstack/model/effectstackmodel.hpp"
#include "jobs/audiothumbjob.hpp"
#include "jobs/jobmanager.h"
#include "jobs/loadjob.hpp"
#include "jobs/thumbjob.hpp"
#include "jobs/audiothumbjob.hpp"
#include "kdenlivesettings.h"
#include "lib/audio/audioStreamInfo.h"
#include "mltcontroller/clipcontroller.h"
......@@ -111,11 +111,15 @@ std::shared_ptr<ProjectClip> ProjectClip::construct(const QString &id, const QIc
{
std::shared_ptr<ProjectClip> self(new ProjectClip(id, thumb, model, producer));
baseFinishConstruct(self);
self->m_effectStack->importEffects(producer, PlaylistState::Disabled, true);
model->loadSubClips(id, self->getPropertiesFromPrefix(QStringLiteral("kdenlive:clipzone.")));
return self;
}
void ProjectClip::importEffects(const std::shared_ptr<Mlt::Producer> &producer)
{
m_effectStack->importEffects(producer, PlaylistState::Disabled, true);
}
ProjectClip::ProjectClip(const QString &id, const QDomElement &description, const QIcon &thumb, const std::shared_ptr<ProjectItemModel> &model)
: AbstractProjectItem(AbstractProjectItem::ClipItem, id, model)
, ClipController(id)
......@@ -194,14 +198,14 @@ QString ProjectClip::getXmlProperty(const QDomElement &producer, const QString &
return value;
}
void ProjectClip::updateAudioThumbnail(QList <double>audioLevels)
void ProjectClip::updateAudioThumbnail(QList<double> audioLevels)
{
audioFrameCache = audioLevels;
m_audioThumbCreated = true;
if (auto ptr = m_model.lock()) {
emit std::static_pointer_cast<ProjectItemModel>(ptr)->refreshAudioThumbs(m_binId);
}
qDebug()<<" * ** * YOP AUDIO LEF CHANGED";
qDebug() << " * ** * YOP AUDIO LEF CHANGED";
updateTimelineClips({TimelineModel::AudioLevelsRole});
}
......@@ -547,7 +551,8 @@ std::shared_ptr<Mlt::Producer> ProjectClip::getTimelineProducer(int trackId, int
}
if (qFuzzyCompare(speed, 1.0)) {
// we are requesting a normal speed producer
if (trackId == -1 || (state == PlaylistState::VideoOnly && (m_clipType == ClipType::Color || m_clipType == ClipType::Image || m_clipType == ClipType::Text))) {
if (trackId == -1 ||
(state == PlaylistState::VideoOnly && (m_clipType == ClipType::Color || m_clipType == ClipType::Image || m_clipType == ClipType::Text))) {
// Temporary copy, return clone of master
int duration = m_masterProducer->time_to_frames(m_masterProducer->get("kdenlive:duration"));
return std::shared_ptr<Mlt::Producer>(m_masterProducer->cut(-1, duration > 0 ? duration : -1));
......@@ -939,14 +944,15 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
refreshPanel = true;
}
// Some properties also need to be passed to track producers
QStringList timelineProperties{QStringLiteral("force_aspect_ratio"),
QStringLiteral("set.force_full_luma"), QStringLiteral("full_luma"), QStringLiteral("threads"),
QStringLiteral("force_colorspace"), QStringLiteral("force_tff"), QStringLiteral("force_progressive"),
};
QStringList forceReloadProperties{QStringLiteral("autorotate"), QStringLiteral("templatetext"), QStringLiteral("resource"),
QStringLiteral("force_fps"), QStringLiteral("set.test_image"), QStringLiteral("set.test_audio"), QStringLiteral("audio_index"), QStringLiteral("video_index")};
QStringList timelineProperties{
QStringLiteral("force_aspect_ratio"), QStringLiteral("set.force_full_luma"), QStringLiteral("full_luma"), QStringLiteral("threads"),
QStringLiteral("force_colorspace"), QStringLiteral("force_tff"), QStringLiteral("force_progressive"),
};
QStringList forceReloadProperties{QStringLiteral("autorotate"), QStringLiteral("templatetext"), QStringLiteral("resource"),
QStringLiteral("force_fps"), QStringLiteral("set.test_image"), QStringLiteral("set.test_audio"),
QStringLiteral("audio_index"), QStringLiteral("video_index")};
QStringList keys{QStringLiteral("luma_duration"), QStringLiteral("luma_file"), QStringLiteral("fade"), QStringLiteral("ttl"),
QStringLiteral("softness"), QStringLiteral("crop"), QStringLiteral("animation") };
QStringLiteral("softness"), QStringLiteral("crop"), QStringLiteral("animation")};
QVector<int> updateRoles;
while (i.hasNext()) {
i.next();
......
......@@ -172,7 +172,7 @@ public:
/** Cache for every audio Frame with 10 Bytes */
/** format is frame -> channel ->bytes */
QList <double>audioFrameCache;
QList<double> audioFrameCache;
bool audioThumbCreated() const;
void setWaitingStatus(const QString &id);
......@@ -244,12 +244,15 @@ protected:
public slots:
/* @brief Store the audio thumbnails once computed. Note that the parameter is a value and not a reference, fill free to use it as a sink (use std::move to
* avoid copy). */
void updateAudioThumbnail(QList <double>audioLevels);
void updateAudioThumbnail(QList<double> audioLevels);
/** @brief Extract image thumbnails for timeline. */
void slotExtractImage(const QList<int> &frames);
/** @brief Delete the proxy file */
void deleteProxy();
/** @brief imports effect from a given producer */
void importEffects(const std::shared_ptr<Mlt::Producer> &producer);
private:
/** @brief Generate and store file hash if not available. */
const QString getFileHash();
......
......@@ -647,6 +647,7 @@ bool ProjectItemModel::requestAddBinClip(QString &id, const std::shared_ptr<Mlt:
std::shared_ptr<ProjectClip> new_clip = ProjectClip::construct(id, m_blankThumb, std::static_pointer_cast<ProjectItemModel>(shared_from_this()), producer);
bool res = addItem(new_clip, parentId, undo, redo);
if (res) {
new_clip->importEffects(producer);
int blocking = pCore->jobManager()->getBlockingJobId(id, AbstractClipJob::LOADJOB);
pCore->jobManager()->startJob<ThumbJob>({id}, blocking, QString(), 150, -1, true);
pCore->jobManager()->startJob<AudioThumbJob>({id}, blocking, QString());
......
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