Skip to content

Commit

Permalink
Merge pull request #3229 from wsoltys/xpcleanup
Browse files Browse the repository at this point in the history
[WIN32] cosmetics: removed some XP only code.
  • Loading branch information
MartijnKaijser committed Sep 10, 2013
2 parents bbcdc74 + f097959 commit 2466561
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 72 deletions.
4 changes: 2 additions & 2 deletions xbmc/cores/AudioEngine/AESinkFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ IAESink *CAESinkFactory::Create(std::string &device, AEAudioFormat &desiredForma


#if defined(TARGET_WINDOWS)
if ((driver.empty() && g_sysinfo.IsWindowsVersionAtLeast(CSysInfo::WindowsVersionVista) ||
if ((driver.empty() ||
driver == "WASAPI") && !g_advancedSettings.m_audioForceDirectSound)
TRY_SINK(WASAPI)
else
Expand Down Expand Up @@ -141,7 +141,7 @@ void CAESinkFactory::EnumerateEx(AESinkInfoList &list, bool force)
{
#if defined(TARGET_WINDOWS)
ENUMERATE_SINK(DirectSound, force);
if (g_sysinfo.IsWindowsVersionAtLeast(CSysInfo::WindowsVersionVista) && !g_advancedSettings.m_audioForceDirectSound)
if (!g_advancedSettings.m_audioForceDirectSound)
ENUMERATE_SINK(WASAPI, force);
#elif defined(TARGET_ANDROID)
ENUMERATE_SINK(AUDIOTRACK, force);
Expand Down
52 changes: 0 additions & 52 deletions xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,6 @@ bool CAESinkDirectSound::Initialize(AEAudioFormat &format, std::string &device)
dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 /** Better position accuracy */
| DSBCAPS_GLOBALFOCUS; /** Allows background playing */

if (!g_sysinfo.IsWindowsVersionAtLeast(CSysInfo::WindowsVersionVista))
dsbdesc.dwFlags |= DSBCAPS_LOCHARDWARE; /** Needed for 5.1 on emu101k, fails by design on Vista */

dsbdesc.dwBufferBytes = m_dwBufferLen;
dsbdesc.lpwfxFormat = (WAVEFORMATEX *)&wfxex;

Expand Down Expand Up @@ -512,55 +509,6 @@ void CAESinkDirectSound::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList, bo

std::string strDD = GetDefaultDevice();

/* See if we are on Windows XP */
if (!g_sysinfo.IsWindowsVersionAtLeast(CSysInfo::WindowsVersionVista))
{
/* We are on XP - WASAPI not supported - enumerate using DS devices */
LPGUID deviceGUID = NULL;
RPC_CSTR cszGUID;
std::string szGUID;
std::list<DSDevice> DSDeviceList;
DirectSoundEnumerate(DSEnumCallback, &DSDeviceList);

for(std::list<DSDevice>::iterator itt = DSDeviceList.begin(); itt != DSDeviceList.end(); ++itt)
{
if (UuidToString((*itt).lpGuid, &cszGUID) != RPC_S_OK)
continue; /* could not convert GUID to string - skip device */

deviceInfo.m_channels.Reset();
deviceInfo.m_dataFormats.clear();
deviceInfo.m_sampleRates.clear();

szGUID = (LPSTR)cszGUID;

deviceInfo.m_deviceName = "{" + szGUID + "}";
deviceInfo.m_displayName = (*itt).name;
deviceInfo.m_displayNameExtra = std::string("DirectSound: ") + (*itt).name;

deviceInfo.m_deviceType = AE_DEVTYPE_PCM;
deviceInfo.m_channels = layoutsByChCount[2];

deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_FLOAT));
deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_AC3));

deviceInfo.m_sampleRates.push_back((DWORD) 96000);

deviceInfoList.push_back(deviceInfo);

// add the default device with m_deviceName = default
if(strDD == deviceInfo.m_deviceName)
{
deviceInfo.m_deviceName = std::string("default");
deviceInfo.m_displayName = std::string("default");
deviceInfo.m_displayNameExtra = std::string("");
deviceInfoList.push_back(deviceInfo);
}
}

RpcStringFree(&cszGUID);
return;
}

