Fix monitor gamma to use the project profile

This commit is contained in:
Jean-Baptiste Mardelle
2025-11-30 17:52:35 +01:00
parent 2b6bfa77f4
commit f0e82e8f5f
5 changed files with 19 additions and 26 deletions

View File

@@ -597,11 +597,6 @@
<default>true</default>
</entry>
<entry name="monitor_gamma" type="Int">
<label>Monitor gamma (rbg / rec 709).</label>
<default>1</default>
</entry>
<entry name="external_display" type="Bool">
<label>Use Blackmagic device for video out.</label>
<default>false</default>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="kdenlive" version="240" translationDomain="kdenlive">
<kpartgui name="kdenlive" version="241" translationDomain="kdenlive">
<MenuBar>
<Menu name="file">
<Action name="file_new"/>
@@ -291,7 +291,6 @@
<Action name="mlt_interlace"/>
<Action name="mlt_progressive"/>
<Action name="mlt_interpolation"/>
<Action name="mlt_gamma"/>
<Action name="mlt_realtime"/>
<Action name="mlt_scrub"/>
<Action name="mlt_mute"/>

View File

@@ -1787,14 +1787,6 @@ void MainWindow::setupActions()
addAction(QStringLiteral("mlt_realtime"), dropFrames);
connect(dropFrames, &QAction::toggled, this, &MainWindow::slotSwitchDropFrames);
KSelectAction *monitorGamma = new KSelectAction(i18n("Monitor Gamma"), this);
monitorGamma->addAction(i18n("sRGB (computer)"));
monitorGamma->addAction(i18n("Rec. 709 (TV)"));
addAction(QStringLiteral("mlt_gamma"), monitorGamma, {}, QStringLiteral("monitor"));
monitorGamma->setCurrentItem(KdenliveSettings::monitor_gamma());
connect(monitorGamma, &KSelectAction::indexTriggered, this, &MainWindow::slotSetMonitorGamma);
actionCollection()->setShortcutsConfigurable(monitorGamma, false);
QAction *insertBinZone = addAction(QStringLiteral("insert_project_tree"), i18n("Insert Zone in Project Bin"), this, SLOT(slotInsertZoneToTree()),
QIcon::fromTheme(QStringLiteral("kdenlive-add-clip")), Qt::CTRL | Qt::Key_I);
insertBinZone->setWhatsThis(xi18nc("@info:whatsthis", "Creates a new clip in the project bin from the defined zone."));
@@ -4447,13 +4439,6 @@ void MainWindow::slotSwitchDropFrames(bool drop)
m_projectMonitor->restart();
}
void MainWindow::slotSetMonitorGamma(int gamma)
{
KdenliveSettings::setMonitor_gamma(gamma);
m_clipMonitor->restart();
m_projectMonitor->restart();
}
void MainWindow::slotInsertZoneToTree()
{
if (!m_clipMonitor->isActive() || m_clipMonitor->currentController() == nullptr) {

View File

@@ -589,7 +589,6 @@ private Q_SLOTS:
void slotSwitchMonitors();
void slotSwitchMonitorOverlay(QAction *);
void slotSwitchDropFrames(bool drop);
void slotSetMonitorGamma(int gamma);
void slotCheckRenderStatus();
void slotInsertZoneToTree();
/** @brief Focus the timecode widget of current monitor. */

View File

@@ -819,10 +819,25 @@ int VideoWidget::reconfigure()
m_consumer->set("prefill", 6);
m_consumer->set("drop_max", fps / 4);
m_consumer->set("scrub_audio", KdenliveSettings::audio_scrub());
if (KdenliveSettings::monitor_gamma() == 0) {
m_consumer->set("color_trc", "iec61966_2_1");
} else {
switch (pCore->getProjectProfile().colorspace()) {
case 601:
case 170:
m_consumer->set("color_trc", "smpte170m");
break;
case 240:
m_consumer->set("color_trc", "smpte240m");
break;
case 470:
m_consumer->set("color_trc", "bt470bg");
break;
case 2020:
// if (isDeckLinkHLG) {
// m_consumer->set("color_trc", "arib-std-b67");
m_consumer->clear("color_trc");
break;
default:
m_consumer->set("color_trc", "bt709");
break;
}
} else {
// Cleanup on error