Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Use more information from AE in GUI #1643

Closed
wants to merge 9 commits into from

6 participants

@Karlson2k
Collaborator

AE (SoftAE) know a lot of connected devices.
This PR enables usage of device information in GUI and maintain backward code compatibility.
I think that this way XBMC looks more solid and professional product.

@da-anda

why "passthroughaac" instead of "aacpassthrough" which would be in sync with the rest?

Collaborator

For historical reasons.

yeah - should be uniform - better as "aacpassthrough"

Collaborator

@DDDamian so it should be changed everywhere in code.
It will be separate PR.
May be it's better so use template "audiooutput.passthrough???"?

Sure - it's just for consistency, and it's a minor detail. Nice catch.

@da-anda

don't you missing aacpassthrough here?

Collaborator

No, 3 lines up.

@da-anda
Collaborator

dee9786 has it's own PR (sink reopen) - so I guess it's wrong in this one, isn't it?

@DDDamian DDDamian was assigned
@Karlson2k
Collaborator

It's not a problem. If other PR will be merged, I'll rebase this one.

@davilla

Why acc at all ? I looked about for a receiver that handles acc passthough and came up empty.

@davilla

rather aac than acc, typo :)

@DDDamian

heh heh - tried this months ago......#1045

@DDDamian

@karlson2k - see my direct email about coordinating this - it's one we certainly want to bring in but don't want lots of conflicts while we wait for Frodo.

@da-anda
Collaborator

@fritsch @FernetMenta can stuff from here be reused for ActiveAE/new audio settings page or should it be closed?

@fritsch
Collaborator

There are some commits in the PR, that will be needed when we want to get the new Settings page in place. As those are quite a lot changes, I did not get an overview in time.

We have to organize such changes in a decent way, so that the PRs are not standing years and later don't come in or expire.

The new settings page can be used to see which features we are missing / need from the sink.

@MartijnKaijser