/* Windows Vista or later - supporting WASAPI device probing */
hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void**)&pEnumerator);
EXIT_ON_FAILURE(hr, __FUNCTION__": Could not allocate WASAPI device enumerator. CoCreateInstance error code: %li", hr)
Expand Down
3 changes: 1 addition & 2 deletions xbmc/cores/VideoRenderers/BaseRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,7 @@ void CBaseRenderer::SettingOptionsRenderMethodsFiller(const CSetting *setting, s
list.push_back(make_pair(g_localizeStrings.Get(13416), RENDER_METHOD_AUTO));

#ifdef HAS_DX
if (g_sysinfo.IsWindowsVersionAtLeast(CSysInfo::WindowsVersionVista))
list.push_back(make_pair(g_localizeStrings.Get(16319), RENDER_METHOD_DXVA));
list.push_back(make_pair(g_localizeStrings.Get(16319), RENDER_METHOD_DXVA));
list.push_back(make_pair(g_localizeStrings.Get(13431), RENDER_METHOD_D3D_PS));
list.push_back(make_pair(g_localizeStrings.Get(13419), RENDER_METHOD_SOFTWARE));
#endif
Expand Down
2 changes: 1 addition & 1 deletion xbmc/rendering/dx/RenderSystemDX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ bool CRenderSystemDX::InitRenderSystem()
{
m_bVSync = true;

m_useD3D9Ex = (g_advancedSettings.m_AllowD3D9Ex && g_sysinfo.IsWindowsVersionAtLeast(CSysInfo::WindowsVersionVista) && LoadD3D9Ex());
m_useD3D9Ex = (g_advancedSettings.m_AllowD3D9Ex && LoadD3D9Ex());
m_pD3D = NULL;

if (m_useD3D9Ex)
Expand Down
3 changes: 1 addition & 2 deletions xbmc/settings/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,7 @@ void CSettings::InitializeConditions()
#endif
#if defined(TARGET_WINDOWS) && defined(HAS_DX)
m_settingsManager->AddCondition("has_dx");
if (g_sysinfo.IsWindowsVersionAtLeast(CSysInfo::WindowsVersionVista))
m_settingsManager->AddCondition("hasdxva2");
m_settingsManager->AddCondition("hasdxva2");
#endif

if (g_application.IsStandAlone())
Expand Down
3 changes: 1 addition & 2 deletions xbmc/utils/Environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ std::string CEnvironment::win32ConvertWToUtf8(const std::wstring &text, bool *re
if (resultSuccessful != NULL)
*resultSuccessful = false;

static const DWORD convFlags = (CSysInfo::IsWindowsVersionAtLeast(CSysInfo::WindowsVersionVista)) ?
/*WC_ERR_INVALID_CHARS*/ 0x80 : 0;
static const DWORD convFlags = /*WC_ERR_INVALID_CHARS*/ 0x80;
int bufSize = WideCharToMultiByte(CP_UTF8, convFlags, text.c_str(), -1, NULL, 0, NULL, NULL);
if (bufSize == 0)
return "";
Expand Down
15 changes: 4 additions & 11 deletions xbmc/utils/SystemInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,17 +367,10 @@ CStdString CSysInfo::GetCPUSerial()
bool CSysInfo::IsAeroDisabled()
{
#ifdef TARGET_WINDOWS
if (IsWindowsVersionAtLeast(CSysInfo::WindowsVersionVista))
{
BOOL aeroEnabled = FALSE;
HRESULT res = DwmIsCompositionEnabled(&aeroEnabled);
if (SUCCEEDED(res))
return !aeroEnabled;
}
else
{
return true;
}
BOOL aeroEnabled = FALSE;
HRESULT res = DwmIsCompositionEnabled(&aeroEnabled);
if (SUCCEEDED(res))
return !aeroEnabled;
#endif
return false;
}
Expand Down

0 comments on commit 2466561

Please sign in to comment.