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

Refactor rendering timecode overlay feature.

Fixes #815
parent b65689cb
Pipeline #38185 passed with stage
in 32 minutes and 3 seconds
......@@ -12,7 +12,6 @@ install(FILES
banner.png
encodingprofiles.rc
externalproxies.rc
metadata.properties
meta_ffmpeg.png
meta_libav.png
meta_magiclantern.png
......
# data_show filters
timecode=region
.description=TimecodeOSD
.properties.markup=filter[1].producer.text
.composite.geometry=10/10:150x30
.filter[0]=watermark
.filter[0].resource=colour:0x000000A0
.filter[0].composite.titles=1
.filter[1]=watermark
.filter[1].resource=pango:
.filter[1].producer.text=
.filter[1].producer.family=Monospace
.filter[1].producer.size=24
.filter[1].composite.titles=1
.filter[1].composite.halign=right
......@@ -221,6 +221,9 @@ RenderWidget::RenderWidget(bool enableProxy, QWidget *parent)
m_view.open_browser->setVisible(false);
m_view.error_box->setVisible(false);
m_view.tc_type->setEnabled(false);
m_view.tc_type->addItem(i18n("Timecode"), QStringLiteral("#timecode#"));
m_view.tc_type->addItem(i18n("Timecode non drop frame"), QStringLiteral("#smtpe_ndf#"));
m_view.tc_type->addItem(i18n("Frame number"), QStringLiteral("#frame#"));
m_view.checkTwoPass->setEnabled(false);
m_view.proxy_render->setHidden(!enableProxy);
connect(m_view.proxy_render, &QCheckBox::toggled, this, &RenderWidget::slotProxyWarn);
......@@ -1216,8 +1219,12 @@ void RenderWidget::prepareRendering(bool delayedRendering, const QString &chapte
} else {
out = pCore->projectDuration() - 1;
}
QString overlayData;
if (m_view.tc_overlay->checkState() == Qt::Checked) {
overlayData = m_view.tc_type->currentData().toString();
}
QString playlistContent = pCore->projectManager()->projectSceneList(project->url().adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash).toLocalFile());
QString playlistContent = pCore->projectManager()->projectSceneList(project->url().adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash).toLocalFile(), overlayData);
if (!chapterFile.isEmpty()) {
QDomDocument doc;
QDomElement chapters = doc.createElement(QStringLiteral("chapters"));
......
......@@ -1349,7 +1349,7 @@ void GLWidget::resetConsumer(bool fullReset)
reconfigure();
}
const QString GLWidget::sceneList(const QString &root, const QString &fullPath)
const QString GLWidget::sceneList(const QString &root, const QString &fullPath, QString filterData)
{
LocaleHandling::resetLocale();
QString playlist;
......@@ -1367,8 +1367,18 @@ const QString GLWidget::sceneList(const QString &root, const QString &fullPath)
// And we must use "avformat" instead of "avformat-novalidate" on project loading which causes a big delay on project opening
// xmlConsumer.set("no_meta", 1);
Mlt::Service s(m_producer->get_service());
std::unique_ptr<Mlt::Filter> filter = nullptr;
if (!filterData.isEmpty()) {
filter.reset(new Mlt::Filter (pCore->getCurrentProfile()->profile(), QString("dynamictext:%1").arg(filterData).toUtf8().constData()));
filter->set("fgcolour", "#ffffff");
filter->set("bgcolour", "#bb333333");
s.attach(*filter.get());
}
xmlConsumer.connect(s);
xmlConsumer.run();
if (filter) {
s.detach(*filter.get());
}
playlist = fullPath.isEmpty() ? QString::fromUtf8(xmlConsumer.get("kdenlive_playlist")) : fullPath;
return playlist;
}
......
......@@ -89,7 +89,7 @@ public:
int reconfigure();
/** @brief Get the current MLT producer playlist.
* @return A string describing the playlist */
const QString sceneList(const QString &root, const QString &fullPath = QString());
const QString sceneList(const QString &root, const QString &fullPath = QString(), QString filterData = QString());
int displayWidth() const { return m_rect.width(); }
void updateAudioForAnalysis();
......
......@@ -1694,9 +1694,9 @@ void Monitor::resetConsumer(bool fullReset)
m_glMonitor->resetConsumer(fullReset);
}
const QString Monitor::sceneList(const QString &root, const QString &fullPath)
const QString Monitor::sceneList(const QString &root, const QString &fullPath, const QString overlayData)
{
return m_glMonitor->sceneList(root, fullPath);
return m_glMonitor->sceneList(root, fullPath, overlayData);
}
void Monitor::updateClipZone(const QPoint zone)
......
......@@ -94,7 +94,7 @@ public:
void resetConsumer(bool fullReset);
void setCustomProfile(const QString &profile, const Timecode &tc);
void setupMenu(QMenu *goMenu, QMenu *overlayMenu, QAction *playZone, QAction *loopZone, QMenu *markerMenu = nullptr, QAction *loopClip = nullptr);
const QString sceneList(const QString &root, const QString &fullPath = QString());
const QString sceneList(const QString &root, const QString &fullPath = QString(), const QString overlayData = QString());
const QString activeClipId();
int position();
void updateTimecodeFormat();
......
......@@ -690,7 +690,7 @@ void ProjectManager::slotAutoSave()
m_lastSave.start();
}
QString ProjectManager::projectSceneList(const QString &outputFolder)
QString ProjectManager::projectSceneList(const QString &outputFolder, const QString overlayData)
{
// Disable multitrack view and overlay
bool isMultiTrack = pCore->monitorManager()->isMultiTrack();
......@@ -702,7 +702,7 @@ QString ProjectManager::projectSceneList(const QString &outputFolder)
pCore->window()->getMainTimeline()->controller()->updatePreviewConnection(false);
}
pCore->mixer()->pauseMonitoring(true);
QString scene = pCore->monitorManager()->projectMonitor()->sceneList(outputFolder);
QString scene = pCore->monitorManager()->projectMonitor()->sceneList(outputFolder, QString(), overlayData);
pCore->mixer()->pauseMonitoring(false);
if (isMultiTrack) {
pCore->window()->getMainTimeline()->controller()->slotMultitrackView(true, false);
......
......@@ -65,7 +65,7 @@ public:
/** @brief Disable all bin effects in current project */
void disableBinEffects(bool disable);
/** @brief Returns current project's xml scene */
QString projectSceneList(const QString &outputFolder);
QString projectSceneList(const QString &outputFolder, const QString overlayData = QString());
/** @brief returns a default hd profile depending on timezone*/
static QString getDefaultProjectFormat();
void saveZone(const QStringList &info, const QDir &dir);
......
......@@ -707,18 +707,7 @@
</widget>
</item>
<item>
<widget class="KComboBox" name="tc_type">
<item>
<property name="text">
<string>hh:mm:ss:ff</string>
</property>
</item>
<item>
<property name="text">
<string>Frames</string>
</property>
</item>
</widget>
<widget class="KComboBox" name="tc_type"/>
</item>
<item>
<spacer name="overlaySpace">
......
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