build(windows): fix gcc15 compatibility (#3946)

This commit is contained in:
ReenigneArcher 2025-06-07 16:29:45 -04:00 committed by GitHub
commit 1938385bf0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 55 additions and 33 deletions

View file

@ -15,6 +15,7 @@ target_compile_options(dxgi-info PRIVATE ${SUNSHINE_COMPILE_OPTIONS})
add_executable(audio-info audio.cpp)
set_target_properties(audio-info PROPERTIES CXX_STANDARD 20)
target_link_libraries(audio-info
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
ksuser
${PLATFORM_LIBRARIES})

View file

@ -3,8 +3,8 @@
* @brief Handles collecting audio device information from Windows.
*/
#define INITGUID
#include "src/utility.h"
// platform includes
#include <audioclient.h>
#include <codecvt>
#include <iostream>
@ -13,6 +13,12 @@
#include <roapi.h>
#include <synchapi.h>
// lib includes
#include <boost/locale.hpp>
// local includes
#include "src/utility.h"
DEFINE_PROPERTYKEY(PKEY_Device_DeviceDesc, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 2); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14); // DEVPROP_TYPE_STRING
DEFINE_PROPERTYKEY(PKEY_DeviceInterface_FriendlyName, 0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 2);
@ -44,8 +50,6 @@ namespace audio {
using handle_t = util::safe_ptr_v2<void, BOOL, CloseHandle>;
static std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> converter;
class prop_var_t {
public:
prop_var_t() {
@ -204,7 +208,7 @@ namespace audio {
// so we can take the first match as the current format to display.
auto audio_client = make_audio_client(device, format);
if (audio_client) {
current_format = converter.from_bytes(format.name.data());
current_format = boost::locale::conv::utf_to_utf<wchar_t>(format.name.data());
break;
}
}