Mercurial > hg > svcore
comparison data/fileio/test/UnsupportedFormat.cpp @ 1714:83cb6e9d769b
Attempt to cope with the fact that Windows Server (for CI builds) lacks certain codecs
author | Chris Cannam |
---|---|
date | Fri, 17 May 2019 11:05:10 +0100 |
parents | |
children | 9ec3f123f1fb |
comparison
equal
deleted
inserted
replaced
1713:978c143c767f | 1714:83cb6e9d769b |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sonic Visualiser | |
5 An audio file viewer and annotation editor. | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 | |
8 This program is free software; you can redistribute it and/or | |
9 modify it under the terms of the GNU General Public License as | |
10 published by the Free Software Foundation; either version 2 of the | |
11 License, or (at your option) any later version. See the file | |
12 COPYING included with this distribution for more information. | |
13 */ | |
14 | |
15 #include "UnsupportedFormat.h" | |
16 | |
17 #ifdef Q_OS_WIN | |
18 #include <windows.h> | |
19 #endif | |
20 | |
21 bool | |
22 UnsupportedFormat::isLegitimatelyUnsupported(QString format) | |
23 { | |
24 #ifdef Q_OS_WIN | |
25 // Our CI tests run on Windows Server, which annoyingly seems to | |
26 // come without codecs for WMA and AAC | |
27 | |
28 NTSTATUS(WINAPI *RtlGetVersion)(LPOSVERSIONINFOEXW); | |
29 *(FARPROC*)&RtlGetVersion = GetProcAddress | |
30 (GetModuleHandleA("ntdll"), "RtlGetVersion"); | |
31 | |
32 if (RtlGetVersion) { | |
33 | |
34 OSVERSIONINFOEXW osInfo; | |
35 osInfo.dwOSVersionInfoSize = sizeof(osInfo); | |
36 RtlGetVersion(&osInfo); | |
37 | |
38 if (osInfo.wProductType != VER_NT_WORKSTATION) { | |
39 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" << endl; | |
40 return (format == "aac" || | |
41 format == "apple_lossless" || | |
42 format == "m4a" || | |
43 format == "wma"); | |
44 } | |
45 | |
46 } else { | |
47 cerr << "WARNING: Failed to find RtlGetVersion in NTDLL" << endl; | |
48 } | |
49 | |
50 return (format == "apple_lossless"); | |
51 | |
52 #else | |
53 #ifdef Q_OS_MAC | |
54 return (format == "wma"); | |
55 #else | |
56 return (format == "aac" || | |
57 format == "apple_lossless" || | |
58 format == "m4a" || | |
59 format == "wma"); | |
60 #endif | |
61 #endif | |
62 } |