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

Timeremap should only be available on clips without B frames. Propose transcoding otherwise

parent 5d121549
Pipeline #124282 passed with stage
in 8 minutes and 41 seconds
......@@ -4851,7 +4851,15 @@ void Bin::requestTranscoding(const QString &url, const QString &id, bool checkPr
}
});
}
m_transcodingDialog->addUrl(url, id);
if (url.isEmpty()) {
std::shared_ptr<ProjectClip> clip = m_itemModel->getClipByBinID(id);
if (clip) {
QString resource = clip->clipUrl();
m_transcodingDialog->addUrl(resource, id);
}
} else {
m_transcodingDialog->addUrl(url, id);
}
m_transcodingDialog->show();
}
......
......@@ -1520,7 +1520,13 @@ TimeRemap::TimeRemap(QWidget *parent)
{
setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
setupUi(this);
warningMessage->hide();
QAction *ac = new QAction(i18n("Transcode"), this);
warningMessage->addAction(ac);
connect(ac, &QAction::triggered, this, [&]() {
QMetaObject::invokeMethod(pCore->bin(), "requestTranscoding", Qt::QueuedConnection, Q_ARG(QString, QString()), Q_ARG(QString, m_binId), Q_ARG(bool, false));
});
m_in = new TimecodeDisplay(pCore->timecode(), this);
inLayout->addWidget(m_in);
m_out = new TimecodeDisplay(pCore->timecode(), this);
......@@ -1601,7 +1607,7 @@ TimeRemap::TimeRemap(QWidget *parent)
m_out->setRange(0, INT_MAX);
//m_in->setRange(0, duration - 1);
});
setEnabled(false);
remap_box->setEnabled(false);
}
const QString &TimeRemap::currentClip() const
......@@ -1641,29 +1647,41 @@ void TimeRemap::checkClipUpdate(const QModelIndex &topLeft, const QModelIndex &,
void TimeRemap::selectedClip(int cid)
{
if (cid == -1 && cid == m_cid) {
warningMessage->hide();
return;
}
QObject::disconnect( m_seekConnection1 );
QObject::disconnect( m_seekConnection2 );
QObject::disconnect( m_seekConnection3 );
connect(pCore->getMonitor(Kdenlive::ClipMonitor), &Monitor::seekRemap, m_view, &RemapView::slotSetPosition, Qt::UniqueConnection);
m_cid = cid;
std::shared_ptr<TimelineItemModel> model = pCore->window()->getCurrentTimeline()->controller()->getModel();
disconnect(model.get(), &TimelineItemModel::dataChanged, this, &TimeRemap::checkClipUpdate);
if (cid == -1) {
m_binId.clear();
m_view->setDuration(nullptr, -1);
setEnabled(false);
remap_box->setEnabled(false);
return;
}
m_binId = model->getClipBinId(cid);
std::shared_ptr<Mlt::Producer> prod = model->getClipProducer(cid);
// Check for B Frames and warn
if (prod->parent().get_int("meta.media.has_b_frames") == 1) {
m_view->setDuration(nullptr, -1);
remap_box->setEnabled(false);
warningMessage->setText(i18n("Time remap does not work on clip with B frames."));
warningMessage->animatedShow();
return;
} else {
warningMessage->hide();
remap_box->setEnabled(true);
}
m_view->m_remapLink.reset();
connect(model.get(), &TimelineItemModel::dataChanged, this, &TimeRemap::checkClipUpdate);
model->requestClipTimeRemap(cid);
m_splitId = model->m_groups->getSplitPartner(cid);
m_binId = model->getClipBinId(cid);
m_lastLength = pCore->getItemDuration({ObjectType::TimelineClip,cid});
m_view->m_startPos = pCore->getItemPosition({ObjectType::TimelineClip,cid});
std::shared_ptr<Mlt::Producer> prod = model->getClipProducer(cid);
model->requestClipTimeRemap(cid);
m_cid = cid;
connect(model.get(), &TimelineItemModel::dataChanged, this, &TimeRemap::checkClipUpdate);
m_view->m_maxLength = prod->get_length();
m_in->setRange(0, m_view->m_maxLength - prod->get_in());
//m_in->setRange(0, m_lastLength - 1);
......@@ -1705,7 +1723,7 @@ void TimeRemap::selectedClip(int cid)
QSignalBlocker bk2(frame_blending);
pitch_compensate->setChecked(fromLink->get_int("pitch") == 1);
frame_blending->setChecked(fromLink->get("image_mode") != QLatin1String("nearest"));
setEnabled(true);
remap_box->setEnabled(true);
break;
}
}
......@@ -1747,7 +1765,7 @@ void TimeRemap::setClip(std::shared_ptr<ProjectClip> clip, int in, int out)
m_binId.clear();
if (clip == nullptr || !clip->statusReady() || clip->clipType() != ClipType::Playlist) {
m_view->setDuration(nullptr, -1);
setEnabled(false);
remap_box->setEnabled(false);
return;
}
m_view->m_remapLink.reset();
......@@ -1828,9 +1846,9 @@ void TimeRemap::setClip(std::shared_ptr<ProjectClip> clip, int in, int out)
m_seekConnection2 = connect(pCore->getMonitor(Kdenlive::ClipMonitor), &Monitor::seekPosition, this, [&](int pos) {
m_view->slotSetPosition(pos);
});
setEnabled(m_view->m_remapLink != nullptr);
remap_box->setEnabled(m_view->m_remapLink != nullptr);
} else {
setEnabled(false);
remap_box->setEnabled(false);
}
}
......
......@@ -6,36 +6,51 @@
<rect>
<x>0</x>
<y>0</y>
<width>342</width>
<height>264</height>
<width>398</width>
<height>379</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="verticalSpacing">
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<item row="6" column="1" colspan="3">
<widget class="QCheckBox" name="frame_blending">
<property name="text">
<string>Frame blending</string>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="KMessageWidget" name="warningMessage">
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="closeButtonVisible">
<bool>false</bool>
</property>
<property name="messageType">
<enum>KMessageWidget::Warning</enum>
</property>
</widget>
</item>
<item row="4" column="0" colspan="4">
<widget class="QFrame" name="info_frame">
<item row="1" column="0">
<widget class="QFrame" name="remap_box">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
......@@ -48,77 +63,282 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Source time</string>
<string>Source clip</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="inLayout"/>
<widget class="QToolButton" name="button_center_top">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="align-horizontal-center">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item row="1" column="0">
<layout class="QVBoxLayout" name="remapLayout"/>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Output time</string>
<string>Output</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="outLayout"/>
<widget class="QToolButton" name="button_center">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="align-horizontal-center">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_3">
<widget class="QToolButton" name="button_prev">
<property name="text">
<string>Speed before</string>
<string>...</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="speedBefore">
<property name="minimum">
<double>-100000.000000000000000</double>
<widget class="QToolButton" name="button_add">
<property name="text">
<string>...</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</widget>
</item>
<item>
<widget class="QToolButton" name="button_next">
<property name="text">
<string>...</string>
</property>
<property name="value">
<double>100.000000000000000</double>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>28</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item row="4" column="0">
<widget class="QFrame" name="info_frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Source time</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="inLayout"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Output time</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="outLayout"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>Speed before</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="speedBefore">
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
<property name="value">
<double>100.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>After</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="speedAfter">
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
<property name="value">
<double>100.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<widget class="QLabel" name="label_4">
<widget class="QCheckBox" name="pitch_compensate">
<property name="text">
<string>After</string>
<string>Pitch compensation</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="speedAfter">
<property name="minimum">
<double>-100000.000000000000000</double>
<widget class="QCheckBox" name="frame_blending">
<property name="text">
<string>Frame blending</string>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</widget>
</item>
</layout>
</item>
<item row="7" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_14">
<item>
<widget class="QCheckBox" name="move_next">
<property name="text">
<string>Preserve speed of next keyframes</string>
</property>
<property name="value">
<double>100.000000000000000</double>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="button_del">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="edit-delete">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
......@@ -127,160 +347,15 @@
</layout>
</widget>
</item>
<item row="2" column="1">
<widget class="QToolButton" name="button_center">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="align-horizontal-center">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<layout class="QVBoxLayout" name="remapLayout"/>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="pitch_compensate">
<property name="text">
<string>Pitch compensation</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QToolButton" name="button_del">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="edit-delete">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Source clip</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QToolButton" name="button_prev">
<property name="text">
<string>...</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="button_add">
<property name="text">
<string>...</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="button_next">
<property name="text">
<string>...</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>28</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Output</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="move_next">
<property name="text">
<string>Preserve speed of next keyframes</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>