mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-16 17:43:09 +00:00
Cap resolution options at 1080p on Steam Link and Raspberry Pi due to hardware limitations
This commit is contained in:
parent
46bcbda972
commit
979de190dc
@ -114,7 +114,7 @@ void SystemProperties::querySdlVideoInfo()
|
||||
return;
|
||||
}
|
||||
|
||||
Session::getDecoderInfo(testWindow, hasHardwareAcceleration, rendererAlwaysFullScreen);
|
||||
Session::getDecoderInfo(testWindow, hasHardwareAcceleration, rendererAlwaysFullScreen, maximumResolution);
|
||||
|
||||
SDL_DestroyWindow(testWindow);
|
||||
|
||||
|
@ -20,6 +20,7 @@ public:
|
||||
Q_PROPERTY(bool hasDiscordIntegration MEMBER hasDiscordIntegration CONSTANT)
|
||||
Q_PROPERTY(QString unmappedGamepads MEMBER unmappedGamepads NOTIFY unmappedGamepadsChanged)
|
||||
Q_PROPERTY(int maximumStreamingFrameRate MEMBER maximumStreamingFrameRate CONSTANT)
|
||||
Q_PROPERTY(QSize maximumResolution MEMBER maximumResolution CONSTANT)
|
||||
|
||||
Q_INVOKABLE QRect getDesktopResolution(int displayIndex);
|
||||
Q_INVOKABLE QRect getNativeResolution(int displayIndex);
|
||||
@ -40,6 +41,7 @@ private:
|
||||
bool hasDiscordIntegration;
|
||||
QString unmappedGamepads;
|
||||
int maximumStreamingFrameRate;
|
||||
QSize maximumResolution;
|
||||
QList<QRect> monitorDesktopResolutions;
|
||||
QList<QRect> monitorNativeResolutions;
|
||||
};
|
||||
|
@ -131,6 +131,20 @@ Flickable {
|
||||
}
|
||||
}
|
||||
|
||||
// Prune resolutions that are over the decoder's maximum
|
||||
var max_pixels = SystemProperties.maximumResolution.width * SystemProperties.maximumResolution.height;
|
||||
if (max_pixels > 0) {
|
||||
for (var j = 0; j < resolutionComboBox.count; j++) {
|
||||
var existing_width = parseInt(resolutionListModel.get(j).video_width);
|
||||
var existing_height = parseInt(resolutionListModel.get(j).video_height);
|
||||
|
||||
if (existing_width * existing_height > max_pixels) {
|
||||
resolutionListModel.remove(j)
|
||||
j--
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// load the saved width/height, and iterate through the ComboBox until a match is found
|
||||
// and set it to that index.
|
||||
var saved_width = StreamingPreferences.width
|
||||
|
@ -253,7 +253,7 @@ int Session::drSubmitDecodeUnit(PDECODE_UNIT du)
|
||||
}
|
||||
|
||||
void Session::getDecoderInfo(SDL_Window* window,
|
||||
bool& isHardwareAccelerated, bool& isFullScreenOnly)
|
||||
bool& isHardwareAccelerated, bool& isFullScreenOnly, QSize& maxResolution)
|
||||
{
|
||||
IVideoDecoder* decoder;
|
||||
|
||||
@ -266,6 +266,7 @@ void Session::getDecoderInfo(SDL_Window* window,
|
||||
|
||||
isHardwareAccelerated = decoder->isHardwareAccelerated();
|
||||
isFullScreenOnly = decoder->isAlwaysFullScreen();
|
||||
maxResolution = decoder->getDecoderMaxResolution();
|
||||
|
||||
delete decoder;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
|
||||
static
|
||||
void getDecoderInfo(SDL_Window* window,
|
||||
bool& isHardwareAccelerated, bool& isFullScreenOnly);
|
||||
bool& isHardwareAccelerated, bool& isFullScreenOnly, QSize& maxResolution);
|
||||
|
||||
static Session* get()
|
||||
{
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
virtual bool isAlwaysFullScreen() = 0;
|
||||
virtual int getDecoderCapabilities() = 0;
|
||||
virtual int getDecoderColorspace() = 0;
|
||||
virtual QSize getDecoderMaxResolution() = 0;
|
||||
virtual int submitDecodeUnit(PDECODE_UNIT du) = 0;
|
||||
virtual void renderFrameOnMainThread() = 0;
|
||||
};
|
||||
|
@ -134,8 +134,8 @@ enum AVPixelFormat MmalRenderer::getPreferredPixelFormat(int videoFormat)
|
||||
|
||||
int MmalRenderer::getRendererAttributes()
|
||||
{
|
||||
// This renderer can only draw in full-screen
|
||||
return RENDERER_ATTRIBUTE_FULLSCREEN_ONLY;
|
||||
// This renderer can only draw in full-screen and maxes out at 1080p
|
||||
return RENDERER_ATTRIBUTE_FULLSCREEN_ONLY | RENDERER_ATTRIBUTE_1080P_MAX;
|
||||
}
|
||||
|
||||
bool MmalRenderer::needsTestFrame()
|
||||
|
@ -10,6 +10,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
#define RENDERER_ATTRIBUTE_FULLSCREEN_ONLY 0x01
|
||||
#define RENDERER_ATTRIBUTE_1080P_MAX 0x02
|
||||
|
||||
class IFFmpegRenderer : public Overlay::IOverlayRenderer {
|
||||
public:
|
||||
|
@ -71,6 +71,17 @@ int FFmpegVideoDecoder::getDecoderColorspace()
|
||||
return m_FrontendRenderer->getDecoderColorspace();
|
||||
}
|
||||
|
||||
QSize FFmpegVideoDecoder::getDecoderMaxResolution()
|
||||
{
|
||||
if (m_BackendRenderer->getRendererAttributes() & RENDERER_ATTRIBUTE_1080P_MAX) {
|
||||
return QSize(1920, 1080);
|
||||
}
|
||||
else {
|
||||
// No known maximum
|
||||
return QSize(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
enum AVPixelFormat FFmpegVideoDecoder::ffGetFormat(AVCodecContext* context,
|
||||
const enum AVPixelFormat* pixFmts)
|
||||
{
|
||||
|
@ -19,6 +19,7 @@ public:
|
||||
virtual bool isAlwaysFullScreen() override;
|
||||
virtual int getDecoderCapabilities() override;
|
||||
virtual int getDecoderColorspace() override;
|
||||
virtual QSize getDecoderMaxResolution() override;
|
||||
virtual int submitDecodeUnit(PDECODE_UNIT du) override;
|
||||
virtual void renderFrameOnMainThread() override;
|
||||
|
||||
|
@ -42,6 +42,11 @@ SLVideoDecoder::getDecoderColorspace()
|
||||
return COLORSPACE_REC_709;
|
||||
}
|
||||
|
||||
QSize SLVideoDecoder::getDecoderMaxResolution()
|
||||
{
|
||||
return QSize(1920, 1080);
|
||||
}
|
||||
|
||||
bool
|
||||
SLVideoDecoder::initialize(PDECODER_PARAMETERS params)
|
||||
{
|
||||
|
@ -14,6 +14,7 @@ public:
|
||||
virtual bool isAlwaysFullScreen();
|
||||
virtual int getDecoderCapabilities();
|
||||
virtual int getDecoderColorspace();
|
||||
virtual QSize getDecoderMaxResolution();
|
||||
virtual int submitDecodeUnit(PDECODE_UNIT du);
|
||||
|
||||
// Unused since rendering is done directly from the decode thread
|
||||
|
Loading…
x
Reference in New Issue
Block a user