From 7a9c58003d04c81f74fa28ffc4bc462b0df62c04 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 17 Nov 2025 04:41:57 -0800 Subject: [PATCH] Fix video playback on Xbox --- Source/Engine/Video/MF/VideoBackendMF.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Video/MF/VideoBackendMF.cpp b/Source/Engine/Video/MF/VideoBackendMF.cpp index 75950f3aa..b8ef7ee4e 100644 --- a/Source/Engine/Video/MF/VideoBackendMF.cpp +++ b/Source/Engine/Video/MF/VideoBackendMF.cpp @@ -120,6 +120,14 @@ namespace MF else { // Reconfigure decoder to output supported format by force +#if PLATFORM_XBOX_ONE || PLATFORM_XBOX_SCARLETT + // Xbox supports NV12 via HV decoder + auto fallbackFormat = PixelFormat::NV12; + GUID fallbackFormatGuid = MFVideoFormat_NV12; +#else + auto fallbackFormat = PixelFormat::YUY2; + GUID fallbackFormatGuid = MFVideoFormat_YUY2; +#endif IMFMediaType* customType = nullptr; hr = MFCreateMediaType(&customType); if (FAILED(hr)) @@ -128,7 +136,7 @@ namespace MF goto END; } customType->SetGUID(MF_MT_MAJOR_TYPE, majorType); - customType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_YUY2); + customType->SetGUID(MF_MT_SUBTYPE, fallbackFormatGuid); MFSetAttributeSize(customType, MF_MT_FRAME_SIZE, width, height); hr = playerMF.SourceReader->SetCurrentMediaType(streamIndex, nullptr, customType); if (FAILED(hr)) @@ -136,7 +144,7 @@ namespace MF VIDEO_API_MF_ERROR(SetCurrentMediaType, hr); goto END; } - player.Format = PixelFormat::YUY2; + player.Format = fallbackFormat; customType->Release(); } }