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

Merge branch '2008'

parents 78e4acad 031ab015
Pipeline #27131 passed with stage
in 10 minutes and 37 seconds
......@@ -88,8 +88,14 @@ QString ClipCreator::createColorClip(const QString &color, int duration, const Q
QDomDocument ClipCreator::getXmlFromUrl(const QString &path)
{
QDomDocument xml;
QUrl fileUrl = QUrl::fromLocalFile(path);
if (fileUrl.matches(pCore->currentDoc()->url(), QUrl::RemoveScheme | QUrl::NormalizePathSegments)) {
// Cannot embed a project in itself
KMessageBox::sorry(QApplication::activeWindow(), i18n("You cannot add a project inside itself."), i18n("Cannot create clip"));
return xml;
}
QMimeDatabase db;
QMimeType type = db.mimeTypeForUrl(QUrl::fromLocalFile(path));
QMimeType type = db.mimeTypeForUrl(fileUrl);
QDomElement prod;
qDebug()<<"=== GOT DROPPPED MIME: "<<type.name();
......
......@@ -361,7 +361,7 @@ bool MltDeviceCapture::slotStartCapture(const QString &params, const QString &pa
auto *renderProps = new Mlt::Properties;
renderProps->set("mlt_service", "avformat");
renderProps->set("target", path.toUtf8().constData());
renderProps->set("real_time", -KdenliveSettings::mltthreads());
renderProps->set("real_time", -1);
renderProps->set("terminate_on_pause", 0); // was commented out. restoring it fixes mantis#3415 - FFmpeg recording freezes
// without this line a call to mlt_properties_get_int(terminate on pause) for in mlt/src/modules/core/consumer_multi.c is returning 1
// and going into and endless loop.
......
......@@ -122,8 +122,6 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QMap<QString, QString> mappable_a
m_configEnv.ffmpegurl->lineEdit()->setObjectName(QStringLiteral("kcfg_ffmpegpath"));
m_configEnv.ffplayurl->lineEdit()->setObjectName(QStringLiteral("kcfg_ffplaypath"));
m_configEnv.ffprobeurl->lineEdit()->setObjectName(QStringLiteral("kcfg_ffprobepath"));
int maxThreads = QThread::idealThreadCount();
m_configEnv.kcfg_mltthreads->setMaximum(maxThreads > 2 ? maxThreads : 8);
m_configEnv.tmppathurl->setMode(KFile::Directory);
m_configEnv.tmppathurl->lineEdit()->setObjectName(QStringLiteral("kcfg_currenttmpfolder"));
m_configEnv.capturefolderurl->setMode(KFile::Directory);
......
......@@ -146,7 +146,7 @@ bool MeltJob::startJob()
}
/*
if (!m_consumerParams.contains(QStringLiteral("real_time"))) {
m_consumer->set("real_time", -KdenliveSettings::mltthreads());
m_consumer->set("real_time", -1);
}
*/
......
......@@ -54,7 +54,7 @@ void SceneSplitJob::configureConsumer()
m_consumer = std::make_unique<Mlt::Consumer>(*m_profile.get(), "null");
m_consumer->set("all", 1);
m_consumer->set("terminate_on_pause", 1);
m_consumer->set("real_time", -KdenliveSettings::mltthreads());
m_consumer->set("real_time", -1);
// We just want to find scene change, set all methods to the fastests
m_consumer->set("rescale", "nearest");
m_consumer->set("deinterlace_method", "onefield");
......
......@@ -62,7 +62,7 @@ void SpeedJob::configureConsumer()
m_consumer = std::make_unique<Mlt::Consumer>(*m_profile.get(), "xml", m_destUrl.toUtf8().constData());
m_consumer->set("terminate_on_pause", 1);
m_consumer->set("title", "Speed Change");
m_consumer->set("real_time", -KdenliveSettings::mltthreads());
m_consumer->set("real_time", -1);
}
void SpeedJob::configureProducer()
......
......@@ -53,7 +53,7 @@ void StabilizeJob::configureConsumer()
m_consumer = std::make_unique<Mlt::Consumer>(*m_profile.get(), "xml", m_destUrl.toUtf8().constData());
m_consumer->set("all", 1);
m_consumer->set("title", "Stabilized");
m_consumer->set("real_time", -KdenliveSettings::mltthreads());
m_consumer->set("real_time", -1);
}
void StabilizeJob::configureFilter()
......
......@@ -1135,7 +1135,7 @@ int GLWidget::reconfigure()
// m_producer->set_speed(0.0);
}
int dropFrames = realTime();
int dropFrames = 1;
if (!KdenliveSettings::monitor_dropframes()) {
dropFrames = -dropFrames;
}
......@@ -1332,15 +1332,6 @@ void GLWidget::setOffsetY(int y, int max)
update();
}
int GLWidget::realTime() const
{
// C & D
if (m_glslManager) {
return 1;
}
return KdenliveSettings::mltthreads();
}
std::shared_ptr<Mlt::Consumer> GLWidget::consumer()
{
return m_consumer;
......@@ -1778,7 +1769,7 @@ void GLWidget::setDropFrames(bool drop)
// why this lock?
QMutexLocker locker(&m_mltMutex);
if (m_consumer) {
int dropFrames = realTime();
int dropFrames = 1;
if (!drop) {
dropFrames = -dropFrames;
}
......
......@@ -112,7 +112,6 @@ public:
void resetConsumer(bool fullReset);
void lockMonitor();
void releaseMonitor();
int realTime() const;
int droppedFrames() const;
void resetDrops();
bool checkFrameNumber(int pos, int offset, bool isPlaying);
......
......@@ -95,7 +95,7 @@ QModelIndex TimelineItemModel::index(int row, int column, const QModelIndex &par
// Invalid index requested
Q_ASSERT(false);
}
} else if (row < getTracksCount() && row >= 0) {
} else if (row < (int)m_allTracks.size() && row >= 0) {
// Get sort order
// row = getTracksCount() - 1 - row;
auto it = m_allTracks.cbegin();
......@@ -176,7 +176,7 @@ int TimelineItemModel::rowCount(const QModelIndex &parent) const
}
return getTrackClipsCount(id) + getTrackCompositionsCount(id);
}
return getTracksCount();
return (int)m_allTracks.size();
}
int TimelineItemModel::columnCount(const QModelIndex &parent) const
......
......@@ -2474,7 +2474,7 @@ bool TimelineModel::requestTrackInsertion(int position, int &id, const QString &
emit dataChanged(ix, ix, {TimelineModel::TrackTagRole});
}
} else {
for (int i = position; i < getTracksCount(); i++) {
for (int i = position; i < (int)m_allTracks.size(); i++) {
QModelIndex ix = makeTrackIndexFromID(getTrackIndexFromPosition(i));
emit dataChanged(ix, ix, {TimelineModel::TrackTagRole});
}
......@@ -2658,11 +2658,11 @@ void TimelineModel::registerTrack(std::shared_ptr<TrackModel> track, int pos, bo
// we now insert in the list
auto posIt = m_allTracks.begin();
std::advance(posIt, pos);
beginInsertRows(QModelIndex(), pos, pos);
auto it = m_allTracks.insert(posIt, std::move(track));
// it now contains the iterator to the inserted element, we store it
Q_ASSERT(m_iteratorTable.count(id) == 0); // check that id is not used (shouldn't happen)
m_iteratorTable[id] = it;
beginInsertRows(QModelIndex(), pos, pos);
endInsertRows();
int cache = (int)QThread::idealThreadCount() + ((int)m_allTracks.size() + 1) * 2;
mlt_service_cache_set_size(NULL, "producer_avformat", qMax(4, cache));
......
......@@ -1032,7 +1032,7 @@ Rectangle {
border.width: 1
border.color: root.frameColor
height: model.trackHeight
color: tracksRepeater.itemAt(index) ? ((tracksRepeater.itemAt(index).trackInternalId === timeline.activeTrack) ? Qt.tint(getTrackColor(tracksRepeater.itemAt(index).isAudio, false), selectedTrackColor) : getTrackColor(tracksRepeater.itemAt(index).isAudio, false)) : 'red'
color: (model.item == timeline.activeTrack) ? Qt.tint(getTrackColor(model.audio, false), selectedTrackColor) : getTrackColor(model.audio, false)
}
}
}
......
......@@ -3392,13 +3392,14 @@ void TimelineController::finishRecording(const QString &recordedFile)
if (m_recordTrack == -1) {
return;
}
std::shared_ptr<ProjectClip> clip = pCore->bin()->getBinClip(binId);
if (!clip) {
return;
}
pCore->bin()->selectClipById(binId);
qDebug() << "callback " << binId << " " << m_recordTrack << ", MAXIMUM SPACE: " << m_recordStart.second;
if (m_recordStart.second > 0) {
// Limited space on track
std::shared_ptr<ProjectClip> clip = pCore->bin()->getBinClip(binId);
if (!clip) {
return;
}
int out = qMin((int)clip->frameDuration() - 1, m_recordStart.second - 1);
QString binClipId = QString("%1/%2/%3").arg(binId).arg(0).arg(out);
m_model->requestClipInsertion(binClipId, m_recordTrack, m_recordStart.first, id, true, true, false);
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>566</width>
<height>441</height>
<width>514</width>
<height>379</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
......@@ -27,51 +27,38 @@
<string>MLT environment</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="1" colspan="3">
<item row="0" column="1" colspan="2">
<widget class="KUrlRequester" name="ffmpegurl"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Processing threads</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="KUrlRequester" name="ffplayurl"/>
</item>
<item row="4" column="1" colspan="3">
<widget class="KUrlRequester" name="rendererpathurl"/>
</item>
<item row="5" column="3">
<widget class="QLabel" name="label_7">
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>(&gt;1 is experimental)</string>
<string>MLT profiles folder</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Melt path</string>
<string>FFmpeg</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<item row="2" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>FFmpeg</string>
<string>FFprobe</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label">
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>MLT profiles folder</string>
<string>Melt path</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="5" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -84,9 +71,6 @@
</property>
</spacer>
</item>
<item row="3" column="1" colspan="3">
<widget class="KUrlRequester" name="mltpathurl"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
......@@ -94,27 +78,16 @@
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QSpinBox" name="kcfg_mltthreads">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
<item row="1" column="1" colspan="2">
<widget class="KUrlRequester" name="ffplayurl"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>FFprobe</string>
</property>
</widget>
<item row="3" column="1" colspan="2">
<widget class="KUrlRequester" name="mltpathurl"/>
</item>
<item row="4" column="1" colspan="2">
<widget class="KUrlRequester" name="rendererpathurl"/>
</item>
<item row="2" column="1" colspan="3">
<item row="2" column="1" colspan="2">
<widget class="KUrlRequester" name="ffprobeurl"/>
</item>
</layout>
......
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