Should een handled wit he settings rework. Certain commit can be scavenged of this one if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
10 language/English/strings.po
@@ -10816,8 +10816,14 @@ msgctxt "#34110"
msgid "7.1"
msgstr ""
-#34111-34119 reserved for future use
-#empty strings from id 34111 to 34119
+#34111-34118 reserved for future use
+#empty strings from id 34111 to 34118
+
+#. output device; passthrough device
+#: xbmc/settings/GUIWindowSettingsCategory.cpp
+msgctxt "#34119"
+msgid "Error - no devices found"
+msgstr ""
#: xbmc/settings/GUISettings.cpp
msgctxt "#34120"
View
1  project/VS2010Express/XBMC.vcxproj
@@ -1009,6 +1009,7 @@
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEChannelInfo.h" />
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEConvert.h" />
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEDeviceInfo.h" />
+ <ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEDeviceType.h" />
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEPackIEC61937.h" />
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AERemap.h" />
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEStreamInfo.h" />
View
7 project/VS2010Express/XBMC.vcxproj.filters
@@ -5737,9 +5737,14 @@
<ClInclude Include="..\..\xbmc\dialogs\GUIDialogMediaFilter.h">
<Filter>dialogs</Filter>
</ClInclude>
+
+
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\PVROperations.h">
<Filter>interfaces\json-rpc</Filter>
</ClInclude>
+ <ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEDeviceType.h">
+ <Filter>cores\AudioEngine\Utils</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc">
@@ -5771,4 +5776,4 @@
<Filter>interfaces\swig</Filter>
</None>
</ItemGroup>
-</Project>
+</Project>
View
8 xbmc/cores/AudioEngine/AEFactory.cpp
@@ -197,6 +197,14 @@ void CAEFactory::EnumerateOutputDevices(AEDeviceList &devices, bool passthrough)
AE->EnumerateOutputDevices(devices, passthrough);
}
+bool CAEFactory::EnumerateOutputDevicesEx(std::vector<AEDeviceEx> &devices, bool passthrough)
+{
+ if(AE)
+ return AE->EnumerateOutputDevicesEx(devices, passthrough);
+
+ return false;
+}
+
std::string CAEFactory::GetDefaultDevice(bool passthrough)
{
if(AE)
View
1  xbmc/cores/AudioEngine/AEFactory.h
@@ -46,6 +46,7 @@ class CAEFactory
static void SetSoundMode(const int mode);
static void OnSettingsChange(std::string setting);
static void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough);
+ static bool EnumerateOutputDevicesEx(std::vector<AEDeviceEx> &devices, bool passthrough);
static std::string GetDefaultDevice(bool passthrough);
static bool SupportsRaw();
static void SetMute(const bool enabled);
View
34 xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp
@@ -521,6 +521,9 @@ void CSoftAE::OnSettingsChange(std::string setting)
setting == "audiooutput.mode" ||
setting == "audiooutput.ac3passthrough" ||
setting == "audiooutput.dtspassthrough" ||
+ setting == "audiooutput.passthroughaac" ||
+ setting == "audiooutput.truehdpassthrough" ||
+ setting == "audiooutput.dtshdpassthrough" ||
setting == "audiooutput.channellayout" ||
setting == "audiooutput.useexclusivemode" ||
setting == "audiooutput.multichannellpcm" ||
@@ -688,6 +691,37 @@ void CSoftAE::EnumerateOutputDevices(AEDeviceList &devices, bool passthrough)
}
}
+bool CSoftAE::EnumerateOutputDevicesEx(std::vector<AEDeviceEx> &devices, bool passthrough)
+{
+ for (AESinkInfoList::iterator itt = m_sinkInfoList.begin(); itt != m_sinkInfoList.end(); ++itt)
+ {
+ AESinkInfo& sinkInfo = *itt;
+ for (AEDeviceInfoList::iterator itt2 = sinkInfo.m_deviceInfoList.begin(); itt2 != sinkInfo.m_deviceInfoList.end(); ++itt2)
+ {
+ CAEDeviceInfo& devInfo = *itt2;
+ AEDeviceEx dev;
+ if (passthrough && !devInfo.SupportsRaw())
+ continue;
+
+ dev.m_DeviceType = devInfo.m_deviceType;
+ dev.m_DeviceName = devInfo.GetAEDeviceName();
+ dev.m_SupportedDataFormats = devInfo.m_dataFormats;
+
+ /* add the sink name if we have more then one sink type */
+ if (m_sinkInfoList.size() > 1)
+ dev.m_DisplayName = sinkInfo.m_sinkName + ":";
+
+ dev.m_DisplayName += devInfo.m_displayName;
+
+ if (!devInfo.m_displayNameExtra.empty())
+ dev.m_DisplayName += ", " + devInfo.m_displayNameExtra;
+
+ devices.push_back(dev);
+ }
+ }
+ return true;
+}
+
std::string CSoftAE::GetDefaultDevice(bool passthrough)
{
for (AESinkInfoList::iterator itt = m_sinkInfoList.begin(); itt != m_sinkInfoList.end(); ++itt)
View
1  xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h
@@ -99,6 +99,7 @@ class CSoftAE : public IThreadedAE
double GetCacheTotal();
virtual void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough);
+ virtual bool EnumerateOutputDevicesEx(std::vector<AEDeviceEx> &devices, bool passthrough);
virtual std::string GetDefaultDevice(bool passthrough);
virtual bool SupportsRaw();
View
16 xbmc/cores/AudioEngine/Interfaces/AE.h
@@ -26,9 +26,17 @@
#include "threads/CriticalSection.h"
#include "../AEAudioFormat.h"
+#include "../Utils/AEDeviceType.h"
typedef std::pair<std::string, std::string> AEDevice;
typedef std::vector<AEDevice> AEDeviceList;
+struct AEDeviceEx
+{
+ std::string m_DeviceName;
+ std::string m_DisplayName;
+ enum AEDeviceType m_DeviceType;
+ std::vector<AEDataFormat> m_SupportedDataFormats;
+};
/* forward declarations */
class IAEStream;
@@ -171,6 +179,14 @@ class IAE
virtual void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough) = 0;
/**
+ * Enumerate the supported audio output devices with extended information
+ * @param devices The device list to append supported devices to
+ * @param passthrough True if only passthrough devices are wanted
+ * @return false if not supported, true if succeed
+ */
+ virtual bool EnumerateOutputDevicesEx(std::vector<AEDeviceEx> &devices, bool passthrough) { return false; }
+
+ /**
* Returns the default audio device
* @param passthrough True if the default passthrough device is wanted
* @return the default audio device
View
6 xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp
@@ -75,17 +75,17 @@ struct winEndpointsToAEDeviceType
static const winEndpointsToAEDeviceType winEndpoints[EndpointFormFactor_enum_count] =
{
- {"Network Device - ", AE_DEVTYPE_PCM},
+ {"Network Device - ", AE_DEVTYPE_NETWORK},
{"Speakers - ", AE_DEVTYPE_PCM},
{"LineLevel - ", AE_DEVTYPE_PCM},
{"Headphones - ", AE_DEVTYPE_PCM},
{"Microphone - ", AE_DEVTYPE_PCM},
{"Headset - ", AE_DEVTYPE_PCM},
{"Handset - ", AE_DEVTYPE_PCM},
- {"Digital Passthrough - ", AE_DEVTYPE_IEC958},
+ {"Digital Passthrough - ", AE_DEVTYPE_DIGITALOUT},
{"SPDIF - ", AE_DEVTYPE_IEC958},
{"HDMI - ", AE_DEVTYPE_HDMI},
- {"Unknown - ", AE_DEVTYPE_PCM},
+ {"Unknown - ", AE_DEVTYPE_UNKNOWN},
};
// implemented in AESinkWASAPI.cpp
View
6 xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp
@@ -124,17 +124,17 @@ struct winEndpointsToAEDeviceType
static const winEndpointsToAEDeviceType winEndpoints[EndpointFormFactor_enum_count] =
{
- {"Network Device - ", AE_DEVTYPE_PCM},
+ {"Network Device - ", AE_DEVTYPE_NETWORK},
{"Speakers - ", AE_DEVTYPE_PCM},
{"LineLevel - ", AE_DEVTYPE_PCM},
{"Headphones - ", AE_DEVTYPE_PCM},
{"Microphone - ", AE_DEVTYPE_PCM},
{"Headset - ", AE_DEVTYPE_PCM},
{"Handset - ", AE_DEVTYPE_PCM},
- {"Digital Passthrough - ", AE_DEVTYPE_IEC958},
+ {"Digital Passthrough - ", AE_DEVTYPE_DIGITALOUT},
{"SPDIF - ", AE_DEVTYPE_IEC958},
{"HDMI - ", AE_DEVTYPE_HDMI},
- {"Unknown - ", AE_DEVTYPE_PCM},
+ {"Unknown - ", AE_DEVTYPE_UNKNOWN},
};
AEDeviceInfoList DeviceInfoList;
View
11 xbmc/cores/AudioEngine/Utils/AEDeviceInfo.cpp
@@ -56,10 +56,13 @@ std::string CAEDeviceInfo::DeviceTypeToString(enum AEDeviceType deviceType)
{
switch (deviceType)
{
- case AE_DEVTYPE_PCM : return "AE_DEVTYPE_PCM" ; break;
- case AE_DEVTYPE_IEC958: return "AE_DEVTYPE_IEC958"; break;
- case AE_DEVTYPE_HDMI : return "AE_DEVTYPE_HDMI" ; break;
- case AE_DEVTYPE_DP : return "AE_DEVTYPE_DP" ; break;
+ case AE_DEVTYPE_UNKNOWN : return "AE_DEVTYPE_UNKNOWN" ; break;
+ case AE_DEVTYPE_PCM : return "AE_DEVTYPE_PCM" ; break;
+ case AE_DEVTYPE_DIGITALOUT: return "AE_DEVTYPE_DIGITALOUT"; break;
+ case AE_DEVTYPE_IEC958 : return "AE_DEVTYPE_IEC958" ; break;
+ case AE_DEVTYPE_HDMI : return "AE_DEVTYPE_HDMI" ; break;
+ case AE_DEVTYPE_DP : return "AE_DEVTYPE_DP" ; break;
+ case AE_DEVTYPE_NETWORK : return "AE_DEVTYPE_NETWORK" ; break;
}
return "INVALID";
}
View
8 xbmc/cores/AudioEngine/Utils/AEDeviceInfo.h
@@ -23,17 +23,11 @@
#include <vector>
#include "AEAudioFormat.h"
#include "Utils/AEChannelInfo.h"
+#include "Utils/AEDeviceType.h"
typedef std::vector<unsigned int > AESampleRateList;
typedef std::vector<enum AEDataFormat> AEDataFormatList;
-enum AEDeviceType {
- AE_DEVTYPE_PCM,
- AE_DEVTYPE_IEC958,
- AE_DEVTYPE_HDMI,
- AE_DEVTYPE_DP
-};
-
/**
* This classt provides the details of what the audio output hardware is capable of
*/
View
32 xbmc/cores/AudioEngine/Utils/AEDeviceType.h
@@ -0,0 +1,32 @@
+#pragma once
+/*
+ * Copyright (C) 2012 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+enum AEDeviceType
+{
+ AE_DEVTYPE_UNKNOWN, /* Unknown or undetermined device */
+ AE_DEVTYPE_PCM, /* PCM-only capable device, usually audio with analog output */
+ AE_DEVTYPE_DIGITALOUT, /* Some digital output */
+ AE_DEVTYPE_IEC958, /* IEC958 (S/PDIF) output */
+ AE_DEVTYPE_HDMI, /* HDMI output */
+ AE_DEVTYPE_DP, /* DisplayPort output */
+ AE_DEVTYPE_NETWORK /* Networked audio output */
+};
+
View
180 xbmc/settings/GUIWindowSettingsCategory.cpp
@@ -761,26 +761,60 @@ void CGUIWindowSettingsCategory::UpdateSettings()
if (pControl) pControl->SetEnabled(g_guiSettings.GetInt("audiocds.encoder") == CDDARIP_ENCODER_FLAC);
}
else if (
- strSetting.Equals("audiooutput.passthroughdevice") ||
strSetting.Equals("audiooutput.ac3passthrough") ||
strSetting.Equals("audiooutput.dtspassthrough") ||
- strSetting.Equals("audiooutput.passthroughaac"))
- { // only visible if we are in digital mode
- CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
- if (pControl) pControl->SetEnabled(AUDIO_IS_BITSTREAM(g_guiSettings.GetInt("audiooutput.mode")));
- }
- else if (
+ strSetting.Equals("audiooutput.passthroughaac") ||
strSetting.Equals("audiooutput.multichannellpcm" ) ||
strSetting.Equals("audiooutput.truehdpassthrough") ||
strSetting.Equals("audiooutput.dtshdpassthrough" ))
- {
+
+ { // only visible if we are in digital mode
CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
- if (pControl)
+ if (pControl)
{
- if (strSetting.Equals("audiooutput.dtshdpassthrough") && !g_guiSettings.GetBool("audiooutput.dtspassthrough"))
- pControl->SetEnabled(false);
+ CBaseSettingControl *pBaseCtrl = GetSetting("audiooutput.passthroughdevice");
+ CGUISpinControlEx *pControlPassDev = NULL;
+ if (pBaseCtrl)
+ pControlPassDev = (CGUISpinControlEx *)GetControl(pBaseCtrl->GetID());
+ AudioSinkMapIterator itt = m_DigitalAudioSinkMap.end();
+ if (pControlPassDev)
+ itt = m_DigitalAudioSinkMap.find(pControlPassDev->GetLabel());
+
+ if (itt == m_DigitalAudioSinkMap.end() || itt->second.m_SupportedDataFormats.empty())
+ {
+ if (strSetting.Equals("audiooutput.multichannellpcm"))
+ pControl->SetEnabled(g_guiSettings.GetInt("audiooutput.mode") == AUDIO_HDMI);
+ else if (strSetting.Equals("audiooutput.dtshdpassthrough"))
+ pControl->SetEnabled(AUDIO_IS_BITSTREAM(g_guiSettings.GetInt("audiooutput.mode")) &&
+ g_guiSettings.GetBool("audiooutput.dtspassthrough"));
+ else
+ pControl->SetEnabled(AUDIO_IS_BITSTREAM(g_guiSettings.GetInt("audiooutput.mode")));
+ }
else
- pControl->SetEnabled(g_guiSettings.GetInt("audiooutput.mode") == AUDIO_HDMI);
+ {
+ bool found = false;
+ int searchFor = AE_FMT_INVALID;
+ if (strSetting.Equals("audiooutput.ac3passthrough"))
+ searchFor = AE_FMT_AC3;
+ else if (strSetting.Equals("audiooutput.dtspassthrough"))
+ searchFor = AE_FMT_DTS;
+ else if (strSetting.Equals("audiooutput.passthroughaac"))
+ searchFor = AE_FMT_AAC;
+ else if (strSetting.Equals("audiooutput.multichannellpcm"))
+ searchFor = AE_FMT_LPCM;
+ else if (strSetting.Equals("audiooutput.truehdpassthrough"))
+ searchFor = AE_FMT_TRUEHD;
+ else if (strSetting.Equals("audiooutput.dtshdpassthrough"))
+ searchFor = AE_FMT_DTSHD;
+
+ vector<AEDataFormat> &dataFormats = itt->second.m_SupportedDataFormats;
+ for(vector<AEDataFormat>::const_iterator i = dataFormats.cbegin(); !found && i != dataFormats.cend(); i++)
+ {
+ if (*i == searchFor)
+ found = true;
+ }
+ pControl->SetEnabled(found);
+ }
}
}
else if (strSetting.Equals("musicplayer.crossfade"))
@@ -1957,14 +1991,51 @@ void CGUIWindowSettingsCategory::OnSettingChanged(CBaseSettingControl *pSettingC
#if defined(TARGET_DARWIN)
g_guiSettings.SetString("audiooutput.audiodevice", pControl->GetCurrentLabel());
#else
- g_guiSettings.SetString("audiooutput.audiodevice", m_AnalogAudioSinkMap[pControl->GetCurrentLabel()]);
+ g_guiSettings.SetString("audiooutput.audiodevice", m_AnalogAudioSinkMap[pControl->GetCurrentLabel()].m_DeviceName.c_str());
#endif
}
#if !defined(TARGET_DARWIN)
else if (strSetting.Equals("audiooutput.passthroughdevice"))
{
CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
- g_guiSettings.SetString("audiooutput.passthroughdevice", m_DigitalAudioSinkMap[pControl->GetCurrentLabel()]);
+ if (pControl)
+ {
+ AudioSinkMapIterator itt = m_DigitalAudioSinkMap.find(pControl->GetCurrentLabel());
+ if (itt != m_DigitalAudioSinkMap.end())
+ {
+ AEDeviceEx &dev = itt->second;
+ g_guiSettings.SetString("audiooutput.passthroughdevice", dev.m_DeviceName.c_str());
+
+ switch (dev.m_DeviceType)
+ {
+ case AE_DEVTYPE_DP:
+ case AE_DEVTYPE_HDMI:
+ g_guiSettings.SetInt("audiooutput.mode", AUDIO_HDMI);
+ break;
+ case AE_DEVTYPE_PCM:
+ g_guiSettings.SetInt("audiooutput.mode", AUDIO_ANALOG);
+ break;
+ case AE_DEVTYPE_DIGITALOUT:
+ case AE_DEVTYPE_IEC958:
+ g_guiSettings.SetInt("audiooutput.mode", AUDIO_IEC958);
+ break;
+ }
+ CBaseSettingControl *pBaseCtrl = GetSetting("audiooutput.mode");
+ CGUISpinControlEx *pControlMode = NULL;
+ if (pBaseCtrl)
+ pControlMode = (CGUISpinControlEx *)GetControl(pBaseCtrl->GetID());
+ if (pControlMode)
+ pControlMode->SetValue(g_guiSettings.GetInt("audiooutput.mode"));
+
+ /* Reset passthrough settings */
+ g_guiSettings.SetBool("audiooutput.ac3passthrough", false);
+ g_guiSettings.SetBool("audiooutput.dtspassthrough", false);
+ g_guiSettings.SetBool("audiooutput.passthroughaac", false);
+ g_guiSettings.SetBool("audiooutput.multichannellpcm" , false);
+ g_guiSettings.SetBool("audiooutput.truehdpassthrough", false);
+ g_guiSettings.SetBool("audiooutput.dtshdpassthrough" , false);
+ }
+ }
}
#endif
else if (strSetting.Equals("audiooutput.guisoundmode"))
@@ -2860,62 +2931,81 @@ void CGUIWindowSettingsCategory::FillInAudioDevices(CSetting* pSetting, bool Pas
CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
pControl->Clear();
- CStdString currentDevice = Passthrough ? g_guiSettings.GetString("audiooutput.passthroughdevice") : g_guiSettings.GetString("audiooutput.audiodevice");
+ std::string currentDevice = Passthrough ? g_guiSettings.GetString("audiooutput.passthroughdevice") : g_guiSettings.GetString("audiooutput.audiodevice");
if (Passthrough)
- {
m_DigitalAudioSinkMap.clear();
- m_DigitalAudioSinkMap["Error - no devices found"] = "null:";
- }
else
- {
m_AnalogAudioSinkMap.clear();
- m_AnalogAudioSinkMap["Error - no devices found"] = "null:";
- }
int numberSinks = 0;
-
int selectedValue = -1;
AEDeviceList sinkList;
- CAEFactory::EnumerateOutputDevices(sinkList, Passthrough);
-#if !defined(TARGET_DARWIN)
- if (sinkList.size()==0)
+ vector<AEDeviceEx> deviceExList;
+ if (CAEFactory::EnumerateOutputDevicesEx(deviceExList, Passthrough) && !deviceExList.empty())
{
- pControl->AddLabel("Error - no devices found", 0);
- numberSinks = 1;
- selectedValue = 0;
+ for(unsigned int i = 0; i < deviceExList.size(); i++)
+ {
+ const AEDeviceEx &dev = deviceExList.at(i);
+ pControl->AddLabel(dev.m_DisplayName, i);
+ if (currentDevice.compare(dev.m_DeviceName) == 0)
+ selectedValue = i;
+
+ if (Passthrough)
+ m_DigitalAudioSinkMap[dev.m_DisplayName] = dev;
+ else
+ m_AnalogAudioSinkMap[dev.m_DisplayName] = dev;
+ }
}
else
{
-#endif
- AEDeviceList::const_iterator iter = sinkList.begin();
- for (int i=0; iter != sinkList.end(); iter++)
+ CAEFactory::EnumerateOutputDevices(sinkList, Passthrough);
+ for (unsigned int i = 0; i < sinkList.size(); i++)
{
- CStdString label = (*iter).first;
- CStdString sink = (*iter).second;
- pControl->AddLabel(label.c_str(), i);
+ AEDeviceEx dev;
+ dev.m_DeviceType = AE_DEVTYPE_UNKNOWN;
+ dev.m_DisplayName = sinkList.at(i).first;
+ dev.m_DeviceName = sinkList.at(i).second;
+ pControl->AddLabel(dev.m_DisplayName, i);
- if (currentDevice.Equals(sink))
+ if (currentDevice.compare(dev.m_DeviceName))
selectedValue = i;
if (Passthrough)
- m_DigitalAudioSinkMap[label] = sink;
+ m_DigitalAudioSinkMap[dev.m_DisplayName] = dev;
else
- m_AnalogAudioSinkMap[label] = sink;
-
- i++;
+ m_AnalogAudioSinkMap[dev.m_DisplayName] = dev;
}
+ }
- numberSinks = sinkList.size();
-#if !defined(TARGET_DARWIN)
+ if ( Passthrough ? (m_DigitalAudioSinkMap.size() == 0) : (m_AnalogAudioSinkMap.size() == 0) )
+ {
+ AEDeviceEx dev;
+ dev.m_DeviceType = AE_DEVTYPE_UNKNOWN;
+ dev.m_DeviceName = "null:";
+ dev.m_DisplayName = g_localizeStrings.Get(34119);
+ if (Passthrough)
+ m_DigitalAudioSinkMap[dev.m_DisplayName] = dev;
+ else
+ m_AnalogAudioSinkMap[dev.m_DisplayName] = dev;
+
+ pControl->AddLabel(dev.m_DisplayName, 0);
+ numberSinks = 1;
+ selectedValue = 0;
}
-#endif
+ else
+ numberSinks = Passthrough ? m_DigitalAudioSinkMap.size() : m_AnalogAudioSinkMap.size();
if (selectedValue < 0)
{
- CLog::Log(LOGWARNING, "Failed to find previously selected audio sink");
- pControl->AddLabel(currentDevice, numberSinks);
- pControl->SetValue(numberSinks);
+ if (currentDevice.empty())
+ pControl->SetValue(0);
+ else
+ {
+ CLog::Log(LOGWARNING, "Failed to find previously selected audio sink");
+ pControl->AddLabel(currentDevice, numberSinks);
+ pControl->SetValue(numberSinks);
+ }
}
else
pControl->SetValue(selectedValue);
View
7 xbmc/settings/GUIWindowSettingsCategory.h
@@ -25,6 +25,8 @@
#include "GUISettings.h"
#include "utils/Stopwatch.h"
+struct AEDeviceEx;
+
class CGUIWindowSettingsCategory :
public CGUIWindow
{
@@ -97,8 +99,9 @@ class CGUIWindowSettingsCategory :
CStdString m_strOldTrackFormat;
CStdString m_strOldTrackFormatRight;
- std::map<CStdString, CStdString> m_AnalogAudioSinkMap;
- std::map<CStdString, CStdString> m_DigitalAudioSinkMap;
+ std::map<std::string, AEDeviceEx> m_AnalogAudioSinkMap;
+ std::map<std::string, AEDeviceEx> m_DigitalAudioSinkMap;
+ typedef std::map<std::string, AEDeviceEx>::iterator AudioSinkMapIterator;
std::map<CStdString, CStdString> m_SkinFontSetIDs;
bool m_returningFromSkinLoad; // true if we are returning from loading the skin
Something went wrong with that request. Please try again.