diff --git a/app/streaming/video/ffmpeg-renderers/d3d11va.cpp b/app/streaming/video/ffmpeg-renderers/d3d11va.cpp index d4915070..d7f1b317 100644 --- a/app/streaming/video/ffmpeg-renderers/d3d11va.cpp +++ b/app/streaming/video/ffmpeg-renderers/d3d11va.cpp @@ -322,7 +322,7 @@ bool D3D11VARenderer::initialize(PDECODER_PARAMETERS params) m_DisplayWidth = swapChainDesc.Width; m_DisplayHeight = swapChainDesc.Height; - if (params->videoFormat == VIDEO_FORMAT_H265_MAIN10) { + if (params->videoFormat & VIDEO_FORMAT_MASK_10BIT) { swapChainDesc.Format = DXGI_FORMAT_R10G10B10A2_UNORM; } else { @@ -446,7 +446,7 @@ bool D3D11VARenderer::initialize(PDECODER_PARAMETERS params) // We require NV12 or P010 textures for our shader framesContext->format = AV_PIX_FMT_D3D11; - framesContext->sw_format = params->videoFormat == VIDEO_FORMAT_H265_MAIN10 ? + framesContext->sw_format = (params->videoFormat & VIDEO_FORMAT_MASK_10BIT) ? AV_PIX_FMT_P010 : AV_PIX_FMT_NV12; framesContext->width = FFALIGN(params->width, m_TextureAlignment); @@ -1325,7 +1325,7 @@ bool D3D11VARenderer::setupTexturePoolViews(AVD3D11VAFramesContext* frameContext srvDesc.Texture2DArray.FirstArraySlice = frameContext->texture_infos[i].index; - srvDesc.Format = m_DecoderParams.videoFormat == VIDEO_FORMAT_H265_MAIN10 ? DXGI_FORMAT_R16_UNORM : DXGI_FORMAT_R8_UNORM; + srvDesc.Format = (m_DecoderParams.videoFormat & VIDEO_FORMAT_MASK_10BIT) ? DXGI_FORMAT_R16_UNORM : DXGI_FORMAT_R8_UNORM; hr = m_Device->CreateShaderResourceView(frameContext->texture_infos[i].texture, &srvDesc, &m_VideoTextureResourceViews[i][0]); if (FAILED(hr)) { m_VideoTextureResourceViews[i][0] = nullptr; @@ -1335,7 +1335,7 @@ bool D3D11VARenderer::setupTexturePoolViews(AVD3D11VAFramesContext* frameContext return false; } - srvDesc.Format = m_DecoderParams.videoFormat == VIDEO_FORMAT_H265_MAIN10 ? DXGI_FORMAT_R16G16_UNORM : DXGI_FORMAT_R8G8_UNORM; + srvDesc.Format = (m_DecoderParams.videoFormat & VIDEO_FORMAT_MASK_10BIT) ? DXGI_FORMAT_R16G16_UNORM : DXGI_FORMAT_R8G8_UNORM; hr = m_Device->CreateShaderResourceView(frameContext->texture_infos[i].texture, &srvDesc, &m_VideoTextureResourceViews[i][1]); if (FAILED(hr)) { m_VideoTextureResourceViews[i][1] = nullptr; diff --git a/app/streaming/video/ffmpeg-renderers/drm.cpp b/app/streaming/video/ffmpeg-renderers/drm.cpp index 5cd42987..6bbe3d68 100644 --- a/app/streaming/video/ffmpeg-renderers/drm.cpp +++ b/app/streaming/video/ffmpeg-renderers/drm.cpp @@ -111,7 +111,7 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params) { int i; - m_Main10Hdr = (params->videoFormat == VIDEO_FORMAT_H265_MAIN10); + m_Main10Hdr = (params->videoFormat & VIDEO_FORMAT_MASK_10BIT); #if SDL_VERSION_ATLEAST(2, 0, 15) SDL_SysWMinfo info; diff --git a/app/streaming/video/ffmpeg-renderers/dxva2.cpp b/app/streaming/video/ffmpeg-renderers/dxva2.cpp index f575afbe..e8972904 100644 --- a/app/streaming/video/ffmpeg-renderers/dxva2.cpp +++ b/app/streaming/video/ffmpeg-renderers/dxva2.cpp @@ -559,7 +559,7 @@ bool DXVA2Renderer::initializeDevice(SDL_Window* window, bool enableVsync) d3dpp.hDeviceWindow = info.info.win.window; d3dpp.Flags = D3DPRESENTFLAG_VIDEO; - if (m_VideoFormat == VIDEO_FORMAT_H265_MAIN10) { + if (m_VideoFormat & VIDEO_FORMAT_MASK_10BIT) { // Verify 10-bit A2R10G10B10 color support. This is only available // as a display format in full-screen exclusive mode on DX9. hr = d3d9ex->CheckDeviceType(adapterIndex, diff --git a/app/streaming/video/ffmpeg-renderers/eglvid.cpp b/app/streaming/video/ffmpeg-renderers/eglvid.cpp index a880dc95..fb6a5e54 100644 --- a/app/streaming/video/ffmpeg-renderers/eglvid.cpp +++ b/app/streaming/video/ffmpeg-renderers/eglvid.cpp @@ -459,8 +459,8 @@ bool EGLRenderer::initialize(PDECODER_PARAMETERS params) // Don't retry if we've already failed to create a renderer for this // window *unless* the format has changed from 10-bit to 8-bit. if (m_Window == s_LastFailedWindow && - (params->videoFormat & VIDEO_FORMAT_H265_MAIN10) == - (s_LastFailedVideoFormat & VIDEO_FORMAT_H265_MAIN10)) { + !!(params->videoFormat & VIDEO_FORMAT_MASK_10BIT) == + !!(s_LastFailedVideoFormat & VIDEO_FORMAT_MASK_10BIT)) { EGL_LOG(Error, "SDL_CreateRenderer() already failed on this window!"); return false; } diff --git a/app/streaming/video/ffmpeg-renderers/renderer.h b/app/streaming/video/ffmpeg-renderers/renderer.h index cfae0b0d..cf2b0f51 100644 --- a/app/streaming/video/ffmpeg-renderers/renderer.h +++ b/app/streaming/video/ffmpeg-renderers/renderer.h @@ -169,7 +169,7 @@ public: } virtual AVPixelFormat getPreferredPixelFormat(int videoFormat) { - if (videoFormat == VIDEO_FORMAT_H265_MAIN10) { + if (videoFormat & VIDEO_FORMAT_MASK_10BIT) { // 10-bit YUV 4:2:0 return AV_PIX_FMT_P010; } diff --git a/app/streaming/video/ffmpeg-renderers/sdlvid.cpp b/app/streaming/video/ffmpeg-renderers/sdlvid.cpp index 6a291a05..3cd5a536 100644 --- a/app/streaming/video/ffmpeg-renderers/sdlvid.cpp +++ b/app/streaming/video/ffmpeg-renderers/sdlvid.cpp @@ -92,7 +92,7 @@ bool SdlRenderer::initialize(PDECODER_PARAMETERS params) m_VideoFormat = params->videoFormat; - if (params->videoFormat == VIDEO_FORMAT_H265_MAIN10) { + if (params->videoFormat & VIDEO_FORMAT_MASK_10BIT) { // SDL doesn't support rendering YUV 10-bit textures yet return false; } diff --git a/app/streaming/video/ffmpeg-renderers/vaapi.cpp b/app/streaming/video/ffmpeg-renderers/vaapi.cpp index e0880665..866eac40 100644 --- a/app/streaming/video/ffmpeg-renderers/vaapi.cpp +++ b/app/streaming/video/ffmpeg-renderers/vaapi.cpp @@ -417,7 +417,7 @@ VAAPIRenderer::isDirectRenderingSupported() "Using indirect rendering due to WM or blacklist"); return false; } - else if (m_VideoFormat == VIDEO_FORMAT_H265_MAIN10) { + else if (m_VideoFormat & VIDEO_FORMAT_MASK_10BIT) { SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Using indirect rendering for 10-bit video"); return false; @@ -777,12 +777,12 @@ VAAPIRenderer::canExportSurfaceHandle(int layerTypeFlag) { attrs[attributeCount].type = VASurfaceAttribPixelFormat; attrs[attributeCount].flags = VA_SURFACE_ATTRIB_SETTABLE; attrs[attributeCount].value.type = VAGenericValueTypeInteger; - attrs[attributeCount].value.value.i = (m_VideoFormat == VIDEO_FORMAT_H265_MAIN10) ? + attrs[attributeCount].value.value.i = (m_VideoFormat & VIDEO_FORMAT_MASK_10BIT) ? VA_FOURCC_P010 : VA_FOURCC_NV12; attributeCount++; st = vaCreateSurfaces(vaDeviceContext->display, - m_VideoFormat == VIDEO_FORMAT_H265_MAIN10 ? + (m_VideoFormat & VIDEO_FORMAT_MASK_10BIT) ? VA_RT_FORMAT_YUV420_10 : VA_RT_FORMAT_YUV420, 1280, 720, @@ -831,7 +831,7 @@ VAAPIRenderer::canExportEGL() { } AVPixelFormat VAAPIRenderer::getEGLImagePixelFormat() { - return m_VideoFormat == VIDEO_FORMAT_H265_MAIN10 ? + return (m_VideoFormat & VIDEO_FORMAT_MASK_10BIT) ? AV_PIX_FMT_P010 : AV_PIX_FMT_NV12; } diff --git a/app/streaming/video/ffmpeg-renderers/vdpau.cpp b/app/streaming/video/ffmpeg-renderers/vdpau.cpp index f2538b3f..170f3009 100644 --- a/app/streaming/video/ffmpeg-renderers/vdpau.cpp +++ b/app/streaming/video/ffmpeg-renderers/vdpau.cpp @@ -216,7 +216,7 @@ bool VDPAURenderer::initialize(PDECODER_PARAMETERS params) VdpBool supported; uint32_t maxWidth, maxHeight; VdpRGBAFormat candidateFormat = - params->videoFormat == VIDEO_FORMAT_H265_MAIN10 ? + (params->videoFormat & VIDEO_FORMAT_MASK_10BIT) ? k_OutputFormats10Bit[i] : k_OutputFormats8Bit[i]; status = m_VdpOutputSurfaceQueryCapabilities(m_Device, candidateFormat, diff --git a/app/streaming/video/ffmpeg-renderers/vt.mm b/app/streaming/video/ffmpeg-renderers/vt.mm index 00875e17..06ced6e4 100644 --- a/app/streaming/video/ffmpeg-renderers/vt.mm +++ b/app/streaming/video/ffmpeg-renderers/vt.mm @@ -364,7 +364,7 @@ public: // // https://github.com/moonlight-stream/moonlight-qt/issues/493 // https://github.com/moonlight-stream/moonlight-qt/issues/722 - if (params->videoFormat != VIDEO_FORMAT_H265_MAIN10) { + if (!(params->videoFormat & VIDEO_FORMAT_MASK_10BIT)) { int err; uint32_t cpuType; size_t size = sizeof(cpuType); diff --git a/app/streaming/video/ffmpeg.cpp b/app/streaming/video/ffmpeg.cpp index f28bb403..066a50d5 100644 --- a/app/streaming/video/ffmpeg.cpp +++ b/app/streaming/video/ffmpeg.cpp @@ -234,7 +234,7 @@ bool FFmpegVideoDecoder::createFrontendRenderer(PDECODER_PARAMETERS params, bool // rendering mode so it can set the HDR metadata on the display. EGL does // not currently support this (and even if it did, Mesa and Wayland don't // currently have protocols to actually get that metadata to the display). - if (params->videoFormat == VIDEO_FORMAT_H265_MAIN10 && m_BackendRenderer->canExportDrmPrime()) { + if ((params->videoFormat & VIDEO_FORMAT_MASK_10BIT) && m_BackendRenderer->canExportDrmPrime()) { m_FrontendRenderer = new DrmRenderer(m_BackendRenderer); if (m_FrontendRenderer->initialize(params)) { return true; diff --git a/moonlight-common-c/moonlight-common-c b/moonlight-common-c/moonlight-common-c index e62dc560..bf22101c 160000 --- a/moonlight-common-c/moonlight-common-c +++ b/moonlight-common-c/moonlight-common-c @@ -1 +1 @@ -Subproject commit e62dc56047b038e5f2a5404b023fec453bf1bf8a +Subproject commit bf22101c7d11cd1fe36409fe5c12b38cbfa8dd06