mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-01 07:15:27 +00:00
Replace C++ VLAs with std::vector
This commit is contained in:
parent
515db03fe5
commit
4af9623727
@ -1,5 +1,7 @@
|
|||||||
#include "eglimagefactory.h"
|
#include "eglimagefactory.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
// Don't take a dependency on libdrm just for these constants
|
// Don't take a dependency on libdrm just for these constants
|
||||||
#ifndef DRM_FORMAT_MOD_INVALID
|
#ifndef DRM_FORMAT_MOD_INVALID
|
||||||
#define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1)
|
#define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1)
|
||||||
@ -449,8 +451,8 @@ bool EglImageFactory::supportsImportingFormat(EGLDisplay dpy, EGLint format)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLint formats[numFormats];
|
std::vector<EGLint> formats(numFormats);
|
||||||
if (!m_eglQueryDmaBufFormatsEXT(dpy, numFormats, formats, &numFormats)) {
|
if (!m_eglQueryDmaBufFormatsEXT(dpy, numFormats, formats.data(), &numFormats)) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"eglQueryDmaBufFormatsEXT() #2 failed: %d", eglGetError());
|
"eglQueryDmaBufFormatsEXT() #2 failed: %d", eglGetError());
|
||||||
return false;
|
return false;
|
||||||
@ -491,8 +493,8 @@ bool EglImageFactory::supportsImportingModifier(EGLDisplay dpy, EGLint format, E
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLuint64KHR modifiers[numModifiers];
|
std::vector<EGLuint64KHR> modifiers(numModifiers);
|
||||||
if (!m_eglQueryDmaBufModifiersEXT(dpy, format, numModifiers, modifiers, nullptr, &numModifiers)) {
|
if (!m_eglQueryDmaBufModifiersEXT(dpy, format, numModifiers, modifiers.data(), nullptr, &numModifiers)) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"eglQueryDmaBufModifiersEXT() #2 failed: %d", eglGetError());
|
"eglQueryDmaBufModifiersEXT() #2 failed: %d", eglGetError());
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
// HACK: Include before vaapi.h to prevent conflicts with Xlib.h
|
// HACK: Include before vaapi.h to prevent conflicts with Xlib.h
|
||||||
#include <streaming/session.h>
|
#include <streaming/session.h>
|
||||||
|
|
||||||
@ -573,9 +575,9 @@ VAAPIRenderer::isDirectRenderingSupported()
|
|||||||
|
|
||||||
AVHWDeviceContext* deviceContext = (AVHWDeviceContext*)m_HwContext->data;
|
AVHWDeviceContext* deviceContext = (AVHWDeviceContext*)m_HwContext->data;
|
||||||
AVVAAPIDeviceContext* vaDeviceContext = (AVVAAPIDeviceContext*)deviceContext->hwctx;
|
AVVAAPIDeviceContext* vaDeviceContext = (AVVAAPIDeviceContext*)deviceContext->hwctx;
|
||||||
VAEntrypoint entrypoints[vaMaxNumEntrypoints(vaDeviceContext->display)];
|
std::vector<VAEntrypoint> entrypoints(vaMaxNumEntrypoints(vaDeviceContext->display));
|
||||||
int entrypointCount;
|
int entrypointCount;
|
||||||
VAStatus status = vaQueryConfigEntrypoints(vaDeviceContext->display, VAProfileNone, entrypoints, &entrypointCount);
|
VAStatus status = vaQueryConfigEntrypoints(vaDeviceContext->display, VAProfileNone, entrypoints.data(), &entrypointCount);
|
||||||
if (status == VA_STATUS_SUCCESS) {
|
if (status == VA_STATUS_SUCCESS) {
|
||||||
for (int i = 0; i < entrypointCount; i++) {
|
for (int i = 0; i < entrypointCount; i++) {
|
||||||
// Without VAEntrypointVideoProc support, the driver will crash inside vaPutSurface()
|
// Without VAEntrypointVideoProc support, the driver will crash inside vaPutSurface()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user