annotate data/fileio/test/UnsupportedFormat.cpp @ 1739:565575463752 by-id

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