mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-16 21:51:17 +00:00
Support YUV 4:4:4 formats
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#define SER_AUDIOCFG "audiocfg"
|
||||
#define SER_VIDEOCFG "videocfg"
|
||||
#define SER_HDR "hdr"
|
||||
#define SER_YUV444 "yuv444"
|
||||
#define SER_VIDEODEC "videodec"
|
||||
#define SER_WINDOWMODE "windowmode"
|
||||
#define SER_MDNS "mdns"
|
||||
@@ -117,7 +118,8 @@ void StreamingPreferences::reload()
|
||||
width = settings.value(SER_WIDTH, 1280).toInt();
|
||||
height = settings.value(SER_HEIGHT, 720).toInt();
|
||||
fps = settings.value(SER_FPS, 60).toInt();
|
||||
bitrateKbps = settings.value(SER_BITRATE, getDefaultBitrate(width, height, fps)).toInt();
|
||||
enableYUV444 = settings.value(SER_YUV444, false).toBool();
|
||||
bitrateKbps = settings.value(SER_BITRATE, getDefaultBitrate(width, height, fps, enableYUV444)).toInt();
|
||||
enableVsync = settings.value(SER_VSYNC, true).toBool();
|
||||
gameOptimizations = settings.value(SER_GAMEOPTS, true).toBool();
|
||||
playAudioOnHost = settings.value(SER_HOSTAUDIO, false).toBool();
|
||||
@@ -322,6 +324,7 @@ void StreamingPreferences::save()
|
||||
settings.setValue(SER_SHOWPERFOVERLAY, showPerformanceOverlay);
|
||||
settings.setValue(SER_AUDIOCFG, static_cast<int>(audioConfig));
|
||||
settings.setValue(SER_HDR, enableHdr);
|
||||
settings.setValue(SER_YUV444, enableYUV444);
|
||||
settings.setValue(SER_VIDEOCFG, static_cast<int>(videoCodecConfig));
|
||||
settings.setValue(SER_VIDEODEC, static_cast<int>(videoDecoderSelection));
|
||||
settings.setValue(SER_WINDOWMODE, static_cast<int>(windowMode));
|
||||
@@ -337,7 +340,7 @@ void StreamingPreferences::save()
|
||||
settings.setValue(SER_KEEPAWAKE, keepAwake);
|
||||
}
|
||||
|
||||
int StreamingPreferences::getDefaultBitrate(int width, int height, int fps)
|
||||
int StreamingPreferences::getDefaultBitrate(int width, int height, int fps, bool yuv444)
|
||||
{
|
||||
// Don't scale bitrate linearly beyond 60 FPS. It's definitely not a linear
|
||||
// bitrate increase for frame rate once we get to values that high.
|
||||
@@ -385,5 +388,10 @@ int StreamingPreferences::getDefaultBitrate(int width, int height, int fps)
|
||||
}
|
||||
}
|
||||
|
||||
if (yuv444) {
|
||||
// This is rough estimation based on the fact that 4:4:4 doubles the amount of raw YUV data compared to 4:2:0
|
||||
resolutionFactor *= 2;
|
||||
}
|
||||
|
||||
return qRound(resolutionFactor * frameRateFactor) * 1000;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
static StreamingPreferences* get(QQmlEngine *qmlEngine = nullptr);
|
||||
|
||||
Q_INVOKABLE static int
|
||||
getDefaultBitrate(int width, int height, int fps);
|
||||
getDefaultBitrate(int width, int height, int fps, bool yuv444);
|
||||
|
||||
Q_INVOKABLE void save();
|
||||
|
||||
@@ -125,6 +125,7 @@ public:
|
||||
Q_PROPERTY(AudioConfig audioConfig MEMBER audioConfig NOTIFY audioConfigChanged)
|
||||
Q_PROPERTY(VideoCodecConfig videoCodecConfig MEMBER videoCodecConfig NOTIFY videoCodecConfigChanged)
|
||||
Q_PROPERTY(bool enableHdr MEMBER enableHdr NOTIFY enableHdrChanged)
|
||||
Q_PROPERTY(bool enableYUV444 MEMBER enableYUV444 NOTIFY enableYUV444Changed)
|
||||
Q_PROPERTY(VideoDecoderSelection videoDecoderSelection MEMBER videoDecoderSelection NOTIFY videoDecoderSelectionChanged)
|
||||
Q_PROPERTY(WindowMode windowMode MEMBER windowMode NOTIFY windowModeChanged)
|
||||
Q_PROPERTY(WindowMode recommendedFullScreenMode MEMBER recommendedFullScreenMode CONSTANT)
|
||||
@@ -169,6 +170,7 @@ public:
|
||||
AudioConfig audioConfig;
|
||||
VideoCodecConfig videoCodecConfig;
|
||||
bool enableHdr;
|
||||
bool enableYUV444;
|
||||
VideoDecoderSelection videoDecoderSelection;
|
||||
WindowMode windowMode;
|
||||
WindowMode recommendedFullScreenMode;
|
||||
@@ -191,6 +193,7 @@ signals:
|
||||
void audioConfigChanged();
|
||||
void videoCodecConfigChanged();
|
||||
void enableHdrChanged();
|
||||
void enableYUV444Changed();
|
||||
void videoDecoderSelectionChanged();
|
||||
void uiDisplayModeChanged();
|
||||
void windowModeChanged();
|
||||
|
||||
Reference in New Issue
Block a user