From: Jean-Baptiste Mardelle Date: Mon, 5 Nov 2012 10:58:06 +0000 (+0100) Subject: Allow to analyse only a zone of a clip X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=8e035c977776259f445bed1cbc688a17caba1d67;p=kdenlive Allow to analyse only a zone of a clip --- diff --git a/src/projectlist.cpp b/src/projectlist.cpp index 231e6e4f..42a93190 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -3516,6 +3516,10 @@ void ProjectList::startClipFilterJob(const QString &filterName, const QString &c extraParams.insert("projecttreefilter", "1"); QString keyword("%count"); extraParams.insert("resultmessage", i18n("Found %1 scenes.", keyword)); + if (ui.zone_only->isChecked()) { + // We want to create markers + extraParams.insert("zoneonly", "1"); + } if (ui.add_markers->isChecked()) { // We want to create markers extraParams.insert("addmarkers", QString::number(ui.marker_type->currentIndex())); @@ -3556,6 +3560,13 @@ void ProjectList::processClipJob(QStringList ids, const QString&destination, boo ProjectItem *item = getItemById(id); if (!item) continue; QStringList jobArgs; + if (extraParams.contains("zoneonly")) { + // Analyse clip zone only, remove in / out and replace with zone + preParams.takeFirst(); + preParams.takeFirst(); + QPoint zone = item->referencedClip()->zone(); + jobArgs << QString::number(zone.x()) << QString::number(zone.y()); + } jobArgs << preParams; if (ids.count() == 1) { jobArgs << consumer + ':' + destination; @@ -3647,6 +3658,7 @@ void ProjectList::slotGotFilterJobResults(QString id, int , int , stringMap resu } bool dataProcessed = false; QString key = filterInfo.value("key"); + int offset = filterInfo.value("offset").toInt(); QStringList value = results.value(key).split(';', QString::SkipEmptyParts); kDebug()<<"// RESULT; "<childCount() == 0) @@ -3686,7 +3698,7 @@ void ProjectList::slotGotFilterJobResults(QString id, int , int , stringMap resu int newPos = pos.section("=", 0, 0).toInt(); // Don't use scenes shorter than 1 second if (newPos - cutPos < 24) continue; - CommentedTime m(GenTime(newPos, m_fps), QString::number(index), markersType); + CommentedTime m(GenTime(newPos + offset, m_fps), QString::number(index), markersType); markersList << m; index++; cutPos = newPos; diff --git a/src/projecttree/meltjob.cpp b/src/projecttree/meltjob.cpp index 55926077..1bc16c69 100644 --- a/src/projecttree/meltjob.cpp +++ b/src/projecttree/meltjob.cpp @@ -67,6 +67,7 @@ void MeltJob::startJob() return; } int in = m_params.takeFirst().toInt(); + if (in > 0 && !m_extra.contains("offset")) m_extra.insert("offset", QString::number(in)); int out = m_params.takeFirst().toInt(); QString producerParams =m_params.takeFirst(); QString filter = m_params.takeFirst(); @@ -97,11 +98,13 @@ void MeltJob::startJob() } if (out == -1) { prod = new Mlt::Producer(*m_profile, m_url.toUtf8().constData()); + m_length = prod->get_length(); } else { Mlt::Producer *tmp = new Mlt::Producer(*m_profile, m_url.toUtf8().constData()); prod = tmp->cut(in, out); delete tmp; + m_length = prod->get_playtime(); } if (m_extra.contains("producer_profile")) { m_profile->from_producer(*prod); @@ -150,7 +153,6 @@ void MeltJob::startJob() Mlt::Playlist playlist; playlist.append(*prod); tractor.set_track(playlist, 0); - m_length = prod->get_length(); m_consumer->connect(tractor); prod->set_speed(0); prod->seek(0); diff --git a/src/widgets/scenecutdialog_ui.ui b/src/widgets/scenecutdialog_ui.ui index 462ff597..371acaf4 100644 --- a/src/widgets/scenecutdialog_ui.ui +++ b/src/widgets/scenecutdialog_ui.ui @@ -6,36 +6,16 @@ 0 0 - 352 - 90 + 282 + 115 Scene Cut - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - Qt::Vertical - - - - 218 - 2 - - - + + @@ -47,8 +27,22 @@ - - + + + + Analyse only selected zone + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + @@ -57,6 +51,19 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + +