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

Merge branch '2104'

parents 30a98e03 ccc7884b
Pipeline #58148 passed with stage
in 8 minutes and 42 seconds
......@@ -8,7 +8,7 @@ MPEG=qscale=4 ab=192k vcodec=mpeg2video acodec=mp2 threads=%threads;mpg
# proxy settings should be FFmpeg type parameters, like: -vcodec libx264
x264=-vf scale=640:-2 -vcodec libx264 -g 1 -bf 0 -vb 0 -crf 20 -preset veryfast -acodec aac -ab 128k;mov
x264-vaapi=-init_hw_device vaapi=vaapi0:,connection_type=x11 -filter_hw_device vaapi0 -vf format=nv12,hwupload -codec:v h264_vaapi -g 1 -bf 0 -qp 26 -acodec ac3 -ab 128k;mov
x264-nvenc=-hwaccel cuvid -c:v %nvcodec -i -vf scale_npp=640:-2 -vcodec h264_nvenc -g 1 -bf 0 -vb 0 -preset fast -acodec copy;mov
x264-nvenc=-vsync 0 -c:v %nvcodec -resize %frameSize -i -vcodec h264_nvenc -g 1 -bf 0 -acodec copy;mov
MPEG2=-vf scale=640:-2 -g 1 -bf 0 -vb 0 -qscale 6 -ab 128k -vcodec mpeg2video -acodec ac3;mpg
MJPEG=-vf yadif,scale=640:-2 -qscale 3 -vcodec mjpeg -acodec pcm_s16le;mkv
MJPEG-vaapi=-init_hw_device vaapi=vaapi0:,connection_type=x11 -filter_hw_device vaapi0 -vf format=nv12,hwupload -codec:v mjpeg_vaapi -codec:a copy;mkv
......
......@@ -200,17 +200,20 @@ void EffectStackView::setModel(std::shared_ptr<EffectStackModel> model, const QS
m_scrollTimer.start();
connect(m_model.get(), &EffectStackModel::dataChanged, this, &EffectStackView::refresh);
connect(m_model.get(), &EffectStackModel::enabledStateChanged, this, &EffectStackView::changeEnabledState);
connect(m_model.get(), &EffectStackModel::currentChanged, this, [=](QModelIndex ix, bool active) {
m_effectsTree->setCurrentIndex(ix);
auto *w = static_cast<CollapsibleEffectView *>(m_effectsTree->indexWidget(ix));
if (w) {
w->slotActivateEffect(active);
}
});
connect(m_model.get(), &EffectStackModel::currentChanged, this, &EffectStackView::activateEffect, Qt::DirectConnection);
connect(this, &EffectStackView::removeCurrentEffect, m_model.get(), &EffectStackModel::removeCurrentEffect);
// m_builtStack->setModel(model, stackOwner());
}
void EffectStackView::activateEffect(QModelIndex ix, bool active)
{
m_effectsTree->setCurrentIndex(ix);
auto *w = static_cast<CollapsibleEffectView *>(m_effectsTree->indexWidget(ix));
if (w) {
w->slotActivateEffect(active);
}
}
void EffectStackView::changeEnabledState()
{
int max = m_model->rowCount();
......@@ -405,6 +408,7 @@ void EffectStackView::unsetModel(bool reset)
disconnect(m_model.get(), &EffectStackModel::dataChanged, this, &EffectStackView::refresh);
disconnect(m_model.get(), &EffectStackModel::enabledStateChanged, this, &EffectStackView::changeEnabledState);
disconnect(this, &EffectStackView::removeCurrentEffect, m_model.get(), &EffectStackModel::removeCurrentEffect);
disconnect(m_model.get(), &EffectStackModel::currentChanged, this, &EffectStackView::activateEffect);
disconnect(&m_timerHeight, &QTimer::timeout, this, &EffectStackView::updateTreeHeight);
emit pCore->disconnectEffectStack();
}
......
......@@ -111,6 +111,9 @@ private slots:
/** @brief Refresh the enabled state on widgets
*/
void changeEnabledState();
/** @brief Activate an effect in the view
*/
void activateEffect(QModelIndex ix, bool active);
// void switchBuiltStack(bool show);
......
......@@ -100,6 +100,7 @@ bool ProxyJob::startJob()
parameter.prepend(QStringLiteral("-pix_fmt yuv420p"));
}
}
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList params = parameter.split(QLatin1Char('-'), QString::SkipEmptyParts);
#else
......@@ -253,7 +254,25 @@ bool ProxyJob::startJob()
QStringList supportedPixFmts{QStringLiteral("yuv420p"), QStringLiteral("yuyv422"), QStringLiteral("rgb24"),
QStringLiteral("bgr24"), QStringLiteral("yuv422p"), QStringLiteral("yuv444p"),
QStringLiteral("rgb32"), QStringLiteral("yuv410p"), QStringLiteral("yuv411p")};
bool supported = KdenliveSettings::nvScalingEnabled() && supportedCodecs.contains(codec) && supportedPixFmts.contains(pix_fmt);
// Check if the transcoded file uses a cuda supported codec (we don't check for specific cards so not 100% exact)
bool supported = supportedCodecs.contains(codec) && supportedPixFmts.contains(pix_fmt);
if (proxyParams.contains(QStringLiteral("scale_npp")) && !KdenliveSettings::nvScalingEnabled()) {
supported = false;
}
if (proxyParams.contains(QStringLiteral("%frameSize"))) {
int w = 640;
int h = 0;
int oW = binClip->getProducerProperty(QStringLiteral("meta.media.width")).toInt();
int oH = binClip->getProducerProperty(QStringLiteral("meta.media.height")).toInt();
if (oH > 0) {
h = w * oH / oW;
} else {
h = int(w / pCore->getCurrentDar());
}
h += h%2;
proxyParams.replace(QStringLiteral("%frameSize"), QString("%1x%2").arg(w).arg(h));
}
if (supported) {
// Full hardware decoding supported
codec.append(QStringLiteral("_cuvid"));
......
......@@ -325,6 +325,7 @@ bool TimelineFunctions::requestClipCutAll(std::shared_ptr<TimelineItemModel> tim
int TimelineFunctions::requestSpacerStartOperation(const std::shared_ptr<TimelineItemModel> &timeline, int trackId, int position)
{
std::unordered_set<int> clips = timeline->getItemsInRange(trackId, position, -1);
timeline->requestClearSelection();
if (!clips.empty()) {
// Remove grouped items that are before the click position
// First get top groups ids
......@@ -332,16 +333,24 @@ int TimelineFunctions::requestSpacerStartOperation(const std::shared_ptr<Timelin
spacerUngroupedItems.clear();
std::transform(clips.begin(), clips.end(), std::inserter(roots, roots.begin()), [&](int id) { return timeline->m_groups->getRootId(id); });
std::unordered_set<int> groupsToRemove;
int firstCid = -1;
int firstPosition = -1;
for (int r : roots) {
if (timeline->isGroup(r)) {
std::unordered_set<int> leaves = timeline->m_groups->getLeaves(r);
std::unordered_set<int> leavesToRemove;
std::unordered_set<int> leavesToKeep;
for (int l : leaves) {
if (timeline->getItemPosition(l) + timeline->getItemPlaytime(l) < position) {
int pos = timeline->getItemPosition(l);
if (pos + timeline->getItemPlaytime(l) < position) {
leavesToRemove.insert(l);
} else {
leavesToKeep.insert(l);
// Find first item
if (firstPosition == -1 || pos < firstPosition) {
firstCid = l;
firstPosition = pos;
}
}
}
if (leavesToKeep.size() == 1) {
......@@ -370,7 +379,7 @@ int TimelineFunctions::requestSpacerStartOperation(const std::shared_ptr<Timelin
timeline->m_groups->ungroupItem(i.key(), undo, redo);
}
timeline->requestSetSelection(roots);
return (*roots.cbegin());
return (firstCid);
}
return -1;
}
......
......@@ -1750,6 +1750,10 @@ void TimelineController::adjustFade(int cid, const QString &effectId, int durati
}
if (duration <= 0) {
// remove fade
if (initialDuration > 0) {
// Restore original fade duration
m_model->adjustEffectLength(cid, effectId, initialDuration, -1);
}
m_model->removeFade(cid, effectId == QLatin1String("fadein"));
} else {
m_model->adjustEffectLength(cid, effectId, duration, initialDuration);
......@@ -2105,21 +2109,7 @@ void TimelineController::insertSpace(int trackId, int frame)
pCore->displayMessage(i18n("No clips found to insert space"), ErrorMessage, 500);
return;
}
int start = -1;
if (m_model->isGroup(cid)) {
std::unordered_set<int> sub = m_model->m_groups->getLeaves(cid);
cid = *sub.cbegin();
int start = m_model->getItemPosition(cid);
for (int current_id : sub) {
int st = m_model->getItemPosition(current_id);
if (st < start) {
cid = current_id;
start = st;
}
}
} else {
start = m_model->getItemPosition(cid);
}
int start = m_model->getItemPosition(cid);
requestSpacerEndOperation(cid, start, start + spaceDuration, affectAllTracks ? -1 : trackId);
}
......
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