Chris@1714: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@1714: Chris@1714: /* Chris@1714: Sonic Visualiser Chris@1714: An audio file viewer and annotation editor. Chris@1714: Centre for Digital Music, Queen Mary, University of London. Chris@1714: Chris@1714: This program is free software; you can redistribute it and/or Chris@1714: modify it under the terms of the GNU General Public License as Chris@1714: published by the Free Software Foundation; either version 2 of the Chris@1714: License, or (at your option) any later version. See the file Chris@1714: COPYING included with this distribution for more information. Chris@1714: */ Chris@1714: Chris@1714: #include "UnsupportedFormat.h" Chris@1714: Chris@1714: #ifdef Q_OS_WIN Chris@1714: #include Chris@1714: #endif Chris@1714: Chris@1715: #include Chris@1715: Chris@1714: bool Chris@1714: UnsupportedFormat::isLegitimatelyUnsupported(QString format) Chris@1714: { Chris@1714: #ifdef Q_OS_WIN Chris@1728: Chris@1728: if (sizeof(void *) == 4) { Chris@1728: // Our 32-bit MinGW build lacks MediaFoundation support Chris@1728: return (format == "aac" || Chris@1728: format == "apple_lossless" || Chris@1728: format == "m4a" || Chris@1728: format == "wma"); Chris@1728: } Chris@1728: Chris@1714: // Our CI tests run on Windows Server, which annoyingly seems to Chris@1714: // come without codecs for WMA and AAC Chris@1714: Chris@1714: NTSTATUS(WINAPI *RtlGetVersion)(LPOSVERSIONINFOEXW); Chris@1714: *(FARPROC*)&RtlGetVersion = GetProcAddress Chris@1714: (GetModuleHandleA("ntdll"), "RtlGetVersion"); Chris@1714: Chris@1714: if (RtlGetVersion) { Chris@1714: Chris@1714: OSVERSIONINFOEXW osInfo; Chris@1714: osInfo.dwOSVersionInfoSize = sizeof(osInfo); Chris@1714: RtlGetVersion(&osInfo); Chris@1714: Chris@1714: if (osInfo.wProductType != VER_NT_WORKSTATION) { Chris@1715: std::cerr << "NOTE: We appear to be running on Windows Server (wProductType = " << osInfo.wProductType << ") - assuming encumbered media codecs might not be installed and being lenient about them" << std::endl; Chris@1714: return (format == "aac" || Chris@1714: format == "apple_lossless" || Chris@1714: format == "m4a" || Chris@1714: format == "wma"); Chris@1714: } Chris@1714: Chris@1714: } else { Chris@1715: std::cerr << "WARNING: Failed to find RtlGetVersion in NTDLL" Chris@1715: << std::endl; Chris@1714: } Chris@1728: Chris@1728: // If none of the above applies, then we should have everything Chris@1728: // except this: Chris@1714: Chris@1714: return (format == "apple_lossless"); Chris@1714: Chris@1714: #else Chris@1714: #ifdef Q_OS_MAC Chris@1714: return (format == "wma"); Chris@1714: #else Chris@1714: return (format == "aac" || Chris@1714: format == "apple_lossless" || Chris@1714: format == "m4a" || Chris@1714: format == "wma"); Chris@1714: #endif Chris@1714: #endif Chris@1714: }