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; hasDiscordIntegration = false;
#endif #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(); unmappedGamepads = SdlInputHandler::getUnmappedGamepads();
// Populate data that requires talking to SDL. We do it all in one shot // 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(int maximumStreamingFrameRate MEMBER maximumStreamingFrameRate CONSTANT)
Q_PROPERTY(QSize maximumResolution MEMBER maximumResolution CONSTANT) Q_PROPERTY(QSize maximumResolution MEMBER maximumResolution CONSTANT)
Q_PROPERTY(QString versionString MEMBER versionString CONSTANT) Q_PROPERTY(QString versionString MEMBER versionString CONSTANT)
Q_PROPERTY(bool supportsHdr MEMBER supportsHdr CONSTANT)
Q_INVOKABLE void refreshDisplays(); Q_INVOKABLE void refreshDisplays();
Q_INVOKABLE QRect getDesktopResolution(int displayIndex); Q_INVOKABLE QRect getDesktopResolution(int displayIndex);
@ -54,5 +55,6 @@ private:
QList<QRect> monitorDesktopResolutions; QList<QRect> monitorDesktopResolutions;
QList<QRect> monitorNativeResolutions; QList<QRect> monitorNativeResolutions;
QString versionString; QString versionString;
bool supportsHdr;
}; };

View File

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