Cleanup colorspace info

This commit is contained in:
Jean-Baptiste Mardelle 2025-06-11 18:53:47 +02:00
parent 059da23ee1
commit 9d0ab5e067
No known key found for this signature in database
3 changed files with 17 additions and 20 deletions

View file

@ -33,6 +33,7 @@ ProfilesDialog::ProfilesDialog(const QString &profileDescription, QWidget *paren
m_view.colorspace->addItem(ProfileRepository::getColorspaceDescription(601), 601);
m_view.colorspace->addItem(ProfileRepository::getColorspaceDescription(709), 709);
m_view.colorspace->addItem(ProfileRepository::getColorspaceDescription(240), 240);
m_view.colorspace->addItem(ProfileRepository::getColorspaceDescription(2020), 2020);
m_view.colorspace->addItem(ProfileRepository::getColorspaceDescription(0), 0);
QStringList profilesFilter;
@ -94,6 +95,7 @@ ProfilesDialog::ProfilesDialog(const QString &profilePath, bool, QWidget *parent
m_view.colorspace->addItem(ProfileRepository::getColorspaceDescription(601), 601);
m_view.colorspace->addItem(ProfileRepository::getColorspaceDescription(709), 709);
m_view.colorspace->addItem(ProfileRepository::getColorspaceDescription(240), 240);
m_view.colorspace->addItem(ProfileRepository::getColorspaceDescription(2020), 2020);
m_view.colorspace->addItem(ProfileRepository::getColorspaceDescription(0), 0);
QStringList profilesFilter;
@ -303,7 +305,11 @@ void ProfilesDialog::saveProfile(const QString &path)
profile->m_sample_aspect_den = m_view.aspect_den->text().toInt();
profile->m_display_aspect_num = m_view.display_num->value();
profile->m_display_aspect_den = m_view.display_den->value();
profile->m_colorspace = m_view.colorspace->itemData(m_view.colorspace->currentIndex()).toInt();
int colorSpace = m_view.colorspace->itemData(m_view.colorspace->currentIndex()).toInt();
if (colorSpace == 0) {
colorSpace = 709;
}
profile->m_colorspace = colorSpace;
ProfileRepository::get()->saveProfile(profile.get(), path);
}

View file

@ -746,16 +746,12 @@ QWidget *ClipPropertiesController::constructPropertiesPage()
}
// Colorspace
options = {{ProfileRepository::getColorspaceDescription(240), 240},
{ProfileRepository::getColorspaceDescription(601), 601},
{ProfileRepository::getColorspaceDescription(709), 709},
{ProfileRepository::getColorspaceDescription(10), 10}};
options = {{ProfileRepository::getColorspaceDescription(170), 170}, {ProfileRepository::getColorspaceDescription(240), 240},
{ProfileRepository::getColorspaceDescription(601), 601}, {ProfileRepository::getColorspaceDescription(709), 709},
{ProfileRepository::getColorspaceDescription(470), 470}, {ProfileRepository::getColorspaceDescription(2020), 2020}};
QString defaultValue;
int colorspace = m_controller->videoCodecProperty(QStringLiteral("colorspace")).toInt();
if (colorspace == 9) {
colorspace = 10;
}
int colorspace = m_controller->getProducerIntProperty(QStringLiteral("meta.media.colorspace"));
if (colorspace > 0) {
defaultValue = QString::number(colorspace);
}
@ -764,10 +760,7 @@ QWidget *ClipPropertiesController::constructPropertiesPage()
fpBox->addLayout(hlay);
// Color range
options = {{i18n("Broadcast limited (MPEG)"), 1},
{i18n("Full (JPEG)"), 2},
{ProfileRepository::getColorspaceDescription(709), 709},
{ProfileRepository::getColorspaceDescription(10), 10}};
options = {{i18n("Broadcast limited (MPEG)"), 1}, {i18n("Full (JPEG)"), 2}};
defaultValue = QString::number(m_controller->isFullRange() ? 2 : 1);
hlay = comboboxProperty(i18n("Color range:"), QStringLiteral("color_range"), options, defaultValue);
fpBox->addLayout(hlay);
@ -1388,8 +1381,7 @@ QList<QStringList> ClipPropertiesController::getVideoProperties(int streamIndex)
propertyMap.append({i18n("Pixel format:"), m_sourceProperties->get(property.toUtf8().constData())});
// Colorspace
property = codecInfo + QStringLiteral("colorspace");
int colorspace = m_sourceProperties->get_int(property.toUtf8().constData());
int colorspace = m_sourceProperties->get_int("meta.media.colorspace");
propertyMap.append({i18n("Colorspace:"), ProfileRepository::getColorspaceDescription(colorspace)});
// B frames

View file

@ -16,11 +16,10 @@
std::unique_ptr<ProfileRepository> ProfileRepository::instance;
std::once_flag ProfileRepository::m_onceFlag;
std::vector<std::pair<int, QString>> ProfileRepository::colorProfiles{{601, QStringLiteral("ITU-R BT.601")},
{709, QStringLiteral("ITU-R BT.709")},
{240, QStringLiteral("SMPTE ST240")},
{9, QStringLiteral("ITU-R BT.2020")},
{10, QStringLiteral("ITU-R BT.2020")}};
std::vector<std::pair<int, QString>> ProfileRepository::colorProfiles{{601, QStringLiteral("ITU-R BT.601")}, {709, QStringLiteral("ITU-R BT.709")},
{240, QStringLiteral("SMPTE ST240")}, {170, QStringLiteral("SMPTE ST170")},
{2020, QStringLiteral("ITU-R BT.2020 NCL")}, {2021, QStringLiteral("ITU-R BT.2020 CL")},
{470, QStringLiteral("ITU-R BT.470 BG")}};
ProfileRepository::ProfileRepository()
{