Don't show HDR option if we know it's unsupported

This commit is contained in:
Cameron Gutman 2021-12-12 17:43:20 -06:00
parent daf8495acb
commit c4d85cf928
3 changed files with 20 additions and 4 deletions

View file

@ -64,6 +64,16 @@ SystemProperties::SystemProperties()
hasDiscordIntegration = false;
#endif
// TODO: Do something smarter than this. We should be able to query
// this from the decoder (or just try VIDEO_FORMAT_H265_MAIN10 and
// fail if we don't get a hardware accelerated decoder).
#ifdef Q_OS_DARWIN
// HDR is supported by the VideoToolbox renderer
supportsHdr = true;
#else
supportsHdr = false;
#endif
unmappedGamepads = SdlInputHandler::getUnmappedGamepads();
// Populate data that requires talking to SDL. We do it all in one shot

View file

@ -26,6 +26,7 @@ public:
Q_PROPERTY(int maximumStreamingFrameRate MEMBER maximumStreamingFrameRate CONSTANT)
Q_PROPERTY(QSize maximumResolution MEMBER maximumResolution CONSTANT)
Q_PROPERTY(QString versionString MEMBER versionString CONSTANT)
Q_PROPERTY(bool supportsHdr MEMBER supportsHdr CONSTANT)
Q_INVOKABLE void refreshDisplays();
Q_INVOKABLE QRect getDesktopResolution(int displayIndex);
@ -54,5 +55,6 @@ private:
QList<QRect> monitorDesktopResolutions;
QList<QRect> monitorNativeResolutions;
QString versionString;
bool supportsHdr;
};

View file

@ -1284,6 +1284,13 @@ Flickable {
AutoResizingComboBox {
// ignore setting the index at first, and actually set it when the component is loaded
Component.onCompleted: {
if (SystemProperties.supportsHdr) {
codecListModel.append({
"text": qsTr("HEVC HDR (Experimental)"),
"val": StreamingPreferences.VCC_FORCE_HEVC_HDR
});
}
var saved_vcc = StreamingPreferences.videoCodecConfig
currentIndex = 0
for(var i = 0; i < codecListModel.count; i++) {
@ -1312,10 +1319,7 @@ Flickable {
text: qsTr("HEVC (H.265)")
val: StreamingPreferences.VCC_FORCE_HEVC
}
ListElement {
text: qsTr("HEVC HDR (Experimental)")
val: StreamingPreferences.VCC_FORCE_HEVC_HDR
}
/* HEVC HDR will be appended here */
}
// ::onActivated must be used, as it only listens for when the index is changed by a human
onActivated : {