Commit db7334c0 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Add basic support for blipflash producer in case we run the tests on a system...

Add basic support for blipflash producer in case we run the tests on a system without avformat producer support
parent 6870405d
......@@ -521,9 +521,13 @@ std::shared_ptr<Mlt::Producer> ProjectClip::getTimelineProducer(int clipId, Play
}
if (!warpProducer) {
QLocale locale;
QString resource = QString("timewarp:%1:%2").arg(locale.toString(speed)).arg(originalProducer()->get("resource"));
warpProducer.reset(new Mlt::Producer(*originalProducer()->profile(), resource.toUtf8().constData()));
qDebug() << "new producer!";
QString resource(originalProducer()->get("resource"));
if (resource.isEmpty() || resource == QLatin1String("<producer>")) {
resource = m_service;
}
QString url = QString("timewarp:%1:%2").arg(locale.toString(speed)).arg(resource);
warpProducer.reset(new Mlt::Producer(*originalProducer()->profile(), url.toUtf8().constData()));
qDebug() << "new producer: "<<url;
qDebug() << "warp LENGTH before" << warpProducer->get_length();
int original_length = originalProducer()->get_length();
// this is a workaround to cope with Mlt erroneous rounding
......
......@@ -115,7 +115,7 @@ AudioEnvelope::AudioSummary AudioEnvelope::loadAndNormalizeEnvelope() const {
summary.amplitudeMax = 0;
for (int i = 0; i < summary.audioAmplitudes.size(); ++i) {
summary.audioAmplitudes[i] -= meanBeforeNormalization;
summary.amplitudeMax = std::max(summary.amplitudeMax, abs(summary.audioAmplitudes[i]));
summary.amplitudeMax = std::max(summary.amplitudeMax, qAbs(summary.audioAmplitudes[i]));
}
return summary;
}
......
......@@ -218,6 +218,10 @@ void ClipController::getInfoForProducer()
m_clipType = ClipType::WebVfx;
} else if (m_service == QLatin1String("qtext")) {
m_clipType = ClipType::QText;
} else if (m_service == QLatin1String("blipflash")) {
// Mostly used for testing
m_clipType = ClipType::AV;
m_hasLimitedDuration = true;
} else {
m_clipType = ClipType::Unknown;
}
......
......@@ -381,6 +381,7 @@ bool ClipModel::useTimewarpProducer(double speed, Fun &undo, Fun &redo)
{
if (m_endlessResize) {
// no timewarp for endless producers
qDebug()<<"* ** * ERROR ON RESIZE LIMIT";
return false;
}
if (qFuzzyCompare(speed, m_speed)) {
......@@ -410,6 +411,7 @@ bool ClipModel::useTimewarpProducer(double speed, Fun &undo, Fun &redo)
UPDATE_UNDO_REDO(operation, reverse, local_undo, local_redo);
bool res = requestResize(newDuration, true, local_undo, local_redo, true);
if (!res) {
qDebug()<<"* ** * ERROR ON RESIZE 1";
local_undo();
return false;
}
......
......@@ -23,9 +23,12 @@ QString createProducer(Mlt::Profile &prof, std::string color, std::shared_ptr<Pr
QString createProducerWithSound(Mlt::Profile &prof, std::shared_ptr<ProjectItemModel> binModel)
{
std::shared_ptr<Mlt::Producer> producer = std::make_shared<Mlt::Producer>(prof, QFileInfo("../tests/small.mkv").absoluteFilePath().toStdString().c_str());
/*std::shared_ptr<Mlt::Producer> producer = std::make_shared<Mlt::Producer>(prof, "blipflash");
/*
// In case the test system does not have avformat support, we can switch to the integrated blipflash producer
std::shared_ptr<Mlt::Producer> producer = std::make_shared<Mlt::Producer>(prof, "blipflash");
producer->set_in_and_out(0, 1);
producer->set("length", 1);*/
producer->set("kdenlive:duration", 2);
*/
REQUIRE(producer->is_valid());
......
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